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

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

Issue 2812173003: Fixing bug that results in incorrect ICE role with ICE lite endpoints. (Closed)
Patch Set: Created 3 years, 8 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
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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 kIcePwd1, ICEMODE_LITE, CONNECTIONROLE_NONE, 827 kIcePwd1, ICEMODE_LITE, CONNECTIONROLE_NONE,
828 nullptr); 828 nullptr);
829 ASSERT_TRUE(transport_controller_->SetRemoteTransportDescription( 829 ASSERT_TRUE(transport_controller_->SetRemoteTransportDescription(
830 "audio", remote_desc, CA_ANSWER, nullptr)); 830 "audio", remote_desc, CA_ANSWER, nullptr));
831 EXPECT_EQ(ICEROLE_CONTROLLING, transport->fake_ice_transport()->GetIceRole()); 831 EXPECT_EQ(ICEROLE_CONTROLLING, transport->fake_ice_transport()->GetIceRole());
832 // After receiving remote description with ICEMODE_LITE, transport should 832 // After receiving remote description with ICEMODE_LITE, transport should
833 // have mode set to ICEMODE_LITE. 833 // have mode set to ICEMODE_LITE.
834 EXPECT_EQ(ICEMODE_LITE, transport->fake_ice_transport()->remote_ice_mode()); 834 EXPECT_EQ(ICEMODE_LITE, transport->fake_ice_transport()->remote_ice_mode());
835 } 835 }
836 836
837 // Tests that the ICE role remains "controlling" if a subsequent offer that
838 // does an ICE restart is received from an ICE lite endpoint. Regression test
839 // for: https://crbug.com/710760
840 TEST_F(TransportControllerTest,
841 IceRoleIsControllingAfterIceRestartFromIceLiteEndpoint) {
842 FakeDtlsTransport* transport = CreateFakeDtlsTransport("audio", 1);
843 ASSERT_NE(nullptr, transport);
844 std::string err;
845
846 // Initial offer/answer.
847 TransportDescription remote_desc(std::vector<std::string>(), kIceUfrag1,
848 kIcePwd1, ICEMODE_LITE,
849 CONNECTIONROLE_ACTPASS, nullptr);
850 TransportDescription local_desc(kIceUfrag1, kIcePwd1);
851 ASSERT_TRUE(transport_controller_->SetRemoteTransportDescription(
852 "audio", remote_desc, CA_OFFER, &err));
853 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription(
854 "audio", local_desc, CA_ANSWER, nullptr));
855 // Subsequent ICE restart offer/answer.
856 remote_desc.ice_ufrag = kIceUfrag2;
857 remote_desc.ice_pwd = kIcePwd2;
858 local_desc.ice_ufrag = kIceUfrag2;
859 local_desc.ice_pwd = kIcePwd2;
860 ASSERT_TRUE(transport_controller_->SetRemoteTransportDescription(
861 "audio", remote_desc, CA_OFFER, &err));
862 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription(
863 "audio", local_desc, CA_ANSWER, nullptr));
864
865 EXPECT_EQ(ICEROLE_CONTROLLING, transport->fake_ice_transport()->GetIceRole());
866 }
867
837 // Tests SetNeedsIceRestartFlag and NeedsIceRestart, setting the flag and then 868 // Tests SetNeedsIceRestartFlag and NeedsIceRestart, setting the flag and then
838 // initiating an ICE restart for one of the transports. 869 // initiating an ICE restart for one of the transports.
839 TEST_F(TransportControllerTest, NeedsIceRestart) { 870 TEST_F(TransportControllerTest, NeedsIceRestart) {
840 CreateFakeDtlsTransport("audio", 1); 871 CreateFakeDtlsTransport("audio", 1);
841 CreateFakeDtlsTransport("video", 1); 872 CreateFakeDtlsTransport("video", 1);
842 873
843 // Do initial offer/answer so there's something to restart. 874 // Do initial offer/answer so there's something to restart.
844 TransportDescription local_desc(kIceUfrag1, kIcePwd1); 875 TransportDescription local_desc(kIceUfrag1, kIcePwd1);
845 TransportDescription remote_desc(kIceUfrag1, kIcePwd1); 876 TransportDescription remote_desc(kIceUfrag1, kIcePwd1);
846 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription( 877 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription(
(...skipping 22 matching lines...) Expand all
869 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription( 900 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription(
870 "audio", ice_restart_local_desc, CA_OFFER, nullptr)); 901 "audio", ice_restart_local_desc, CA_OFFER, nullptr));
871 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription( 902 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription(
872 "video", local_desc, CA_OFFER, nullptr)); 903 "video", local_desc, CA_OFFER, nullptr));
873 // NeedsIceRestart should still be true for video. 904 // NeedsIceRestart should still be true for video.
874 EXPECT_FALSE(transport_controller_->NeedsIceRestart("audio")); 905 EXPECT_FALSE(transport_controller_->NeedsIceRestart("audio"));
875 EXPECT_TRUE(transport_controller_->NeedsIceRestart("video")); 906 EXPECT_TRUE(transport_controller_->NeedsIceRestart("video"));
876 } 907 }
877 908
878 } // namespace cricket { 909 } // namespace cricket {
OLDNEW
« webrtc/p2p/base/transportcontroller.cc ('K') | « webrtc/p2p/base/transportcontroller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698