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

Unified Diff: webrtc/p2p/base/transportcontroller_unittest.cc

Issue 2517883002: Refactoring that removes P2PTransport and DtlsTransport classes. (Closed)
Patch Set: Adding stub transport.h file for backwards compat. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/p2p/base/transportcontroller.cc ('k') | webrtc/p2p/client/socketmonitor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « webrtc/p2p/base/transportcontroller.cc ('k') | webrtc/p2p/client/socketmonitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698