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

Side by Side Diff: webrtc/p2p/client/portallocator_unittest.cc

Issue 1263603003: Remove PORTALLOCATOR_ENABLE_SHARED_SOCKET. Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « webrtc/p2p/client/httpportallocator.cc ('k') | webrtc/p2p/p2p.gyp » ('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 2009 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2009 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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 for (size_t i = 0; i < candidates_.size(); ++i) { 637 for (size_t i = 0; i < candidates_.size(); ++i) {
638 EXPECT_EQ(std::string(cricket::RELAY_PORT_TYPE), candidates_[i].type()); 638 EXPECT_EQ(std::string(cricket::RELAY_PORT_TYPE), candidates_[i].type());
639 EXPECT_EQ( 639 EXPECT_EQ(
640 candidates_[0].related_address(), 640 candidates_[0].related_address(),
641 rtc::EmptySocketAddressWithFamily(candidates_[0].address().family())); 641 rtc::EmptySocketAddressWithFamily(candidates_[0].address().family()));
642 } 642 }
643 } 643 }
644 644
645 TEST_F(PortAllocatorTest, TestCandidateFilterWithHostOnly) { 645 TEST_F(PortAllocatorTest, TestCandidateFilterWithHostOnly) {
646 AddInterface(kClientAddr); 646 AddInterface(kClientAddr);
647 allocator().set_flags(cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
648 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET);
649 allocator().set_candidate_filter(cricket::CF_HOST); 647 allocator().set_candidate_filter(cricket::CF_HOST);
650 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 648 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
651 session_->StartGettingPorts(); 649 session_->StartGettingPorts();
652 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout); 650 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
653 EXPECT_EQ(2U, candidates_.size()); // Host UDP/TCP candidates only. 651 EXPECT_EQ(2U, candidates_.size()); // Host UDP/TCP candidates only.
654 EXPECT_EQ(2U, ports_.size()); // UDP/TCP ports only. 652 EXPECT_EQ(2U, ports_.size()); // UDP/TCP ports only.
655 for (size_t i = 0; i < candidates_.size(); ++i) { 653 for (size_t i = 0; i < candidates_.size(); ++i) {
656 EXPECT_EQ(std::string(cricket::LOCAL_PORT_TYPE), candidates_[i].type()); 654 EXPECT_EQ(std::string(cricket::LOCAL_PORT_TYPE), candidates_[i].type());
657 } 655 }
658 } 656 }
659 657
660 // Host is behind the NAT. 658 // Host is behind the NAT.
661 TEST_F(PortAllocatorTest, TestCandidateFilterWithReflexiveOnly) { 659 TEST_F(PortAllocatorTest, TestCandidateFilterWithReflexiveOnly) {
662 AddInterface(kPrivateAddr); 660 AddInterface(kPrivateAddr);
663 ResetWithNatServer(kStunAddr); 661 ResetWithNatServer(kStunAddr);
664 662
665 allocator().set_flags(cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
666 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET);
667 allocator().set_candidate_filter(cricket::CF_REFLEXIVE); 663 allocator().set_candidate_filter(cricket::CF_REFLEXIVE);
668 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 664 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
669 session_->StartGettingPorts(); 665 session_->StartGettingPorts();
670 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout); 666 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
671 // Host is behind NAT, no private address will be exposed. Hence only UDP 667 // Host is behind NAT, no private address will be exposed. Hence only UDP
672 // port with STUN candidate will be sent outside. 668 // port with STUN candidate will be sent outside.
673 EXPECT_EQ(1U, candidates_.size()); // Only STUN candidate. 669 EXPECT_EQ(1U, candidates_.size()); // Only STUN candidate.
674 EXPECT_EQ(1U, ports_.size()); // Only UDP port will be in ready state. 670 EXPECT_EQ(1U, ports_.size()); // Only UDP port will be in ready state.
675 for (size_t i = 0; i < candidates_.size(); ++i) { 671 for (size_t i = 0; i < candidates_.size(); ++i) {
676 EXPECT_EQ(std::string(cricket::STUN_PORT_TYPE), candidates_[i].type()); 672 EXPECT_EQ(std::string(cricket::STUN_PORT_TYPE), candidates_[i].type());
677 EXPECT_EQ( 673 EXPECT_EQ(
678 candidates_[0].related_address(), 674 candidates_[0].related_address(),
679 rtc::EmptySocketAddressWithFamily(candidates_[0].address().family())); 675 rtc::EmptySocketAddressWithFamily(candidates_[0].address().family()));
680 } 676 }
681 } 677 }
682 678
683 // Host is not behind the NAT. 679 // Host is not behind the NAT.
684 TEST_F(PortAllocatorTest, TestCandidateFilterWithReflexiveOnlyAndNoNAT) { 680 TEST_F(PortAllocatorTest, TestCandidateFilterWithReflexiveOnlyAndNoNAT) {
685 AddInterface(kClientAddr); 681 AddInterface(kClientAddr);
686 allocator().set_flags(cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
687 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET);
688 allocator().set_candidate_filter(cricket::CF_REFLEXIVE); 682 allocator().set_candidate_filter(cricket::CF_REFLEXIVE);
689 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 683 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
690 session_->StartGettingPorts(); 684 session_->StartGettingPorts();
691 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout); 685 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
692 // Host has a public address, both UDP and TCP candidates will be exposed. 686 // Host has a public address, both UDP and TCP candidates will be exposed.
693 EXPECT_EQ(2U, candidates_.size()); // Local UDP + TCP candidate. 687 EXPECT_EQ(2U, candidates_.size()); // Local UDP + TCP candidate.
694 EXPECT_EQ(2U, ports_.size()); // UDP and TCP ports will be in ready state. 688 EXPECT_EQ(2U, ports_.size()); // UDP and TCP ports will be in ready state.
695 for (size_t i = 0; i < candidates_.size(); ++i) { 689 for (size_t i = 0; i < candidates_.size(); ++i) {
696 EXPECT_EQ(std::string(cricket::LOCAL_PORT_TYPE), candidates_[i].type()); 690 EXPECT_EQ(std::string(cricket::LOCAL_PORT_TYPE), candidates_[i].type());
697 } 691 }
698 } 692 }
699 693
700 // Test that when the PORTALLOCATOR_ENABLE_SHARED_UFRAG is enabled we got same 694 // Test that we get the same ufrag and pwd for all candidates.
701 // ufrag and pwd for the collected candidates.
702 TEST_F(PortAllocatorTest, TestEnableSharedUfrag) { 695 TEST_F(PortAllocatorTest, TestEnableSharedUfrag) {
703 allocator().set_flags(allocator().flags() |
704 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG);
705 AddInterface(kClientAddr); 696 AddInterface(kClientAddr);
706 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 697 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
707 session_->StartGettingPorts(); 698 session_->StartGettingPorts();
708 ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout); 699 ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout);
709 EXPECT_PRED5(CheckCandidate, candidates_[0], 700 EXPECT_PRED5(CheckCandidate, candidates_[0],
710 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr); 701 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr);
711 EXPECT_PRED5(CheckCandidate, candidates_[1], 702 EXPECT_PRED5(CheckCandidate, candidates_[1],
712 cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp", kClientAddr); 703 cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp", kClientAddr);
713 EXPECT_PRED5(CheckCandidate, candidates_[5], 704 EXPECT_PRED5(CheckCandidate, candidates_[5],
714 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "tcp", kClientAddr); 705 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "tcp", kClientAddr);
715 EXPECT_EQ(4U, ports_.size()); 706 EXPECT_EQ(4U, ports_.size());
716 EXPECT_EQ(kIceUfrag0, candidates_[0].username()); 707 EXPECT_EQ(kIceUfrag0, candidates_[0].username());
717 EXPECT_EQ(kIceUfrag0, candidates_[1].username()); 708 EXPECT_EQ(kIceUfrag0, candidates_[1].username());
718 EXPECT_EQ(kIceUfrag0, candidates_[2].username()); 709 EXPECT_EQ(kIceUfrag0, candidates_[2].username());
719 EXPECT_EQ(kIcePwd0, candidates_[0].password()); 710 EXPECT_EQ(kIcePwd0, candidates_[0].password());
720 EXPECT_EQ(kIcePwd0, candidates_[1].password()); 711 EXPECT_EQ(kIcePwd0, candidates_[1].password());
721 EXPECT_TRUE(candidate_allocation_done_); 712 EXPECT_TRUE(candidate_allocation_done_);
722 } 713 }
723 714
724 // Test that when the PORTALLOCATOR_ENABLE_SHARED_UFRAG isn't enabled we got 715 // Test that only one port is allocated for udp and stun. Also verify
725 // different ufrag and pwd for the collected candidates. 716 // there is only one candidate (local) if stun candidate is same as
726 TEST_F(PortAllocatorTest, TestDisableSharedUfrag) { 717 // local candidate, which will be the case in a public network like
727 allocator().set_flags(allocator().flags() & 718 // the below test.
728 ~cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG); 719 TEST_F(PortAllocatorTest, TestSharedSocketWithoutNat) {
729 AddInterface(kClientAddr); 720 AddInterface(kClientAddr);
730 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 721 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
731 session_->StartGettingPorts(); 722 session_->StartGettingPorts();
732 ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout);
733 EXPECT_PRED5(CheckCandidate, candidates_[0],
734 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr);
735 EXPECT_PRED5(CheckCandidate, candidates_[1],
736 cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp", kClientAddr);
737 EXPECT_EQ(4U, ports_.size());
738 // Port should generate random ufrag and pwd.
739 EXPECT_NE(kIceUfrag0, candidates_[0].username());
740 EXPECT_NE(kIceUfrag0, candidates_[1].username());
741 EXPECT_NE(candidates_[0].username(), candidates_[1].username());
742 EXPECT_NE(kIcePwd0, candidates_[0].password());
743 EXPECT_NE(kIcePwd0, candidates_[1].password());
744 EXPECT_NE(candidates_[0].password(), candidates_[1].password());
745 EXPECT_TRUE(candidate_allocation_done_);
746 }
747
748 // Test that when PORTALLOCATOR_ENABLE_SHARED_SOCKET is enabled only one port
749 // is allocated for udp and stun. Also verify there is only one candidate
750 // (local) if stun candidate is same as local candidate, which will be the case
751 // in a public network like the below test.
752 TEST_F(PortAllocatorTest, TestSharedSocketWithoutNat) {
753 AddInterface(kClientAddr);
754 allocator_->set_flags(allocator().flags() |
755 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
756 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET);
757 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
758 session_->StartGettingPorts();
759 ASSERT_EQ_WAIT(6U, candidates_.size(), kDefaultAllocationTimeout); 723 ASSERT_EQ_WAIT(6U, candidates_.size(), kDefaultAllocationTimeout);
760 EXPECT_EQ(3U, ports_.size()); 724 EXPECT_EQ(3U, ports_.size());
761 EXPECT_PRED5(CheckCandidate, candidates_[0], 725 EXPECT_PRED5(CheckCandidate, candidates_[0],
762 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr); 726 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr);
763 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout); 727 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
764 } 728 }
765 729
766 // Test that when PORTALLOCATOR_ENABLE_SHARED_SOCKET is enabled only one port 730 // Test that only one port is allocated for udp and stun. In this test
767 // is allocated for udp and stun. In this test we should expect both stun and 731 // we should expect both stun and local candidates as client behind a
768 // local candidates as client behind a nat. 732 // nat.
769 TEST_F(PortAllocatorTest, TestSharedSocketWithNat) { 733 TEST_F(PortAllocatorTest, TestSharedSocketWithNat) {
770 AddInterface(kClientAddr); 734 AddInterface(kClientAddr);
771 ResetWithNatServer(kStunAddr); 735 ResetWithNatServer(kStunAddr);
772 736
773 allocator_->set_flags(allocator().flags() |
774 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
775 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET);
776 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 737 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
777 session_->StartGettingPorts(); 738 session_->StartGettingPorts();
778 ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout); 739 ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout);
779 ASSERT_EQ(2U, ports_.size()); 740 ASSERT_EQ(2U, ports_.size());
780 EXPECT_PRED5(CheckCandidate, candidates_[0], 741 EXPECT_PRED5(CheckCandidate, candidates_[0],
781 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr); 742 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr);
782 EXPECT_PRED5(CheckCandidate, candidates_[1], 743 EXPECT_PRED5(CheckCandidate, candidates_[1],
783 cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp", 744 cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp",
784 rtc::SocketAddress(kNatUdpAddr.ipaddr(), 0)); 745 rtc::SocketAddress(kNatUdpAddr.ipaddr(), 0));
785 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout); 746 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
786 EXPECT_EQ(3U, candidates_.size()); 747 EXPECT_EQ(3U, candidates_.size());
787 } 748 }
788 749
789 // Test TURN port in shared socket mode with UDP and TCP TURN server addresses. 750 // Test TURN port with UDP and TCP TURN server addresses.
790 TEST_F(PortAllocatorTest, TestSharedSocketWithoutNatUsingTurn) { 751 TEST_F(PortAllocatorTest, TestSharedSocketWithoutNatUsingTurn) {
791 turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP); 752 turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP);
792 AddInterface(kClientAddr); 753 AddInterface(kClientAddr);
793 allocator_.reset(new cricket::BasicPortAllocator(&network_manager_)); 754 allocator_.reset(new cricket::BasicPortAllocator(&network_manager_));
794 755
795 AddTurnServers(kTurnUdpIntAddr, kTurnTcpIntAddr); 756 AddTurnServers(kTurnUdpIntAddr, kTurnTcpIntAddr);
796 757
797 allocator_->set_step_delay(cricket::kMinimumStepDelay); 758 allocator_->set_step_delay(cricket::kMinimumStepDelay);
798 allocator_->set_flags(allocator().flags() | 759 allocator_->set_flags(allocator().flags() |
799 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
800 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET |
801 cricket::PORTALLOCATOR_DISABLE_TCP); 760 cricket::PORTALLOCATOR_DISABLE_TCP);
802 761
803 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 762 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
804 session_->StartGettingPorts(); 763 session_->StartGettingPorts();
805 764
806 ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout); 765 ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout);
807 ASSERT_EQ(3U, ports_.size()); 766 ASSERT_EQ(3U, ports_.size());
808 EXPECT_PRED5(CheckCandidate, candidates_[0], 767 EXPECT_PRED5(CheckCandidate, candidates_[0],
809 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr); 768 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr);
810 EXPECT_PRED5(CheckCandidate, candidates_[1], 769 EXPECT_PRED5(CheckCandidate, candidates_[1],
(...skipping 16 matching lines...) Expand all
827 cricket::RelayServerConfig relay_server(cricket::RELAY_TURN); 786 cricket::RelayServerConfig relay_server(cricket::RELAY_TURN);
828 cricket::RelayCredentials credentials(kTurnUsername, kTurnPassword); 787 cricket::RelayCredentials credentials(kTurnUsername, kTurnPassword);
829 relay_server.credentials = credentials; 788 relay_server.credentials = credentials;
830 relay_server.ports.push_back(cricket::ProtocolAddress( 789 relay_server.ports.push_back(cricket::ProtocolAddress(
831 rtc::SocketAddress("localhost", 3478), 790 rtc::SocketAddress("localhost", 3478),
832 cricket::PROTO_UDP, false)); 791 cricket::PROTO_UDP, false));
833 allocator_->AddRelay(relay_server); 792 allocator_->AddRelay(relay_server);
834 793
835 allocator_->set_step_delay(cricket::kMinimumStepDelay); 794 allocator_->set_step_delay(cricket::kMinimumStepDelay);
836 allocator_->set_flags(allocator().flags() | 795 allocator_->set_flags(allocator().flags() |
837 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
838 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET |
839 cricket::PORTALLOCATOR_DISABLE_TCP); 796 cricket::PORTALLOCATOR_DISABLE_TCP);
840 797
841 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 798 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
842 session_->StartGettingPorts(); 799 session_->StartGettingPorts();
843 800
844 EXPECT_EQ_WAIT(2U, ports_.size(), kDefaultAllocationTimeout); 801 EXPECT_EQ_WAIT(2U, ports_.size(), kDefaultAllocationTimeout);
845 } 802 }
846 803
847 // Test that when PORTALLOCATOR_ENABLE_SHARED_SOCKET is enabled only one port 804 // Test that only one port is allocated for udp/stun/turn. In this
848 // is allocated for udp/stun/turn. In this test we should expect all local, 805 // test we should expect all local, stun and turn candidates.
849 // stun and turn candidates.
850 TEST_F(PortAllocatorTest, TestSharedSocketWithNatUsingTurn) { 806 TEST_F(PortAllocatorTest, TestSharedSocketWithNatUsingTurn) {
851 AddInterface(kClientAddr); 807 AddInterface(kClientAddr);
852 ResetWithNatServer(kStunAddr); 808 ResetWithNatServer(kStunAddr);
853 809
854 AddTurnServers(kTurnUdpIntAddr, rtc::SocketAddress()); 810 AddTurnServers(kTurnUdpIntAddr, rtc::SocketAddress());
855 811
856 allocator_->set_flags(allocator().flags() | 812 allocator_->set_flags(allocator().flags() |
857 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
858 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET |
859 cricket::PORTALLOCATOR_DISABLE_TCP); 813 cricket::PORTALLOCATOR_DISABLE_TCP);
860 814
861 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 815 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
862 session_->StartGettingPorts(); 816 session_->StartGettingPorts();
863 817
864 ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout); 818 ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout);
865 ASSERT_EQ(2U, ports_.size()); 819 ASSERT_EQ(2U, ports_.size());
866 EXPECT_PRED5(CheckCandidate, candidates_[0], 820 EXPECT_PRED5(CheckCandidate, candidates_[0],
867 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr); 821 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr);
868 EXPECT_PRED5(CheckCandidate, candidates_[1], 822 EXPECT_PRED5(CheckCandidate, candidates_[1],
869 cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp", 823 cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp",
870 rtc::SocketAddress(kNatUdpAddr.ipaddr(), 0)); 824 rtc::SocketAddress(kNatUdpAddr.ipaddr(), 0));
871 EXPECT_PRED5(CheckCandidate, candidates_[2], 825 EXPECT_PRED5(CheckCandidate, candidates_[2],
872 cricket::ICE_CANDIDATE_COMPONENT_RTP, "relay", "udp", 826 cricket::ICE_CANDIDATE_COMPONENT_RTP, "relay", "udp",
873 rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0)); 827 rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
874 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout); 828 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
875 EXPECT_EQ(3U, candidates_.size()); 829 EXPECT_EQ(3U, candidates_.size());
876 // Local port will be created first and then TURN port. 830 // Local port will be created first and then TURN port.
877 EXPECT_EQ(2U, ports_[0]->Candidates().size()); 831 EXPECT_EQ(2U, ports_[0]->Candidates().size());
878 EXPECT_EQ(1U, ports_[1]->Candidates().size()); 832 EXPECT_EQ(1U, ports_[1]->Candidates().size());
879 } 833 }
880 834
881 // Test that when PORTALLOCATOR_ENABLE_SHARED_SOCKET is enabled and the TURN 835 // Test that the TURN server is also used as the STUN server. We
882 // server is also used as the STUN server, we should get 'local', 'stun', and 836 // should get 'local', 'stun', and 'relay' candidates.
883 // 'relay' candidates.
884 TEST_F(PortAllocatorTest, TestSharedSocketWithNatUsingTurnAsStun) { 837 TEST_F(PortAllocatorTest, TestSharedSocketWithNatUsingTurnAsStun) {
885 AddInterface(kClientAddr); 838 AddInterface(kClientAddr);
886 // Use an empty SocketAddress to add a NAT without STUN server. 839 // Use an empty SocketAddress to add a NAT without STUN server.
887 ResetWithNatServer(SocketAddress()); 840 ResetWithNatServer(SocketAddress());
888 AddTurnServers(kTurnUdpIntAddr, rtc::SocketAddress()); 841 AddTurnServers(kTurnUdpIntAddr, rtc::SocketAddress());
889 842
890 // Must set the step delay to 0 to make sure the relay allocation phase is 843 // Must set the step delay to 0 to make sure the relay allocation phase is
891 // started before the STUN candidates are obtained, so that the STUN binding 844 // started before the STUN candidates are obtained, so that the STUN binding
892 // response is processed when both StunPort and TurnPort exist to reproduce 845 // response is processed when both StunPort and TurnPort exist to reproduce
893 // webrtc issue 3537. 846 // webrtc issue 3537.
894 allocator_->set_step_delay(0); 847 allocator_->set_step_delay(0);
895 allocator_->set_flags(allocator().flags() | 848 allocator_->set_flags(allocator().flags() |
896 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
897 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET |
898 cricket::PORTALLOCATOR_DISABLE_TCP); 849 cricket::PORTALLOCATOR_DISABLE_TCP);
899 850
900 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 851 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
901 session_->StartGettingPorts(); 852 session_->StartGettingPorts();
902 853
903 ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout); 854 ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout);
904 EXPECT_PRED5(CheckCandidate, candidates_[0], 855 EXPECT_PRED5(CheckCandidate, candidates_[0],
905 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr); 856 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr);
906 EXPECT_PRED5(CheckCandidate, candidates_[1], 857 EXPECT_PRED5(CheckCandidate, candidates_[1],
907 cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp", 858 cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp",
(...skipping 13 matching lines...) Expand all
921 // Test that when only a TCP TURN server is available, we do NOT use it as 872 // Test that when only a TCP TURN server is available, we do NOT use it as
922 // a UDP STUN server, as this could leak our IP address. Thus we should only 873 // a UDP STUN server, as this could leak our IP address. Thus we should only
923 // expect two ports, a UDPPort and TurnPort. 874 // expect two ports, a UDPPort and TurnPort.
924 TEST_F(PortAllocatorTest, TestSharedSocketWithNatUsingTurnTcpOnly) { 875 TEST_F(PortAllocatorTest, TestSharedSocketWithNatUsingTurnTcpOnly) {
925 turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP); 876 turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP);
926 AddInterface(kClientAddr); 877 AddInterface(kClientAddr);
927 ResetWithNatServer(rtc::SocketAddress()); 878 ResetWithNatServer(rtc::SocketAddress());
928 AddTurnServers(rtc::SocketAddress(), kTurnTcpIntAddr); 879 AddTurnServers(rtc::SocketAddress(), kTurnTcpIntAddr);
929 880
930 allocator_->set_flags(allocator().flags() | 881 allocator_->set_flags(allocator().flags() |
931 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
932 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET |
933 cricket::PORTALLOCATOR_DISABLE_TCP); 882 cricket::PORTALLOCATOR_DISABLE_TCP);
934 883
935 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 884 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
936 session_->StartGettingPorts(); 885 session_->StartGettingPorts();
937 886
938 ASSERT_EQ_WAIT(2U, candidates_.size(), kDefaultAllocationTimeout); 887 ASSERT_EQ_WAIT(2U, candidates_.size(), kDefaultAllocationTimeout);
939 ASSERT_EQ(2U, ports_.size()); 888 ASSERT_EQ(2U, ports_.size());
940 EXPECT_PRED5(CheckCandidate, candidates_[0], 889 EXPECT_PRED5(CheckCandidate, candidates_[0],
941 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", 890 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp",
942 kClientAddr); 891 kClientAddr);
943 EXPECT_PRED5(CheckCandidate, candidates_[1], 892 EXPECT_PRED5(CheckCandidate, candidates_[1],
944 cricket::ICE_CANDIDATE_COMPONENT_RTP, "relay", "udp", 893 cricket::ICE_CANDIDATE_COMPONENT_RTP, "relay", "udp",
945 rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0)); 894 rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
946 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout); 895 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
947 EXPECT_EQ(2U, candidates_.size()); 896 EXPECT_EQ(2U, candidates_.size());
948 EXPECT_EQ(1U, ports_[0]->Candidates().size()); 897 EXPECT_EQ(1U, ports_[0]->Candidates().size());
949 EXPECT_EQ(1U, ports_[1]->Candidates().size()); 898 EXPECT_EQ(1U, ports_[1]->Candidates().size());
950 } 899 }
951 900
952 // Test that even when PORTALLOCATOR_ENABLE_SHARED_SOCKET is NOT enabled, the
953 // TURN server is used as the STUN server and we get 'local', 'stun', and
954 // 'relay' candidates.
955 // TODO(deadbeef): Remove this test when support for non-shared socket mode
956 // is removed.
957 TEST_F(PortAllocatorTest, TestNonSharedSocketWithNatUsingTurnAsStun) {
958 AddInterface(kClientAddr);
959 // Use an empty SocketAddress to add a NAT without STUN server.
960 ResetWithNatServer(SocketAddress());
961 AddTurnServers(kTurnUdpIntAddr, rtc::SocketAddress());
962
963 allocator_->set_flags(allocator().flags() |
964 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
965 cricket::PORTALLOCATOR_DISABLE_TCP);
966
967 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
968 session_->StartGettingPorts();
969
970 ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout);
971 ASSERT_EQ(3U, ports_.size());
972 EXPECT_PRED5(CheckCandidate, candidates_[0],
973 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp",
974 kClientAddr);
975 EXPECT_PRED5(CheckCandidate, candidates_[1],
976 cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp",
977 rtc::SocketAddress(kNatUdpAddr.ipaddr(), 0));
978 EXPECT_PRED5(CheckCandidate, candidates_[2],
979 cricket::ICE_CANDIDATE_COMPONENT_RTP, "relay", "udp",
980 rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
981 // Not using shared socket, so the STUN request's server reflexive address
982 // should be different than the TURN request's server reflexive address.
983 EXPECT_NE(candidates_[2].related_address(), candidates_[1].address());
984
985 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
986 EXPECT_EQ(3U, candidates_.size());
987 EXPECT_EQ(1U, ports_[0]->Candidates().size());
988 EXPECT_EQ(1U, ports_[1]->Candidates().size());
989 EXPECT_EQ(1U, ports_[2]->Candidates().size());
990 }
991
992 // Test that even when both a STUN and TURN server are configured, the TURN 901 // Test that even when both a STUN and TURN server are configured, the TURN
993 // server is used as a STUN server and we get a 'stun' candidate. 902 // server is used as a STUN server and we get a 'stun' candidate.
994 TEST_F(PortAllocatorTest, TestSharedSocketWithNatUsingTurnAndStun) { 903 TEST_F(PortAllocatorTest, TestSharedSocketWithNatUsingTurnAndStun) {
995 AddInterface(kClientAddr); 904 AddInterface(kClientAddr);
996 // Configure with STUN server but destroy it, so we can ensure that it's 905 // Configure with STUN server but destroy it, so we can ensure that it's
997 // the TURN server actually being used as a STUN server. 906 // the TURN server actually being used as a STUN server.
998 ResetWithNatServer(kStunAddr); 907 ResetWithNatServer(kStunAddr);
999 stun_server_.reset(); 908 stun_server_.reset();
1000 AddTurnServers(kTurnUdpIntAddr, rtc::SocketAddress()); 909 AddTurnServers(kTurnUdpIntAddr, rtc::SocketAddress());
1001 910
1002 allocator_->set_flags(allocator().flags() | 911 allocator_->set_flags(allocator().flags() |
1003 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
1004 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET |
1005 cricket::PORTALLOCATOR_DISABLE_TCP); 912 cricket::PORTALLOCATOR_DISABLE_TCP);
1006 913
1007 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 914 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
1008 session_->StartGettingPorts(); 915 session_->StartGettingPorts();
1009 916
1010 ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout); 917 ASSERT_EQ_WAIT(3U, candidates_.size(), kDefaultAllocationTimeout);
1011 EXPECT_PRED5(CheckCandidate, candidates_[0], 918 EXPECT_PRED5(CheckCandidate, candidates_[0],
1012 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", 919 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp",
1013 kClientAddr); 920 kClientAddr);
1014 EXPECT_PRED5(CheckCandidate, candidates_[1], 921 EXPECT_PRED5(CheckCandidate, candidates_[1],
1015 cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp", 922 cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp",
1016 rtc::SocketAddress(kNatUdpAddr.ipaddr(), 0)); 923 rtc::SocketAddress(kNatUdpAddr.ipaddr(), 0));
1017 EXPECT_PRED5(CheckCandidate, candidates_[2], 924 EXPECT_PRED5(CheckCandidate, candidates_[2],
1018 cricket::ICE_CANDIDATE_COMPONENT_RTP, "relay", "udp", 925 cricket::ICE_CANDIDATE_COMPONENT_RTP, "relay", "udp",
1019 rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0)); 926 rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
1020 EXPECT_EQ(candidates_[2].related_address(), candidates_[1].address()); 927 EXPECT_EQ(candidates_[2].related_address(), candidates_[1].address());
1021 928
1022 // Don't bother waiting for STUN timeout, since we already verified 929 // Don't bother waiting for STUN timeout, since we already verified
1023 // that we got a STUN candidate from the TURN server. 930 // that we got a STUN candidate from the TURN server.
1024 } 931 }
1025 932
1026 // This test verifies when PORTALLOCATOR_ENABLE_SHARED_SOCKET flag is enabled 933 // This test verifies that when we fail to generate a STUN candidate,
1027 // and fail to generate STUN candidate, local UDP candidate is generated 934 // we properly generate a local UDP candidate.
1028 // properly.
1029 TEST_F(PortAllocatorTest, TestSharedSocketNoUdpAllowed) { 935 TEST_F(PortAllocatorTest, TestSharedSocketNoUdpAllowed) {
1030 allocator().set_flags(allocator().flags() | 936 allocator().set_flags(allocator().flags() |
1031 cricket::PORTALLOCATOR_DISABLE_RELAY | 937 cricket::PORTALLOCATOR_DISABLE_RELAY |
1032 cricket::PORTALLOCATOR_DISABLE_TCP | 938 cricket::PORTALLOCATOR_DISABLE_TCP);
1033 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
1034 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET);
1035 fss_->AddRule(false, rtc::FP_UDP, rtc::FD_ANY, kClientAddr); 939 fss_->AddRule(false, rtc::FP_UDP, rtc::FD_ANY, kClientAddr);
1036 AddInterface(kClientAddr); 940 AddInterface(kClientAddr);
1037 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 941 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
1038 session_->StartGettingPorts(); 942 session_->StartGettingPorts();
1039 ASSERT_EQ_WAIT(1U, ports_.size(), kDefaultAllocationTimeout); 943 ASSERT_EQ_WAIT(1U, ports_.size(), kDefaultAllocationTimeout);
1040 EXPECT_EQ(1U, candidates_.size()); 944 EXPECT_EQ(1U, candidates_.size());
1041 EXPECT_PRED5(CheckCandidate, candidates_[0], 945 EXPECT_PRED5(CheckCandidate, candidates_[0],
1042 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr); 946 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr);
1043 // STUN timeout is 9sec. We need to wait to get candidate done signal. 947 // STUN timeout is 9sec. We need to wait to get candidate done signal.
1044 EXPECT_TRUE_WAIT(candidate_allocation_done_, 10000); 948 EXPECT_TRUE_WAIT(candidate_allocation_done_, 10000);
1045 EXPECT_EQ(1U, candidates_.size()); 949 EXPECT_EQ(1U, candidates_.size());
1046 } 950 }
1047 951
1048 // This test verifies allocator can use IPv6 addresses along with IPv4. 952 // This test verifies allocator can use IPv6 addresses along with IPv4.
1049 TEST_F(PortAllocatorTest, TestEnableIPv6Addresses) { 953 TEST_F(PortAllocatorTest, TestEnableIPv6Addresses) {
1050 allocator().set_flags(allocator().flags() | 954 allocator().set_flags(allocator().flags() |
1051 cricket::PORTALLOCATOR_DISABLE_RELAY | 955 cricket::PORTALLOCATOR_DISABLE_RELAY |
1052 cricket::PORTALLOCATOR_ENABLE_IPV6 | 956 cricket::PORTALLOCATOR_ENABLE_IPV6);
1053 cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
1054 cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET);
1055 AddInterface(kClientIPv6Addr); 957 AddInterface(kClientIPv6Addr);
1056 AddInterface(kClientAddr); 958 AddInterface(kClientAddr);
1057 allocator_->set_step_delay(cricket::kMinimumStepDelay); 959 allocator_->set_step_delay(cricket::kMinimumStepDelay);
1058 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 960 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
1059 session_->StartGettingPorts(); 961 session_->StartGettingPorts();
1060 ASSERT_EQ_WAIT(4U, ports_.size(), kDefaultAllocationTimeout); 962 ASSERT_EQ_WAIT(4U, ports_.size(), kDefaultAllocationTimeout);
1061 EXPECT_EQ(4U, candidates_.size()); 963 EXPECT_EQ(4U, candidates_.size());
1062 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout); 964 EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
1063 EXPECT_PRED5(CheckCandidate, candidates_[0], 965 EXPECT_PRED5(CheckCandidate, candidates_[0],
1064 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", 966 cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp",
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 alloc.SetStunHosts(stun_servers); 1004 alloc.SetStunHosts(stun_servers);
1103 EXPECT_EQ(2U, alloc.relay_hosts().size()); 1005 EXPECT_EQ(2U, alloc.relay_hosts().size());
1104 EXPECT_EQ(2U, alloc.stun_hosts().size()); 1006 EXPECT_EQ(2U, alloc.stun_hosts().size());
1105 } 1007 }
1106 1008
1107 // Test that the HttpPortAllocator uses correct URL to create sessions. 1009 // Test that the HttpPortAllocator uses correct URL to create sessions.
1108 TEST(HttpPortAllocatorTest, TestSessionRequestUrl) { 1010 TEST(HttpPortAllocatorTest, TestSessionRequestUrl) {
1109 rtc::FakeNetworkManager network_manager; 1011 rtc::FakeNetworkManager network_manager;
1110 cricket::HttpPortAllocator alloc(&network_manager, "unit test agent"); 1012 cricket::HttpPortAllocator alloc(&network_manager, "unit test agent");
1111 1013
1112 // Disable PORTALLOCATOR_ENABLE_SHARED_UFRAG.
1113 alloc.set_flags(alloc.flags() & ~cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG);
1114 rtc::scoped_ptr<cricket::HttpPortAllocatorSessionBase> session( 1014 rtc::scoped_ptr<cricket::HttpPortAllocatorSessionBase> session(
1115 static_cast<cricket::HttpPortAllocatorSession*>( 1015 static_cast<cricket::HttpPortAllocatorSession*>(
1116 alloc.CreateSessionInternal( 1016 alloc.CreateSessionInternal(
1117 "test content", 0, kIceUfrag0, kIcePwd0))); 1017 "test content", 0, kIceUfrag0, kIcePwd0)));
1118 std::string url = session->GetSessionRequestUrl(); 1018 std::string url = session->GetSessionRequestUrl();
1119 LOG(LS_INFO) << "url: " << url; 1019 LOG(LS_INFO) << "url: " << url;
1120 EXPECT_EQ(std::string(cricket::HttpPortAllocator::kCreateSessionURL), url);
1121
1122 // Enable PORTALLOCATOR_ENABLE_SHARED_UFRAG.
1123 alloc.set_flags(alloc.flags() | cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG);
1124 session.reset(static_cast<cricket::HttpPortAllocatorSession*>(
1125 alloc.CreateSessionInternal("test content", 0, kIceUfrag0, kIcePwd0)));
1126 url = session->GetSessionRequestUrl();
1127 LOG(LS_INFO) << "url: " << url;
1128 std::vector<std::string> parts; 1020 std::vector<std::string> parts;
1129 rtc::split(url, '?', &parts); 1021 rtc::split(url, '?', &parts);
1130 ASSERT_EQ(2U, parts.size()); 1022 ASSERT_EQ(2U, parts.size());
1131 1023
1132 std::vector<std::string> args_parts; 1024 std::vector<std::string> args_parts;
1133 rtc::split(parts[1], '&', &args_parts); 1025 rtc::split(parts[1], '&', &args_parts);
1134 1026
1135 std::map<std::string, std::string> args; 1027 std::map<std::string, std::string> args;
1136 for (std::vector<std::string>::iterator it = args_parts.begin(); 1028 for (std::vector<std::string>::iterator it = args_parts.begin();
1137 it != args_parts.end(); ++it) { 1029 it != args_parts.end(); ++it) {
(...skipping 14 matching lines...) Expand all
1152 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP)); 1044 EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
1153 session_->StartGettingPorts(); 1045 session_->StartGettingPorts();
1154 ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout); 1046 ASSERT_EQ_WAIT(7U, candidates_.size(), kDefaultAllocationTimeout);
1155 EXPECT_EQ(4U, ports_.size()); 1047 EXPECT_EQ(4U, ports_.size());
1156 1048
1157 auto it = ports_.begin(); 1049 auto it = ports_.begin();
1158 for (; it != ports_.end(); ++it) { 1050 for (; it != ports_.end(); ++it) {
1159 (reinterpret_cast<cricket::Port*>(*it))->Destroy(); 1051 (reinterpret_cast<cricket::Port*>(*it))->Destroy();
1160 } 1052 }
1161 } 1053 }
OLDNEW
« no previous file with comments | « webrtc/p2p/client/httpportallocator.cc ('k') | webrtc/p2p/p2p.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698