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

Side by Side Diff: webrtc/p2p/base/transportcontroller_unittest.cc

Issue 2563153002: Implement the "needs-ice-restart" logic for SetConfiguration. (Closed)
Patch Set: Fixing signed/unsigned comparison warning. Created 4 years 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 | « webrtc/p2p/base/transportcontroller.cc ('k') | no next file » | 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 * Copyright 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 kIcePwd1, ICEMODE_LITE, CONNECTIONROLE_NONE, 786 kIcePwd1, ICEMODE_LITE, CONNECTIONROLE_NONE,
787 nullptr); 787 nullptr);
788 ASSERT_TRUE(transport_controller_->SetRemoteTransportDescription( 788 ASSERT_TRUE(transport_controller_->SetRemoteTransportDescription(
789 "audio", remote_desc, CA_ANSWER, nullptr)); 789 "audio", remote_desc, CA_ANSWER, nullptr));
790 EXPECT_EQ(ICEROLE_CONTROLLING, channel->GetIceRole()); 790 EXPECT_EQ(ICEROLE_CONTROLLING, channel->GetIceRole());
791 // After receiving remote description with ICEMODE_LITE, channel should 791 // After receiving remote description with ICEMODE_LITE, channel should
792 // have mode set to ICEMODE_LITE. 792 // have mode set to ICEMODE_LITE.
793 EXPECT_EQ(ICEMODE_LITE, channel->remote_ice_mode()); 793 EXPECT_EQ(ICEMODE_LITE, channel->remote_ice_mode());
794 } 794 }
795 795
796 // Tests SetNeedsIceRestartFlag and NeedsIceRestart, setting the flag and then
797 // initiating an ICE restart for one of the transports.
798 TEST_F(TransportControllerTest, NeedsIceRestart) {
799 CreateChannel("audio", 1);
800 CreateChannel("video", 1);
801
802 // Do initial offer/answer so there's something to restart.
803 TransportDescription local_desc(kIceUfrag1, kIcePwd1);
804 TransportDescription remote_desc(kIceUfrag1, kIcePwd1);
805 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription(
806 "audio", local_desc, CA_OFFER, nullptr));
807 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription(
808 "video", local_desc, CA_OFFER, nullptr));
809 ASSERT_TRUE(transport_controller_->SetRemoteTransportDescription(
810 "audio", remote_desc, CA_ANSWER, nullptr));
811 ASSERT_TRUE(transport_controller_->SetRemoteTransportDescription(
812 "video", remote_desc, CA_ANSWER, nullptr));
813
814 // Initially NeedsIceRestart should return false.
815 EXPECT_FALSE(transport_controller_->NeedsIceRestart("audio"));
816 EXPECT_FALSE(transport_controller_->NeedsIceRestart("video"));
817
818 // Set the needs-ice-restart flag and verify NeedsIceRestart starts returning
819 // true.
820 transport_controller_->SetNeedsIceRestartFlag();
821 EXPECT_TRUE(transport_controller_->NeedsIceRestart("audio"));
822 EXPECT_TRUE(transport_controller_->NeedsIceRestart("video"));
823 // For a nonexistent transport, false should be returned.
824 EXPECT_FALSE(transport_controller_->NeedsIceRestart("deadbeef"));
825
826 // Do ICE restart but only for audio.
827 TransportDescription ice_restart_local_desc(kIceUfrag2, kIcePwd2);
828 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription(
829 "audio", ice_restart_local_desc, CA_OFFER, nullptr));
830 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription(
831 "video", local_desc, CA_OFFER, nullptr));
832 // NeedsIceRestart should still be true for video.
833 EXPECT_FALSE(transport_controller_->NeedsIceRestart("audio"));
834 EXPECT_TRUE(transport_controller_->NeedsIceRestart("video"));
835 }
836
796 } // namespace cricket { 837 } // namespace cricket {
OLDNEW
« no previous file with comments | « webrtc/p2p/base/transportcontroller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698