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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 742 |
743 // The endpoint that initiated an ICE restart should keep the existing role. | 743 // The endpoint that initiated an ICE restart should keep the existing role. |
744 TransportDescription ice_restart_desc(std::vector<std::string>(), kIceUfrag3, | 744 TransportDescription ice_restart_desc(std::vector<std::string>(), kIceUfrag3, |
745 kIcePwd3, ICEMODE_FULL, | 745 kIcePwd3, ICEMODE_FULL, |
746 CONNECTIONROLE_ACTPASS, nullptr); | 746 CONNECTIONROLE_ACTPASS, nullptr); |
747 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription( | 747 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription( |
748 "audio", ice_restart_desc, CA_OFFER, &err)); | 748 "audio", ice_restart_desc, CA_OFFER, &err)); |
749 EXPECT_EQ(ICEROLE_CONTROLLED, channel->GetIceRole()); | 749 EXPECT_EQ(ICEROLE_CONTROLLED, channel->GetIceRole()); |
750 } | 750 } |
751 | 751 |
752 // Tests channel role is reversed after receiving ice-lite from remote. | |
753 TEST_F(TransportControllerTest, TestSetRemoteIceLiteInOffer) { | |
754 FakeTransportChannel* channel = CreateChannel("audio", 1); | |
755 ASSERT_NE(nullptr, channel); | |
756 std::string err; | |
757 | |
758 transport_controller_->SetIceRole(ICEROLE_CONTROLLED); | |
759 TransportDescription remote_desc(std::vector<std::string>(), kIceUfrag1, | |
760 kIcePwd1, ICEMODE_LITE, | |
761 CONNECTIONROLE_ACTPASS, nullptr); | |
762 EXPECT_TRUE(transport_controller_->SetRemoteTransportDescription( | |
763 "audio", remote_desc, CA_OFFER, &err)); | |
764 TransportDescription local_desc(kIceUfrag1, kIcePwd1); | |
765 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription( | |
766 "audio", local_desc, CA_ANSWER, nullptr)); | |
767 | |
768 EXPECT_EQ(ICEROLE_CONTROLLING, channel->GetIceRole()); | |
769 EXPECT_EQ(ICEMODE_LITE, channel->remote_ice_mode()); | |
770 } | |
771 | |
772 // Tests ice-lite in remote answer. | |
773 TEST_F(TransportControllerTest, TestSetRemoteIceLiteInAnswer) { | |
774 FakeTransportChannel* channel = CreateChannel("audio", 1); | |
775 ASSERT_NE(nullptr, channel); | |
776 std::string err; | |
777 | |
778 transport_controller_->SetIceRole(ICEROLE_CONTROLLING); | |
779 TransportDescription local_desc(kIceUfrag1, kIcePwd1); | |
780 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription( | |
781 "audio", local_desc, CA_OFFER, nullptr)); | |
782 EXPECT_EQ(ICEROLE_CONTROLLING, channel->GetIceRole()); | |
783 // Channels will be created in ICEFULL_MODE. | |
784 EXPECT_EQ(ICEMODE_FULL, channel->remote_ice_mode()); | |
785 TransportDescription remote_desc(std::vector<std::string>(), kIceUfrag1, | |
786 kIcePwd1, ICEMODE_LITE, CONNECTIONROLE_NONE, | |
787 nullptr); | |
788 ASSERT_TRUE(transport_controller_->SetRemoteTransportDescription( | |
789 "audio", remote_desc, CA_ANSWER, nullptr)); | |
790 EXPECT_EQ(ICEROLE_CONTROLLING, channel->GetIceRole()); | |
791 // After receiving remote description with ICEMODE_LITE, channel should | |
792 // have mode set to ICEMODE_LITE. | |
793 EXPECT_EQ(ICEMODE_LITE, channel->remote_ice_mode()); | |
794 } | |
795 | |
796 } // namespace cricket { | 752 } // namespace cricket { |
OLD | NEW |