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

Side by Side Diff: webrtc/p2p/base/transport_unittest.cc

Issue 2046123003: Don't re-determine ICE role on an ICE restart. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/transport.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2011 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 // Verifies that IceCredentialsChanged returns true when either ufrag or pwd 91 // Verifies that IceCredentialsChanged returns true when either ufrag or pwd
92 // changed, and false in other cases. 92 // changed, and false in other cases.
93 TEST_F(TransportTest, TestIceCredentialsChanged) { 93 TEST_F(TransportTest, TestIceCredentialsChanged) {
94 EXPECT_TRUE(cricket::IceCredentialsChanged("u1", "p1", "u2", "p2")); 94 EXPECT_TRUE(cricket::IceCredentialsChanged("u1", "p1", "u2", "p2"));
95 EXPECT_TRUE(cricket::IceCredentialsChanged("u1", "p1", "u2", "p1")); 95 EXPECT_TRUE(cricket::IceCredentialsChanged("u1", "p1", "u2", "p1"));
96 EXPECT_TRUE(cricket::IceCredentialsChanged("u1", "p1", "u1", "p2")); 96 EXPECT_TRUE(cricket::IceCredentialsChanged("u1", "p1", "u1", "p2"));
97 EXPECT_FALSE(cricket::IceCredentialsChanged("u1", "p1", "u1", "p1")); 97 EXPECT_FALSE(cricket::IceCredentialsChanged("u1", "p1", "u1", "p1"));
98 } 98 }
99 99
100 // This test verifies that the callee's ICE role changes from controlled to 100 // This test verifies that the callee's ICE role remains the same when the
101 // controlling when the callee triggers an ICE restart. 101 // callee triggers an ICE restart.
102 //
103 // RFC5245 currently says that the role *should* change on an ICE restart,
104 // but this rule was intended for an ICE restart that occurs when an endpoint
105 // is changing to ICE lite (which we already handle). See discussion here:
106 // https://mailarchive.ietf.org/arch/msg/ice/C0_QRCTNcwtvUF12y28jQicPR10
102 TEST_F(TransportTest, TestIceControlledToControllingOnIceRestart) { 107 TEST_F(TransportTest, TestIceControlledToControllingOnIceRestart) {
103 EXPECT_TRUE(SetupChannel()); 108 EXPECT_TRUE(SetupChannel());
104 transport_->SetIceRole(cricket::ICEROLE_CONTROLLED); 109 transport_->SetIceRole(cricket::ICEROLE_CONTROLLED);
105 110
106 cricket::TransportDescription desc(kIceUfrag1, kIcePwd1); 111 cricket::TransportDescription desc(kIceUfrag1, kIcePwd1);
107 ASSERT_TRUE(transport_->SetRemoteTransportDescription(desc, 112 ASSERT_TRUE(transport_->SetRemoteTransportDescription(desc,
108 cricket::CA_OFFER, 113 cricket::CA_OFFER,
109 NULL)); 114 NULL));
110 ASSERT_TRUE(transport_->SetLocalTransportDescription(desc, 115 ASSERT_TRUE(transport_->SetLocalTransportDescription(desc,
111 cricket::CA_ANSWER, 116 cricket::CA_ANSWER,
112 NULL)); 117 NULL));
113 EXPECT_EQ(cricket::ICEROLE_CONTROLLED, transport_->ice_role()); 118 EXPECT_EQ(cricket::ICEROLE_CONTROLLED, transport_->ice_role());
114 119
115 cricket::TransportDescription new_local_desc(kIceUfrag2, kIcePwd2); 120 cricket::TransportDescription new_local_desc(kIceUfrag2, kIcePwd2);
116 ASSERT_TRUE(transport_->SetLocalTransportDescription(new_local_desc, 121 ASSERT_TRUE(transport_->SetLocalTransportDescription(new_local_desc,
117 cricket::CA_OFFER, 122 cricket::CA_OFFER,
118 NULL)); 123 NULL));
119 EXPECT_EQ(cricket::ICEROLE_CONTROLLING, transport_->ice_role()); 124 EXPECT_EQ(cricket::ICEROLE_CONTROLLED, transport_->ice_role());
120 EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel_->GetIceRole()); 125 EXPECT_EQ(cricket::ICEROLE_CONTROLLED, channel_->GetIceRole());
121 } 126 }
122 127
123 // This test verifies that the caller's ICE role changes from controlling to 128 // This test verifies that the caller's ICE role remains the same when the
124 // controlled when the callee triggers an ICE restart. 129 // callee triggers an ICE restart.
130 //
131 // RFC5245 currently says that the role *should* change on an ICE restart,
132 // but this rule was intended for an ICE restart that occurs when an endpoint
133 // is changing to ICE lite (which we already handle). See discussion here:
134 // https://mailarchive.ietf.org/arch/msg/ice/C0_QRCTNcwtvUF12y28jQicPR10
125 TEST_F(TransportTest, TestIceControllingToControlledOnIceRestart) { 135 TEST_F(TransportTest, TestIceControllingToControlledOnIceRestart) {
126 EXPECT_TRUE(SetupChannel()); 136 EXPECT_TRUE(SetupChannel());
127 transport_->SetIceRole(cricket::ICEROLE_CONTROLLING); 137 transport_->SetIceRole(cricket::ICEROLE_CONTROLLING);
128 138
129 cricket::TransportDescription desc(kIceUfrag1, kIcePwd1); 139 cricket::TransportDescription desc(kIceUfrag1, kIcePwd1);
130 ASSERT_TRUE(transport_->SetLocalTransportDescription(desc, 140 ASSERT_TRUE(transport_->SetLocalTransportDescription(desc,
131 cricket::CA_OFFER, 141 cricket::CA_OFFER,
132 NULL)); 142 NULL));
133 ASSERT_TRUE(transport_->SetRemoteTransportDescription(desc, 143 ASSERT_TRUE(transport_->SetRemoteTransportDescription(desc,
134 cricket::CA_ANSWER, 144 cricket::CA_ANSWER,
135 NULL)); 145 NULL));
136 EXPECT_EQ(cricket::ICEROLE_CONTROLLING, transport_->ice_role()); 146 EXPECT_EQ(cricket::ICEROLE_CONTROLLING, transport_->ice_role());
137 147
138 cricket::TransportDescription new_local_desc(kIceUfrag2, kIcePwd2); 148 cricket::TransportDescription new_local_desc(kIceUfrag2, kIcePwd2);
139 ASSERT_TRUE(transport_->SetLocalTransportDescription(new_local_desc, 149 ASSERT_TRUE(transport_->SetLocalTransportDescription(new_local_desc,
140 cricket::CA_ANSWER, 150 cricket::CA_ANSWER,
141 NULL)); 151 NULL));
142 EXPECT_EQ(cricket::ICEROLE_CONTROLLED, transport_->ice_role()); 152 EXPECT_EQ(cricket::ICEROLE_CONTROLLING, transport_->ice_role());
143 EXPECT_EQ(cricket::ICEROLE_CONTROLLED, channel_->GetIceRole()); 153 EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel_->GetIceRole());
144 } 154 }
145 155
146 // This test verifies that the caller's ICE role is still controlling after the 156 // This test verifies that the caller's ICE role is still controlling after the
147 // callee triggers ICE restart if the callee's ICE mode is LITE. 157 // callee triggers ICE restart if the callee's ICE mode is LITE.
148 TEST_F(TransportTest, TestIceControllingOnIceRestartIfRemoteIsIceLite) { 158 TEST_F(TransportTest, TestIceControllingOnIceRestartIfRemoteIsIceLite) {
149 EXPECT_TRUE(SetupChannel()); 159 EXPECT_TRUE(SetupChannel());
150 transport_->SetIceRole(cricket::ICEROLE_CONTROLLING); 160 transport_->SetIceRole(cricket::ICEROLE_CONTROLLING);
151 161
152 cricket::TransportDescription desc(kIceUfrag1, kIcePwd1); 162 cricket::TransportDescription desc(kIceUfrag1, kIcePwd1);
153 ASSERT_TRUE(transport_->SetLocalTransportDescription(desc, 163 ASSERT_TRUE(transport_->SetLocalTransportDescription(desc,
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 remote_desc.connection_role = param.remote_role; 415 remote_desc.connection_role = param.remote_role;
406 416
407 ASSERT_TRUE(transport_->SetRemoteTransportDescription( 417 ASSERT_TRUE(transport_->SetRemoteTransportDescription(
408 remote_desc, param.remote_action, nullptr)); 418 remote_desc, param.remote_action, nullptr));
409 ASSERT_TRUE(transport_->SetLocalTransportDescription( 419 ASSERT_TRUE(transport_->SetLocalTransportDescription(
410 local_desc, param.local_action, nullptr)); 420 local_desc, param.local_action, nullptr));
411 EXPECT_FALSE( 421 EXPECT_FALSE(
412 transport_->NegotiateRole(param.local_action, &ssl_role, &error_desc)); 422 transport_->NegotiateRole(param.local_action, &ssl_role, &error_desc));
413 } 423 }
414 } 424 }
OLDNEW
« no previous file with comments | « webrtc/p2p/base/transport.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698