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

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

Issue 1642733002: Removing "candidates" attribute from TransportDescription. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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_unittest.cc ('k') | webrtc/p2p/base/transportdescription.h » ('j') | 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 &TransportControllerTest::CreateChannelsAndCompleteConnection_w, this)); 104 &TransportControllerTest::CreateChannelsAndCompleteConnection_w, this));
105 } 105 }
106 106
107 void CreateChannelsAndCompleteConnection_w() { 107 void CreateChannelsAndCompleteConnection_w() {
108 transport_controller_->SetIceRole(cricket::ICEROLE_CONTROLLING); 108 transport_controller_->SetIceRole(cricket::ICEROLE_CONTROLLING);
109 FakeTransportChannel* channel1 = CreateChannel("audio", 1); 109 FakeTransportChannel* channel1 = CreateChannel("audio", 1);
110 ASSERT_NE(nullptr, channel1); 110 ASSERT_NE(nullptr, channel1);
111 FakeTransportChannel* channel2 = CreateChannel("video", 1); 111 FakeTransportChannel* channel2 = CreateChannel("video", 1);
112 ASSERT_NE(nullptr, channel2); 112 ASSERT_NE(nullptr, channel2);
113 113
114 TransportDescription local_desc( 114 TransportDescription local_desc(std::vector<std::string>(), kIceUfrag1,
115 std::vector<std::string>(), kIceUfrag1, kIcePwd1, cricket::ICEMODE_FULL, 115 kIcePwd1, cricket::ICEMODE_FULL,
116 cricket::CONNECTIONROLE_ACTPASS, nullptr, Candidates()); 116 cricket::CONNECTIONROLE_ACTPASS, nullptr);
117 std::string err; 117 std::string err;
118 transport_controller_->SetLocalTransportDescription( 118 transport_controller_->SetLocalTransportDescription(
119 "audio", local_desc, cricket::CA_OFFER, &err); 119 "audio", local_desc, cricket::CA_OFFER, &err);
120 transport_controller_->SetLocalTransportDescription( 120 transport_controller_->SetLocalTransportDescription(
121 "video", local_desc, cricket::CA_OFFER, &err); 121 "video", local_desc, cricket::CA_OFFER, &err);
122 transport_controller_->MaybeStartGathering(); 122 transport_controller_->MaybeStartGathering();
123 channel1->SignalCandidateGathered(channel1, CreateCandidate(1)); 123 channel1->SignalCandidateGathered(channel1, CreateCandidate(1));
124 channel2->SignalCandidateGathered(channel2, CreateCandidate(1)); 124 channel2->SignalCandidateGathered(channel2, CreateCandidate(1));
125 channel1->SetCandidatesGatheringComplete(); 125 channel1->SetCandidatesGatheringComplete();
126 channel2->SetCandidatesGatheringComplete(); 126 channel2->SetCandidatesGatheringComplete();
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 returned_certificate->ToPEMString()); 315 returned_certificate->ToPEMString());
316 316
317 // Should fail if called for a nonexistant transport. 317 // Should fail if called for a nonexistant transport.
318 EXPECT_FALSE(transport_controller_->GetRemoteSSLCertificate( 318 EXPECT_FALSE(transport_controller_->GetRemoteSSLCertificate(
319 "video", returned_certificate.accept())); 319 "video", returned_certificate.accept()));
320 } 320 }
321 321
322 TEST_F(TransportControllerTest, TestSetLocalTransportDescription) { 322 TEST_F(TransportControllerTest, TestSetLocalTransportDescription) {
323 FakeTransportChannel* channel = CreateChannel("audio", 1); 323 FakeTransportChannel* channel = CreateChannel("audio", 1);
324 ASSERT_NE(nullptr, channel); 324 ASSERT_NE(nullptr, channel);
325 TransportDescription local_desc( 325 TransportDescription local_desc(std::vector<std::string>(), kIceUfrag1,
326 std::vector<std::string>(), kIceUfrag1, kIcePwd1, cricket::ICEMODE_FULL, 326 kIcePwd1, cricket::ICEMODE_FULL,
327 cricket::CONNECTIONROLE_ACTPASS, nullptr, Candidates()); 327 cricket::CONNECTIONROLE_ACTPASS, nullptr);
328 std::string err; 328 std::string err;
329 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription( 329 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription(
330 "audio", local_desc, cricket::CA_OFFER, &err)); 330 "audio", local_desc, cricket::CA_OFFER, &err));
331 // Check that ICE ufrag and pwd were propagated to channel. 331 // Check that ICE ufrag and pwd were propagated to channel.
332 EXPECT_EQ(kIceUfrag1, channel->ice_ufrag()); 332 EXPECT_EQ(kIceUfrag1, channel->ice_ufrag());
333 EXPECT_EQ(kIcePwd1, channel->ice_pwd()); 333 EXPECT_EQ(kIcePwd1, channel->ice_pwd());
334 // After setting local description, we should be able to start gathering 334 // After setting local description, we should be able to start gathering
335 // candidates. 335 // candidates.
336 transport_controller_->MaybeStartGathering(); 336 transport_controller_->MaybeStartGathering();
337 EXPECT_EQ_WAIT(cricket::kIceGatheringGathering, gathering_state_, kTimeout); 337 EXPECT_EQ_WAIT(cricket::kIceGatheringGathering, gathering_state_, kTimeout);
338 EXPECT_EQ(1, gathering_state_signal_count_); 338 EXPECT_EQ(1, gathering_state_signal_count_);
339 } 339 }
340 340
341 TEST_F(TransportControllerTest, TestSetRemoteTransportDescription) { 341 TEST_F(TransportControllerTest, TestSetRemoteTransportDescription) {
342 FakeTransportChannel* channel = CreateChannel("audio", 1); 342 FakeTransportChannel* channel = CreateChannel("audio", 1);
343 ASSERT_NE(nullptr, channel); 343 ASSERT_NE(nullptr, channel);
344 TransportDescription remote_desc( 344 TransportDescription remote_desc(std::vector<std::string>(), kIceUfrag1,
345 std::vector<std::string>(), kIceUfrag1, kIcePwd1, cricket::ICEMODE_FULL, 345 kIcePwd1, cricket::ICEMODE_FULL,
346 cricket::CONNECTIONROLE_ACTPASS, nullptr, Candidates()); 346 cricket::CONNECTIONROLE_ACTPASS, nullptr);
347 std::string err; 347 std::string err;
348 EXPECT_TRUE(transport_controller_->SetRemoteTransportDescription( 348 EXPECT_TRUE(transport_controller_->SetRemoteTransportDescription(
349 "audio", remote_desc, cricket::CA_OFFER, &err)); 349 "audio", remote_desc, cricket::CA_OFFER, &err));
350 // Check that ICE ufrag and pwd were propagated to channel. 350 // Check that ICE ufrag and pwd were propagated to channel.
351 EXPECT_EQ(kIceUfrag1, channel->remote_ice_ufrag()); 351 EXPECT_EQ(kIceUfrag1, channel->remote_ice_ufrag());
352 EXPECT_EQ(kIcePwd1, channel->remote_ice_pwd()); 352 EXPECT_EQ(kIcePwd1, channel->remote_ice_pwd());
353 } 353 }
354 354
355 TEST_F(TransportControllerTest, TestAddRemoteCandidates) { 355 TEST_F(TransportControllerTest, TestAddRemoteCandidates) {
356 FakeTransportChannel* channel = CreateChannel("audio", 1); 356 FakeTransportChannel* channel = CreateChannel("audio", 1);
357 ASSERT_NE(nullptr, channel); 357 ASSERT_NE(nullptr, channel);
358 Candidates candidates; 358 Candidates candidates;
359 candidates.push_back(CreateCandidate(1)); 359 candidates.push_back(CreateCandidate(1));
360 std::string err; 360 std::string err;
361 EXPECT_TRUE( 361 EXPECT_TRUE(
362 transport_controller_->AddRemoteCandidates("audio", candidates, &err)); 362 transport_controller_->AddRemoteCandidates("audio", candidates, &err));
363 EXPECT_EQ(1U, channel->remote_candidates().size()); 363 EXPECT_EQ(1U, channel->remote_candidates().size());
364 } 364 }
365 365
366 TEST_F(TransportControllerTest, TestReadyForRemoteCandidates) { 366 TEST_F(TransportControllerTest, TestReadyForRemoteCandidates) {
367 FakeTransportChannel* channel = CreateChannel("audio", 1); 367 FakeTransportChannel* channel = CreateChannel("audio", 1);
368 ASSERT_NE(nullptr, channel); 368 ASSERT_NE(nullptr, channel);
369 // We expect to be ready for remote candidates only after local and remote 369 // We expect to be ready for remote candidates only after local and remote
370 // descriptions are set. 370 // descriptions are set.
371 EXPECT_FALSE(transport_controller_->ReadyForRemoteCandidates("audio")); 371 EXPECT_FALSE(transport_controller_->ReadyForRemoteCandidates("audio"));
372 372
373 std::string err; 373 std::string err;
374 TransportDescription remote_desc( 374 TransportDescription remote_desc(std::vector<std::string>(), kIceUfrag1,
375 std::vector<std::string>(), kIceUfrag1, kIcePwd1, cricket::ICEMODE_FULL, 375 kIcePwd1, cricket::ICEMODE_FULL,
376 cricket::CONNECTIONROLE_ACTPASS, nullptr, Candidates()); 376 cricket::CONNECTIONROLE_ACTPASS, nullptr);
377 EXPECT_TRUE(transport_controller_->SetRemoteTransportDescription( 377 EXPECT_TRUE(transport_controller_->SetRemoteTransportDescription(
378 "audio", remote_desc, cricket::CA_OFFER, &err)); 378 "audio", remote_desc, cricket::CA_OFFER, &err));
379 EXPECT_FALSE(transport_controller_->ReadyForRemoteCandidates("audio")); 379 EXPECT_FALSE(transport_controller_->ReadyForRemoteCandidates("audio"));
380 380
381 TransportDescription local_desc( 381 TransportDescription local_desc(std::vector<std::string>(), kIceUfrag2,
382 std::vector<std::string>(), kIceUfrag2, kIcePwd2, cricket::ICEMODE_FULL, 382 kIcePwd2, cricket::ICEMODE_FULL,
383 cricket::CONNECTIONROLE_ACTPASS, nullptr, Candidates()); 383 cricket::CONNECTIONROLE_ACTPASS, nullptr);
384 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription( 384 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription(
385 "audio", local_desc, cricket::CA_ANSWER, &err)); 385 "audio", local_desc, cricket::CA_ANSWER, &err));
386 EXPECT_TRUE(transport_controller_->ReadyForRemoteCandidates("audio")); 386 EXPECT_TRUE(transport_controller_->ReadyForRemoteCandidates("audio"));
387 } 387 }
388 388
389 TEST_F(TransportControllerTest, TestGetStats) { 389 TEST_F(TransportControllerTest, TestGetStats) {
390 FakeTransportChannel* channel1 = CreateChannel("audio", 1); 390 FakeTransportChannel* channel1 = CreateChannel("audio", 1);
391 ASSERT_NE(nullptr, channel1); 391 ASSERT_NE(nullptr, channel1);
392 FakeTransportChannel* channel2 = CreateChannel("audio", 2); 392 FakeTransportChannel* channel2 = CreateChannel("audio", 2);
393 ASSERT_NE(nullptr, channel2); 393 ASSERT_NE(nullptr, channel2);
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 EXPECT_EQ(1, connection_state_signal_count_); 643 EXPECT_EQ(1, connection_state_signal_count_);
644 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout); 644 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout);
645 EXPECT_EQ(2, gathering_state_signal_count_); 645 EXPECT_EQ(2, gathering_state_signal_count_);
646 } 646 }
647 647
648 TEST_F(TransportControllerTest, TestSignalCandidatesGathered) { 648 TEST_F(TransportControllerTest, TestSignalCandidatesGathered) {
649 FakeTransportChannel* channel = CreateChannel("audio", 1); 649 FakeTransportChannel* channel = CreateChannel("audio", 1);
650 ASSERT_NE(nullptr, channel); 650 ASSERT_NE(nullptr, channel);
651 651
652 // Transport won't signal candidates until it has a local description. 652 // Transport won't signal candidates until it has a local description.
653 TransportDescription local_desc( 653 TransportDescription local_desc(std::vector<std::string>(), kIceUfrag1,
654 std::vector<std::string>(), kIceUfrag1, kIcePwd1, cricket::ICEMODE_FULL, 654 kIcePwd1, cricket::ICEMODE_FULL,
655 cricket::CONNECTIONROLE_ACTPASS, nullptr, Candidates()); 655 cricket::CONNECTIONROLE_ACTPASS, nullptr);
656 std::string err; 656 std::string err;
657 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription( 657 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription(
658 "audio", local_desc, cricket::CA_OFFER, &err)); 658 "audio", local_desc, cricket::CA_OFFER, &err));
659 transport_controller_->MaybeStartGathering(); 659 transport_controller_->MaybeStartGathering();
660 660
661 channel->SignalCandidateGathered(channel, CreateCandidate(1)); 661 channel->SignalCandidateGathered(channel, CreateCandidate(1));
662 EXPECT_EQ_WAIT(1, candidates_signal_count_, kTimeout); 662 EXPECT_EQ_WAIT(1, candidates_signal_count_, kTimeout);
663 EXPECT_EQ(1U, candidates_["audio"].size()); 663 EXPECT_EQ(1U, candidates_["audio"].size());
664 } 664 }
665 665
(...skipping 11 matching lines...) Expand all
677 // new --> gathering --> complete 677 // new --> gathering --> complete
678 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout); 678 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout);
679 EXPECT_EQ(2, gathering_state_signal_count_); 679 EXPECT_EQ(2, gathering_state_signal_count_);
680 680
681 EXPECT_EQ_WAIT(1U, candidates_["audio"].size(), kTimeout); 681 EXPECT_EQ_WAIT(1U, candidates_["audio"].size(), kTimeout);
682 EXPECT_EQ_WAIT(1U, candidates_["video"].size(), kTimeout); 682 EXPECT_EQ_WAIT(1U, candidates_["video"].size(), kTimeout);
683 EXPECT_EQ(2, candidates_signal_count_); 683 EXPECT_EQ(2, candidates_signal_count_);
684 684
685 EXPECT_TRUE(!signaled_on_non_signaling_thread_); 685 EXPECT_TRUE(!signaled_on_non_signaling_thread_);
686 } 686 }
OLDNEW
« no previous file with comments | « webrtc/p2p/base/transport_unittest.cc ('k') | webrtc/p2p/base/transportdescription.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698