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

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

Issue 2004463003: Handle any number of role conflicts; not just the first. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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/transportcontroller.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 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 FakeTransportChannel* channel2 = CreateChannel("video", 1); 248 FakeTransportChannel* channel2 = CreateChannel("video", 1);
249 ASSERT_NE(nullptr, channel2); 249 ASSERT_NE(nullptr, channel2);
250 250
251 transport_controller_->SetIceRole(cricket::ICEROLE_CONTROLLING); 251 transport_controller_->SetIceRole(cricket::ICEROLE_CONTROLLING);
252 EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel1->GetIceRole()); 252 EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel1->GetIceRole());
253 EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel2->GetIceRole()); 253 EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel2->GetIceRole());
254 254
255 channel1->SignalRoleConflict(channel1); 255 channel1->SignalRoleConflict(channel1);
256 EXPECT_EQ(cricket::ICEROLE_CONTROLLED, channel1->GetIceRole()); 256 EXPECT_EQ(cricket::ICEROLE_CONTROLLED, channel1->GetIceRole());
257 EXPECT_EQ(cricket::ICEROLE_CONTROLLED, channel2->GetIceRole()); 257 EXPECT_EQ(cricket::ICEROLE_CONTROLLED, channel2->GetIceRole());
258
259 // Should be able to handle a second role conflict. The remote endpoint can
260 // change its role/tie-breaker when it does an ICE restart.
261 channel2->SignalRoleConflict(channel2);
262 EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel1->GetIceRole());
263 EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel2->GetIceRole());
258 } 264 }
259 265
260 TEST_F(TransportControllerTest, TestGetSslRole) { 266 TEST_F(TransportControllerTest, TestGetSslRole) {
261 FakeTransportChannel* channel = CreateChannel("audio", 1); 267 FakeTransportChannel* channel = CreateChannel("audio", 1);
262 ASSERT_NE(nullptr, channel); 268 ASSERT_NE(nullptr, channel);
263 ASSERT_TRUE(channel->SetSslRole(rtc::SSL_CLIENT)); 269 ASSERT_TRUE(channel->SetSslRole(rtc::SSL_CLIENT));
264 rtc::SSLRole role; 270 rtc::SSLRole role;
265 EXPECT_FALSE(transport_controller_->GetSslRole("video", &role)); 271 EXPECT_FALSE(transport_controller_->GetSslRole("video", &role));
266 EXPECT_TRUE(transport_controller_->GetSslRole("audio", &role)); 272 EXPECT_TRUE(transport_controller_->GetSslRole("audio", &role));
267 EXPECT_EQ(rtc::SSL_CLIENT, role); 273 EXPECT_EQ(rtc::SSL_CLIENT, role);
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 // new --> gathering --> complete 682 // new --> gathering --> complete
677 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout); 683 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout);
678 EXPECT_EQ(2, gathering_state_signal_count_); 684 EXPECT_EQ(2, gathering_state_signal_count_);
679 685
680 EXPECT_EQ_WAIT(1U, candidates_["audio"].size(), kTimeout); 686 EXPECT_EQ_WAIT(1U, candidates_["audio"].size(), kTimeout);
681 EXPECT_EQ_WAIT(1U, candidates_["video"].size(), kTimeout); 687 EXPECT_EQ_WAIT(1U, candidates_["video"].size(), kTimeout);
682 EXPECT_EQ(2, candidates_signal_count_); 688 EXPECT_EQ(2, candidates_signal_count_);
683 689
684 EXPECT_TRUE(!signaled_on_non_signaling_thread_); 690 EXPECT_TRUE(!signaled_on_non_signaling_thread_);
685 } 691 }
OLDNEW
« 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