OLD | NEW |
---|---|
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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
682 | 682 |
683 EXPECT_TRUE(!signaled_on_non_signaling_thread_); | 683 EXPECT_TRUE(!signaled_on_non_signaling_thread_); |
684 } | 684 } |
685 | 685 |
686 // Older versions of Chrome expect the ICE role to be re-determined when an | 686 // Older versions of Chrome expect the ICE role to be re-determined when an |
687 // ICE restart occurs, and also don't perform conflict resolution correctly, | 687 // ICE restart occurs, and also don't perform conflict resolution correctly, |
688 // so for now we can't safely stop doing this. | 688 // so for now we can't safely stop doing this. |
689 // See: https://bugs.chromium.org/p/chromium/issues/detail?id=628676 | 689 // See: https://bugs.chromium.org/p/chromium/issues/detail?id=628676 |
690 // TODO(deadbeef): Remove this when these old versions of Chrome reach a low | 690 // TODO(deadbeef): Remove this when these old versions of Chrome reach a low |
691 // enough population. | 691 // enough population. |
692 TEST_F(TransportControllerTest, IceRoleRedeterminedOnIceRestart) { | 692 TEST_F(TransportControllerTest, IceRoleRedeterminedOnIceRestartByDefault) { |
693 FakeTransportChannel* channel = CreateChannel("audio", 1); | 693 FakeTransportChannel* channel = CreateChannel("audio", 1); |
694 ASSERT_NE(nullptr, channel); | 694 ASSERT_NE(nullptr, channel); |
695 std::string err; | 695 std::string err; |
696 // Do an initial offer answer, so that the next offer is an ICE restart. | 696 // Do an initial offer answer, so that the next offer is an ICE restart. |
697 transport_controller_->SetIceRole(ICEROLE_CONTROLLED); | 697 transport_controller_->SetIceRole(ICEROLE_CONTROLLED); |
698 TransportDescription remote_desc(std::vector<std::string>(), kIceUfrag1, | 698 TransportDescription remote_desc(std::vector<std::string>(), kIceUfrag1, |
699 kIcePwd1, ICEMODE_FULL, | 699 kIcePwd1, ICEMODE_FULL, |
700 CONNECTIONROLE_ACTPASS, nullptr); | 700 CONNECTIONROLE_ACTPASS, nullptr); |
701 EXPECT_TRUE(transport_controller_->SetRemoteTransportDescription( | 701 EXPECT_TRUE(transport_controller_->SetRemoteTransportDescription( |
702 "audio", remote_desc, CA_OFFER, &err)); | 702 "audio", remote_desc, CA_OFFER, &err)); |
703 TransportDescription local_desc(std::vector<std::string>(), kIceUfrag2, | 703 TransportDescription local_desc(std::vector<std::string>(), kIceUfrag2, |
704 kIcePwd2, ICEMODE_FULL, | 704 kIcePwd2, ICEMODE_FULL, |
705 CONNECTIONROLE_ACTPASS, nullptr); | 705 CONNECTIONROLE_ACTPASS, nullptr); |
706 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription( | 706 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription( |
707 "audio", local_desc, CA_ANSWER, &err)); | 707 "audio", local_desc, CA_ANSWER, &err)); |
708 EXPECT_EQ(ICEROLE_CONTROLLED, channel->GetIceRole()); | 708 EXPECT_EQ(ICEROLE_CONTROLLED, channel->GetIceRole()); |
709 | 709 |
710 // The endpoint that initiated an ICE restart should take the controlling | 710 // The endpoint that initiated an ICE restart should take the controlling |
711 // role. | 711 // role. |
712 TransportDescription ice_restart_desc(std::vector<std::string>(), kIceUfrag3, | 712 TransportDescription ice_restart_desc(std::vector<std::string>(), kIceUfrag3, |
713 kIcePwd3, ICEMODE_FULL, | 713 kIcePwd3, ICEMODE_FULL, |
714 CONNECTIONROLE_ACTPASS, nullptr); | 714 CONNECTIONROLE_ACTPASS, nullptr); |
715 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription( | 715 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription( |
716 "audio", ice_restart_desc, CA_OFFER, &err)); | 716 "audio", ice_restart_desc, CA_OFFER, &err)); |
717 EXPECT_EQ(ICEROLE_CONTROLLING, channel->GetIceRole()); | 717 EXPECT_EQ(ICEROLE_CONTROLLING, channel->GetIceRole()); |
718 } | 718 } |
719 | 719 |
720 // Test that if the TransportController was created with the | |
721 // |redetermine_role_on_ice_restart| parameter set to false, the role is *not* | |
722 // redetermined on an ICE restart. | |
723 TEST_F(TransportControllerTest, IceRoleNotRedetermined) { | |
724 bool redetermine_role = false; | |
725 transport_controller_.reset(new TransportControllerForTest(redetermine_role)); | |
726 FakeTransportChannel* channel = CreateChannel("audio", 1); | |
727 ASSERT_NE(nullptr, channel); | |
728 std::string err; | |
729 // Do an initial offer answer, so that the next offer is an ICE restart. | |
730 transport_controller_->SetIceRole(ICEROLE_CONTROLLED); | |
731 TransportDescription remote_desc(std::vector<std::string>(), kIceUfrag1, | |
732 kIcePwd1, ICEMODE_FULL, | |
733 CONNECTIONROLE_ACTPASS, nullptr); | |
734 EXPECT_TRUE(transport_controller_->SetRemoteTransportDescription( | |
735 "audio", remote_desc, CA_OFFER, &err)); | |
736 TransportDescription local_desc(std::vector<std::string>(), kIceUfrag2, | |
737 kIcePwd2, ICEMODE_FULL, | |
738 CONNECTIONROLE_ACTPASS, nullptr); | |
739 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription( | |
740 "audio", local_desc, CA_ANSWER, &err)); | |
741 EXPECT_EQ(ICEROLE_CONTROLLED, channel->GetIceRole()); | |
742 | |
743 // The endpoint that initiated an ICE restart should take the controlling | |
skvlad
2016/08/26 23:02:35
"should keep the previous role"?
Taylor Brandstetter
2016/08/26 23:13:03
Good catch.
| |
744 // role. | |
745 TransportDescription ice_restart_desc(std::vector<std::string>(), kIceUfrag3, | |
746 kIcePwd3, ICEMODE_FULL, | |
747 CONNECTIONROLE_ACTPASS, nullptr); | |
748 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription( | |
749 "audio", ice_restart_desc, CA_OFFER, &err)); | |
750 EXPECT_EQ(ICEROLE_CONTROLLED, channel->GetIceRole()); | |
751 } | |
752 | |
720 } // namespace cricket { | 753 } // namespace cricket { |
OLD | NEW |