OLD | NEW |
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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 channel2->SetReceiving(true); | 580 channel2->SetReceiving(true); |
581 channel1->SetReceiving(false); | 581 channel1->SetReceiving(false); |
582 channel2->SetReceiving(false); | 582 channel2->SetReceiving(false); |
583 EXPECT_TRUE_WAIT(!receiving_, kTimeout); | 583 EXPECT_TRUE_WAIT(!receiving_, kTimeout); |
584 EXPECT_EQ(2, receiving_signal_count_); | 584 EXPECT_EQ(2, receiving_signal_count_); |
585 } | 585 } |
586 | 586 |
587 TEST_F(TransportControllerTest, TestSignalGatheringStateGathering) { | 587 TEST_F(TransportControllerTest, TestSignalGatheringStateGathering) { |
588 FakeTransportChannel* channel = CreateChannel("audio", 1); | 588 FakeTransportChannel* channel = CreateChannel("audio", 1); |
589 ASSERT_NE(nullptr, channel); | 589 ASSERT_NE(nullptr, channel); |
590 channel->Connect(); | |
591 channel->MaybeStartGathering(); | 590 channel->MaybeStartGathering(); |
592 // Should be in the gathering state as soon as any transport starts gathering. | 591 // Should be in the gathering state as soon as any transport starts gathering. |
593 EXPECT_EQ_WAIT(cricket::kIceGatheringGathering, gathering_state_, kTimeout); | 592 EXPECT_EQ_WAIT(cricket::kIceGatheringGathering, gathering_state_, kTimeout); |
594 EXPECT_EQ(1, gathering_state_signal_count_); | 593 EXPECT_EQ(1, gathering_state_signal_count_); |
595 } | 594 } |
596 | 595 |
597 TEST_F(TransportControllerTest, TestSignalGatheringStateComplete) { | 596 TEST_F(TransportControllerTest, TestSignalGatheringStateComplete) { |
598 FakeTransportChannel* channel1 = CreateChannel("audio", 1); | 597 FakeTransportChannel* channel1 = CreateChannel("audio", 1); |
599 ASSERT_NE(nullptr, channel1); | 598 ASSERT_NE(nullptr, channel1); |
600 FakeTransportChannel* channel2 = CreateChannel("video", 1); | 599 FakeTransportChannel* channel2 = CreateChannel("video", 1); |
601 ASSERT_NE(nullptr, channel2); | 600 ASSERT_NE(nullptr, channel2); |
602 FakeTransportChannel* channel3 = CreateChannel("data", 1); | 601 FakeTransportChannel* channel3 = CreateChannel("data", 1); |
603 ASSERT_NE(nullptr, channel3); | 602 ASSERT_NE(nullptr, channel3); |
604 | 603 |
605 channel3->Connect(); | |
606 channel3->MaybeStartGathering(); | 604 channel3->MaybeStartGathering(); |
607 EXPECT_EQ_WAIT(cricket::kIceGatheringGathering, gathering_state_, kTimeout); | 605 EXPECT_EQ_WAIT(cricket::kIceGatheringGathering, gathering_state_, kTimeout); |
608 EXPECT_EQ(1, gathering_state_signal_count_); | 606 EXPECT_EQ(1, gathering_state_signal_count_); |
609 | 607 |
610 // Have one channel finish gathering, then destroy it, to make sure gathering | 608 // Have one channel finish gathering, then destroy it, to make sure gathering |
611 // completion wasn't signalled if only one transport finished gathering. | 609 // completion wasn't signalled if only one transport finished gathering. |
612 channel3->SetCandidatesGatheringComplete(); | 610 channel3->SetCandidatesGatheringComplete(); |
613 DestroyChannel("data", 1); | 611 DestroyChannel("data", 1); |
614 EXPECT_EQ_WAIT(cricket::kIceGatheringNew, gathering_state_, kTimeout); | 612 EXPECT_EQ_WAIT(cricket::kIceGatheringNew, gathering_state_, kTimeout); |
615 EXPECT_EQ(2, gathering_state_signal_count_); | 613 EXPECT_EQ(2, gathering_state_signal_count_); |
616 | 614 |
617 // Make remaining channels start and then finish gathering. | 615 // Make remaining channels start and then finish gathering. |
618 channel1->Connect(); | |
619 channel1->MaybeStartGathering(); | 616 channel1->MaybeStartGathering(); |
620 channel2->Connect(); | |
621 channel2->MaybeStartGathering(); | 617 channel2->MaybeStartGathering(); |
622 EXPECT_EQ_WAIT(cricket::kIceGatheringGathering, gathering_state_, kTimeout); | 618 EXPECT_EQ_WAIT(cricket::kIceGatheringGathering, gathering_state_, kTimeout); |
623 EXPECT_EQ(3, gathering_state_signal_count_); | 619 EXPECT_EQ(3, gathering_state_signal_count_); |
624 | 620 |
625 channel1->SetCandidatesGatheringComplete(); | 621 channel1->SetCandidatesGatheringComplete(); |
626 channel2->SetCandidatesGatheringComplete(); | 622 channel2->SetCandidatesGatheringComplete(); |
627 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout); | 623 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout); |
628 EXPECT_EQ(4, gathering_state_signal_count_); | 624 EXPECT_EQ(4, gathering_state_signal_count_); |
629 } | 625 } |
630 | 626 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 // new --> gathering --> complete | 681 // new --> gathering --> complete |
686 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout); | 682 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout); |
687 EXPECT_EQ(2, gathering_state_signal_count_); | 683 EXPECT_EQ(2, gathering_state_signal_count_); |
688 | 684 |
689 EXPECT_EQ_WAIT(1U, candidates_["audio"].size(), kTimeout); | 685 EXPECT_EQ_WAIT(1U, candidates_["audio"].size(), kTimeout); |
690 EXPECT_EQ_WAIT(1U, candidates_["video"].size(), kTimeout); | 686 EXPECT_EQ_WAIT(1U, candidates_["video"].size(), kTimeout); |
691 EXPECT_EQ(2, candidates_signal_count_); | 687 EXPECT_EQ(2, candidates_signal_count_); |
692 | 688 |
693 EXPECT_TRUE(!signaled_on_non_signaling_thread_); | 689 EXPECT_TRUE(!signaled_on_non_signaling_thread_); |
694 } | 690 } |
OLD | NEW |