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

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

Issue 2285453002: Add parameter to TransportController to not change ICE role on restart. (Closed)
Patch Set: Fixing copy-pasted comment. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/p2p/base/transportcontroller.cc ('k') | no next file » | 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 2b11286e9973acacbedb83f136f775167fafd150..f44f831b0e4fcf6b4ca79c20744e593975f5666b 100644
--- a/webrtc/p2p/base/transportcontroller_unittest.cc
+++ b/webrtc/p2p/base/transportcontroller_unittest.cc
@@ -689,7 +689,7 @@ TEST_F(TransportControllerTest, TestSignalingOccursOnSignalingThread) {
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=628676
// TODO(deadbeef): Remove this when these old versions of Chrome reach a low
// enough population.
-TEST_F(TransportControllerTest, IceRoleRedeterminedOnIceRestart) {
+TEST_F(TransportControllerTest, IceRoleRedeterminedOnIceRestartByDefault) {
FakeTransportChannel* channel = CreateChannel("audio", 1);
ASSERT_NE(nullptr, channel);
std::string err;
@@ -717,4 +717,36 @@ TEST_F(TransportControllerTest, IceRoleRedeterminedOnIceRestart) {
EXPECT_EQ(ICEROLE_CONTROLLING, channel->GetIceRole());
}
+// Test that if the TransportController was created with the
+// |redetermine_role_on_ice_restart| parameter set to false, the role is *not*
+// redetermined on an ICE restart.
+TEST_F(TransportControllerTest, IceRoleNotRedetermined) {
+ bool redetermine_role = false;
+ transport_controller_.reset(new TransportControllerForTest(redetermine_role));
+ FakeTransportChannel* channel = CreateChannel("audio", 1);
+ ASSERT_NE(nullptr, channel);
+ std::string err;
+ // Do an initial offer answer, so that the next offer is an ICE restart.
+ transport_controller_->SetIceRole(ICEROLE_CONTROLLED);
+ TransportDescription remote_desc(std::vector<std::string>(), kIceUfrag1,
+ kIcePwd1, ICEMODE_FULL,
+ CONNECTIONROLE_ACTPASS, nullptr);
+ EXPECT_TRUE(transport_controller_->SetRemoteTransportDescription(
+ "audio", remote_desc, CA_OFFER, &err));
+ TransportDescription local_desc(std::vector<std::string>(), kIceUfrag2,
+ kIcePwd2, ICEMODE_FULL,
+ CONNECTIONROLE_ACTPASS, nullptr);
+ EXPECT_TRUE(transport_controller_->SetLocalTransportDescription(
+ "audio", local_desc, CA_ANSWER, &err));
+ EXPECT_EQ(ICEROLE_CONTROLLED, channel->GetIceRole());
+
+ // The endpoint that initiated an ICE restart should keep the existing role.
+ TransportDescription ice_restart_desc(std::vector<std::string>(), kIceUfrag3,
+ kIcePwd3, ICEMODE_FULL,
+ CONNECTIONROLE_ACTPASS, nullptr);
+ EXPECT_TRUE(transport_controller_->SetLocalTransportDescription(
+ "audio", ice_restart_desc, CA_OFFER, &err));
+ EXPECT_EQ(ICEROLE_CONTROLLED, channel->GetIceRole());
+}
+
} // namespace cricket {
« no previous file with comments | « webrtc/p2p/base/transportcontroller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698