OLD | NEW |
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 return os; | 106 return os; |
107 } | 107 } |
108 | 108 |
109 class BasicPortAllocatorTestBase : public testing::Test, | 109 class BasicPortAllocatorTestBase : public testing::Test, |
110 public sigslot::has_slots<> { | 110 public sigslot::has_slots<> { |
111 public: | 111 public: |
112 BasicPortAllocatorTestBase() | 112 BasicPortAllocatorTestBase() |
113 : pss_(new rtc::PhysicalSocketServer), | 113 : pss_(new rtc::PhysicalSocketServer), |
114 vss_(new rtc::VirtualSocketServer(pss_.get())), | 114 vss_(new rtc::VirtualSocketServer(pss_.get())), |
115 fss_(new rtc::FirewallSocketServer(vss_.get())), | 115 fss_(new rtc::FirewallSocketServer(vss_.get())), |
116 ss_scope_(fss_.get()), | 116 thread_(fss_.get()), |
117 // Note that the NAT is not used by default. ResetWithStunServerAndNat | 117 // Note that the NAT is not used by default. ResetWithStunServerAndNat |
118 // must be called. | 118 // must be called. |
119 nat_factory_(vss_.get(), kNatUdpAddr, kNatTcpAddr), | 119 nat_factory_(vss_.get(), kNatUdpAddr, kNatTcpAddr), |
120 nat_socket_factory_(new rtc::BasicPacketSocketFactory(&nat_factory_)), | 120 nat_socket_factory_(new rtc::BasicPacketSocketFactory(&nat_factory_)), |
121 stun_server_(TestStunServer::Create(Thread::Current(), kStunAddr)), | 121 stun_server_(TestStunServer::Create(Thread::Current(), kStunAddr)), |
122 relay_server_(Thread::Current(), | 122 relay_server_(Thread::Current(), |
123 kRelayUdpIntAddr, | 123 kRelayUdpIntAddr, |
124 kRelayUdpExtAddr, | 124 kRelayUdpExtAddr, |
125 kRelayTcpIntAddr, | 125 kRelayTcpIntAddr, |
126 kRelayTcpExtAddr, | 126 kRelayTcpExtAddr, |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 stun_servers.insert(stun_server); | 454 stun_servers.insert(stun_server); |
455 } | 455 } |
456 allocator_.reset(new BasicPortAllocator( | 456 allocator_.reset(new BasicPortAllocator( |
457 &network_manager_, nat_socket_factory_.get(), stun_servers)); | 457 &network_manager_, nat_socket_factory_.get(), stun_servers)); |
458 allocator().set_step_delay(kMinimumStepDelay); | 458 allocator().set_step_delay(kMinimumStepDelay); |
459 } | 459 } |
460 | 460 |
461 std::unique_ptr<rtc::PhysicalSocketServer> pss_; | 461 std::unique_ptr<rtc::PhysicalSocketServer> pss_; |
462 std::unique_ptr<rtc::VirtualSocketServer> vss_; | 462 std::unique_ptr<rtc::VirtualSocketServer> vss_; |
463 std::unique_ptr<rtc::FirewallSocketServer> fss_; | 463 std::unique_ptr<rtc::FirewallSocketServer> fss_; |
464 rtc::SocketServerScope ss_scope_; | 464 rtc::AutoSocketServerThread thread_; |
465 std::unique_ptr<rtc::NATServer> nat_server_; | 465 std::unique_ptr<rtc::NATServer> nat_server_; |
466 rtc::NATSocketFactory nat_factory_; | 466 rtc::NATSocketFactory nat_factory_; |
467 std::unique_ptr<rtc::BasicPacketSocketFactory> nat_socket_factory_; | 467 std::unique_ptr<rtc::BasicPacketSocketFactory> nat_socket_factory_; |
468 std::unique_ptr<TestStunServer> stun_server_; | 468 std::unique_ptr<TestStunServer> stun_server_; |
469 TestRelayServer relay_server_; | 469 TestRelayServer relay_server_; |
470 TestTurnServer turn_server_; | 470 TestTurnServer turn_server_; |
471 rtc::FakeNetworkManager network_manager_; | 471 rtc::FakeNetworkManager network_manager_; |
472 std::unique_ptr<BasicPortAllocator> allocator_; | 472 std::unique_ptr<BasicPortAllocator> allocator_; |
473 std::unique_ptr<PortAllocatorSession> session_; | 473 std::unique_ptr<PortAllocatorSession> session_; |
474 std::vector<PortInterface*> ports_; | 474 std::vector<PortInterface*> ports_; |
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 for (const Candidate& candidate : candidates) { | 1893 for (const Candidate& candidate : candidates) { |
1894 // Expect only relay candidates now that the filter is applied. | 1894 // Expect only relay candidates now that the filter is applied. |
1895 EXPECT_EQ(std::string(RELAY_PORT_TYPE), candidate.type()); | 1895 EXPECT_EQ(std::string(RELAY_PORT_TYPE), candidate.type()); |
1896 // Expect that the raddr is emptied due to the CF_RELAY filter. | 1896 // Expect that the raddr is emptied due to the CF_RELAY filter. |
1897 EXPECT_EQ(candidate.related_address(), | 1897 EXPECT_EQ(candidate.related_address(), |
1898 rtc::EmptySocketAddressWithFamily(candidate.address().family())); | 1898 rtc::EmptySocketAddressWithFamily(candidate.address().family())); |
1899 } | 1899 } |
1900 } | 1900 } |
1901 | 1901 |
1902 } // namespace cricket | 1902 } // namespace cricket |
OLD | NEW |