Index: webrtc/p2p/base/transportcontroller_unittest.cc |
diff --git a/webrtc/p2p/base/transportcontroller_unittest.cc b/webrtc/p2p/base/transportcontroller_unittest.cc |
index d1f3816af9245821c3ba272eb474e475298afc27..9f30518af74c6efb59737b035d01db7e05813f58 100644 |
--- a/webrtc/p2p/base/transportcontroller_unittest.cc |
+++ b/webrtc/p2p/base/transportcontroller_unittest.cc |
@@ -749,4 +749,48 @@ TEST_F(TransportControllerTest, IceRoleNotRedetermined) { |
EXPECT_EQ(ICEROLE_CONTROLLED, channel->GetIceRole()); |
} |
+// Tests channel role is reversed after receiving ice-lite from remote. |
+TEST_F(TransportControllerTest, TestSetRemoteIceLiteInOffer) { |
+ FakeTransportChannel* channel = CreateChannel("audio", 1); |
+ ASSERT_NE(nullptr, channel); |
+ std::string err; |
+ |
+ transport_controller_->SetIceRole(ICEROLE_CONTROLLED); |
+ TransportDescription remote_desc(std::vector<std::string>(), kIceUfrag1, |
+ kIcePwd1, ICEMODE_LITE, |
+ CONNECTIONROLE_ACTPASS, nullptr); |
+ EXPECT_TRUE(transport_controller_->SetRemoteTransportDescription( |
+ "audio", remote_desc, CA_OFFER, &err)); |
+ TransportDescription local_desc(kIceUfrag1, kIcePwd1); |
+ ASSERT_TRUE(transport_controller_->SetLocalTransportDescription( |
+ "audio", local_desc, CA_ANSWER, nullptr)); |
+ |
+ EXPECT_EQ(ICEROLE_CONTROLLING, channel->GetIceRole()); |
+ EXPECT_EQ(ICEMODE_LITE, channel->remote_ice_mode()); |
+} |
+ |
+// Tests ice-lite in remote answer. |
+TEST_F(TransportControllerTest, TestSetRemoteIceLiteInAnswer) { |
+ FakeTransportChannel* channel = CreateChannel("audio", 1); |
+ ASSERT_NE(nullptr, channel); |
+ std::string err; |
+ |
+ transport_controller_->SetIceRole(ICEROLE_CONTROLLING); |
+ TransportDescription local_desc(kIceUfrag1, kIcePwd1); |
+ ASSERT_TRUE(transport_controller_->SetLocalTransportDescription( |
+ "audio", local_desc, CA_OFFER, nullptr)); |
+ EXPECT_EQ(ICEROLE_CONTROLLING, channel->GetIceRole()); |
+ // Channels will be created in ICEFULL_MODE. |
+ EXPECT_EQ(ICEMODE_FULL, channel->remote_ice_mode()); |
+ TransportDescription remote_desc(std::vector<std::string>(), kIceUfrag1, |
+ kIcePwd1, ICEMODE_LITE, CONNECTIONROLE_NONE, |
+ nullptr); |
+ ASSERT_TRUE(transport_controller_->SetRemoteTransportDescription( |
+ "audio", remote_desc, CA_ANSWER, nullptr)); |
+ EXPECT_EQ(ICEROLE_CONTROLLING, channel->GetIceRole()); |
+ // After receiving remote description with ICEMODE_LITE, channel should |
+ // have mode set to ICEMODE_LITE. |
+ EXPECT_EQ(ICEMODE_LITE, channel->remote_ice_mode()); |
+} |
+ |
} // namespace cricket { |