Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1833)

Side by Side Diff: talk/app/webrtc/peerconnectioninterface_unittest.cc

Issue 1669993003: Remove deprecated PeerConnectionObserver::OnStateChange and OnIceComplete (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed tests. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « talk/app/webrtc/peerconnectioninterface.h ('k') | talk/app/webrtc/webrtcsession.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 default: 436 default:
437 ADD_FAILURE(); 437 ADD_FAILURE();
438 break; 438 break;
439 } 439 }
440 } 440 }
441 441
442 MediaStreamInterface* RemoteStream(const std::string& label) { 442 MediaStreamInterface* RemoteStream(const std::string& label) {
443 return remote_streams_->find(label); 443 return remote_streams_->find(label);
444 } 444 }
445 StreamCollectionInterface* remote_streams() const { return remote_streams_; } 445 StreamCollectionInterface* remote_streams() const { return remote_streams_; }
446 virtual void OnAddStream(MediaStreamInterface* stream) { 446 void OnAddStream(MediaStreamInterface* stream) override {
447 last_added_stream_ = stream; 447 last_added_stream_ = stream;
448 remote_streams_->AddStream(stream); 448 remote_streams_->AddStream(stream);
449 } 449 }
450 virtual void OnRemoveStream(MediaStreamInterface* stream) { 450 void OnRemoveStream(MediaStreamInterface* stream) override {
451 last_removed_stream_ = stream; 451 last_removed_stream_ = stream;
452 remote_streams_->RemoveStream(stream); 452 remote_streams_->RemoveStream(stream);
453 } 453 }
454 virtual void OnRenegotiationNeeded() { 454 void OnRenegotiationNeeded() override { renegotiation_needed_ = true; }
455 renegotiation_needed_ = true; 455 void OnDataChannel(DataChannelInterface* data_channel) override {
456 }
457 virtual void OnDataChannel(DataChannelInterface* data_channel) {
458 last_datachannel_ = data_channel; 456 last_datachannel_ = data_channel;
459 } 457 }
460 458
461 virtual void OnIceConnectionChange( 459 void OnIceConnectionChange(
462 PeerConnectionInterface::IceConnectionState new_state) { 460 PeerConnectionInterface::IceConnectionState new_state) override {
463 EXPECT_EQ(pc_->ice_connection_state(), new_state); 461 EXPECT_EQ(pc_->ice_connection_state(), new_state);
464 } 462 }
465 virtual void OnIceGatheringChange( 463 void OnIceGatheringChange(
466 PeerConnectionInterface::IceGatheringState new_state) { 464 PeerConnectionInterface::IceGatheringState new_state) override {
467 EXPECT_EQ(pc_->ice_gathering_state(), new_state); 465 EXPECT_EQ(pc_->ice_gathering_state(), new_state);
466 ice_complete_ = new_state == PeerConnectionInterface::kIceGatheringComplete;
468 } 467 }
469 virtual void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) { 468 void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) override {
470 EXPECT_NE(PeerConnectionInterface::kIceGatheringNew, 469 EXPECT_NE(PeerConnectionInterface::kIceGatheringNew,
471 pc_->ice_gathering_state()); 470 pc_->ice_gathering_state());
472 471
473 std::string sdp; 472 std::string sdp;
474 EXPECT_TRUE(candidate->ToString(&sdp)); 473 EXPECT_TRUE(candidate->ToString(&sdp));
475 EXPECT_LT(0u, sdp.size()); 474 EXPECT_LT(0u, sdp.size());
476 last_candidate_.reset(webrtc::CreateIceCandidate(candidate->sdp_mid(), 475 last_candidate_.reset(webrtc::CreateIceCandidate(candidate->sdp_mid(),
477 candidate->sdp_mline_index(), sdp, NULL)); 476 candidate->sdp_mline_index(), sdp, NULL));
478 EXPECT_TRUE(last_candidate_.get() != NULL); 477 EXPECT_TRUE(last_candidate_.get() != NULL);
479 } 478 }
480 // TODO(bemasc): Remove this once callers transition to OnSignalingChange.
481 virtual void OnIceComplete() {
482 ice_complete_ = true;
483 // OnIceGatheringChange(IceGatheringCompleted) and OnIceComplete() should
484 // be called approximately simultaneously. For ease of testing, this
485 // check additionally requires that they be called in the above order.
486 EXPECT_EQ(PeerConnectionInterface::kIceGatheringComplete,
487 pc_->ice_gathering_state());
488 }
489 479
490 // Returns the label of the last added stream. 480 // Returns the label of the last added stream.
491 // Empty string if no stream have been added. 481 // Empty string if no stream have been added.
492 std::string GetLastAddedStreamLabel() { 482 std::string GetLastAddedStreamLabel() {
493 if (last_added_stream_.get()) 483 if (last_added_stream_.get())
494 return last_added_stream_->label(); 484 return last_added_stream_->label();
495 return ""; 485 return "";
496 } 486 }
497 std::string GetLastRemovedStreamLabel() { 487 std::string GetLastRemovedStreamLabel() {
498 if (last_removed_stream_.get()) 488 if (last_removed_stream_.get())
(...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after
2516 FakeConstraints updated_answer_c; 2506 FakeConstraints updated_answer_c;
2517 answer_c.SetMandatoryReceiveAudio(false); 2507 answer_c.SetMandatoryReceiveAudio(false);
2518 answer_c.SetMandatoryReceiveVideo(false); 2508 answer_c.SetMandatoryReceiveVideo(false);
2519 2509
2520 cricket::MediaSessionOptions updated_answer_options; 2510 cricket::MediaSessionOptions updated_answer_options;
2521 EXPECT_TRUE( 2511 EXPECT_TRUE(
2522 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); 2512 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options));
2523 EXPECT_TRUE(updated_answer_options.has_audio()); 2513 EXPECT_TRUE(updated_answer_options.has_audio());
2524 EXPECT_TRUE(updated_answer_options.has_video()); 2514 EXPECT_TRUE(updated_answer_options.has_video());
2525 } 2515 }
OLDNEW
« no previous file with comments | « talk/app/webrtc/peerconnectioninterface.h ('k') | talk/app/webrtc/webrtcsession.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698