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

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

Issue 2883313003: Remove VirtualSocketServer's dependency on PhysicalSocketServer. (Closed)
Patch Set: Created 3 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/udptransport_unittest.cc ('k') | webrtc/p2p/stunprober/stunprober_unittest.cc » ('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
11 #include <algorithm> 11 #include <algorithm>
12 #include <memory> 12 #include <memory>
13 13
14 #include "webrtc/base/fakeclock.h" 14 #include "webrtc/base/fakeclock.h"
15 #include "webrtc/base/fakenetwork.h" 15 #include "webrtc/base/fakenetwork.h"
16 #include "webrtc/base/firewallsocketserver.h" 16 #include "webrtc/base/firewallsocketserver.h"
17 #include "webrtc/base/gunit.h" 17 #include "webrtc/base/gunit.h"
18 #include "webrtc/base/helpers.h" 18 #include "webrtc/base/helpers.h"
19 #include "webrtc/base/ipaddress.h" 19 #include "webrtc/base/ipaddress.h"
20 #include "webrtc/base/logging.h" 20 #include "webrtc/base/logging.h"
21 #include "webrtc/base/natserver.h" 21 #include "webrtc/base/natserver.h"
22 #include "webrtc/base/natsocketfactory.h" 22 #include "webrtc/base/natsocketfactory.h"
23 #include "webrtc/base/nethelpers.h" 23 #include "webrtc/base/nethelpers.h"
24 #include "webrtc/base/network.h" 24 #include "webrtc/base/network.h"
25 #include "webrtc/base/physicalsocketserver.h"
26 #include "webrtc/base/socketaddress.h" 25 #include "webrtc/base/socketaddress.h"
27 #include "webrtc/base/ssladapter.h" 26 #include "webrtc/base/ssladapter.h"
28 #include "webrtc/base/thread.h" 27 #include "webrtc/base/thread.h"
29 #include "webrtc/base/virtualsocketserver.h" 28 #include "webrtc/base/virtualsocketserver.h"
30 #include "webrtc/p2p/base/basicpacketsocketfactory.h" 29 #include "webrtc/p2p/base/basicpacketsocketfactory.h"
31 #include "webrtc/p2p/base/p2pconstants.h" 30 #include "webrtc/p2p/base/p2pconstants.h"
32 #include "webrtc/p2p/base/p2ptransportchannel.h" 31 #include "webrtc/p2p/base/p2ptransportchannel.h"
33 #include "webrtc/p2p/base/testrelayserver.h" 32 #include "webrtc/p2p/base/testrelayserver.h"
34 #include "webrtc/p2p/base/teststunserver.h" 33 #include "webrtc/p2p/base/teststunserver.h"
35 #include "webrtc/p2p/base/testturnserver.h" 34 #include "webrtc/p2p/base/testturnserver.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 first = false; 109 first = false;
111 }; 110 };
112 os << ']'; 111 os << ']';
113 return os; 112 return os;
114 } 113 }
115 114
116 class BasicPortAllocatorTestBase : public testing::Test, 115 class BasicPortAllocatorTestBase : public testing::Test,
117 public sigslot::has_slots<> { 116 public sigslot::has_slots<> {
118 public: 117 public:
119 BasicPortAllocatorTestBase() 118 BasicPortAllocatorTestBase()
120 : pss_(new rtc::PhysicalSocketServer), 119 : vss_(new rtc::VirtualSocketServer()),
121 vss_(new rtc::VirtualSocketServer(pss_.get())),
122 fss_(new rtc::FirewallSocketServer(vss_.get())), 120 fss_(new rtc::FirewallSocketServer(vss_.get())),
123 thread_(fss_.get()), 121 thread_(fss_.get()),
124 // Note that the NAT is not used by default. ResetWithStunServerAndNat 122 // Note that the NAT is not used by default. ResetWithStunServerAndNat
125 // must be called. 123 // must be called.
126 nat_factory_(vss_.get(), kNatUdpAddr, kNatTcpAddr), 124 nat_factory_(vss_.get(), kNatUdpAddr, kNatTcpAddr),
127 nat_socket_factory_(new rtc::BasicPacketSocketFactory(&nat_factory_)), 125 nat_socket_factory_(new rtc::BasicPacketSocketFactory(&nat_factory_)),
128 stun_server_(TestStunServer::Create(Thread::Current(), kStunAddr)), 126 stun_server_(TestStunServer::Create(Thread::Current(), kStunAddr)),
129 relay_server_(Thread::Current(), 127 relay_server_(Thread::Current(),
130 kRelayUdpIntAddr, 128 kRelayUdpIntAddr,
131 kRelayUdpExtAddr, 129 kRelayUdpExtAddr,
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 456
459 ServerAddresses stun_servers; 457 ServerAddresses stun_servers;
460 if (!stun_server.IsNil()) { 458 if (!stun_server.IsNil()) {
461 stun_servers.insert(stun_server); 459 stun_servers.insert(stun_server);
462 } 460 }
463 allocator_.reset(new BasicPortAllocator( 461 allocator_.reset(new BasicPortAllocator(
464 &network_manager_, nat_socket_factory_.get(), stun_servers)); 462 &network_manager_, nat_socket_factory_.get(), stun_servers));
465 allocator().set_step_delay(kMinimumStepDelay); 463 allocator().set_step_delay(kMinimumStepDelay);
466 } 464 }
467 465
468 std::unique_ptr<rtc::PhysicalSocketServer> pss_;
469 std::unique_ptr<rtc::VirtualSocketServer> vss_; 466 std::unique_ptr<rtc::VirtualSocketServer> vss_;
470 std::unique_ptr<rtc::FirewallSocketServer> fss_; 467 std::unique_ptr<rtc::FirewallSocketServer> fss_;
471 rtc::AutoSocketServerThread thread_; 468 rtc::AutoSocketServerThread thread_;
472 std::unique_ptr<rtc::NATServer> nat_server_; 469 std::unique_ptr<rtc::NATServer> nat_server_;
473 rtc::NATSocketFactory nat_factory_; 470 rtc::NATSocketFactory nat_factory_;
474 std::unique_ptr<rtc::BasicPacketSocketFactory> nat_socket_factory_; 471 std::unique_ptr<rtc::BasicPacketSocketFactory> nat_socket_factory_;
475 std::unique_ptr<TestStunServer> stun_server_; 472 std::unique_ptr<TestStunServer> stun_server_;
476 TestRelayServer relay_server_; 473 TestRelayServer relay_server_;
477 TestTurnServer turn_server_; 474 TestTurnServer turn_server_;
478 rtc::FakeNetworkManager network_manager_; 475 rtc::FakeNetworkManager network_manager_;
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 for (const Candidate& candidate : candidates) { 1900 for (const Candidate& candidate : candidates) {
1904 // Expect only relay candidates now that the filter is applied. 1901 // Expect only relay candidates now that the filter is applied.
1905 EXPECT_EQ(std::string(RELAY_PORT_TYPE), candidate.type()); 1902 EXPECT_EQ(std::string(RELAY_PORT_TYPE), candidate.type());
1906 // Expect that the raddr is emptied due to the CF_RELAY filter. 1903 // Expect that the raddr is emptied due to the CF_RELAY filter.
1907 EXPECT_EQ(candidate.related_address(), 1904 EXPECT_EQ(candidate.related_address(),
1908 rtc::EmptySocketAddressWithFamily(candidate.address().family())); 1905 rtc::EmptySocketAddressWithFamily(candidate.address().family()));
1909 } 1906 }
1910 } 1907 }
1911 1908
1912 } // namespace cricket 1909 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/udptransport_unittest.cc ('k') | webrtc/p2p/stunprober/stunprober_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698