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

Side by Side Diff: webrtc/p2p/stunprober/stunprober_unittest.cc

Issue 1923163003: Replace scoped_ptr with unique_ptr in webrtc/p2p/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 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/stunprober/stunprober.cc ('k') | no next file » | 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
11 #include <memory>
12
11 #include "webrtc/base/asyncresolverinterface.h" 13 #include "webrtc/base/asyncresolverinterface.h"
12 #include "webrtc/base/basictypes.h" 14 #include "webrtc/base/basictypes.h"
13 #include "webrtc/base/bind.h" 15 #include "webrtc/base/bind.h"
14 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
15 #include "webrtc/base/gunit.h" 17 #include "webrtc/base/gunit.h"
16 #include "webrtc/base/physicalsocketserver.h" 18 #include "webrtc/base/physicalsocketserver.h"
17 #include "webrtc/base/scoped_ptr.h"
18 #include "webrtc/base/ssladapter.h" 19 #include "webrtc/base/ssladapter.h"
19 #include "webrtc/base/virtualsocketserver.h" 20 #include "webrtc/base/virtualsocketserver.h"
20 #include "webrtc/p2p/base/basicpacketsocketfactory.h" 21 #include "webrtc/p2p/base/basicpacketsocketfactory.h"
21 #include "webrtc/p2p/base/teststunserver.h" 22 #include "webrtc/p2p/base/teststunserver.h"
22 #include "webrtc/p2p/stunprober/stunprober.h" 23 #include "webrtc/p2p/stunprober/stunprober.h"
23 24
24 using stunprober::StunProber; 25 using stunprober::StunProber;
25 using stunprober::AsyncCallback; 26 using stunprober::AsyncCallback;
26 27
27 namespace stunprober { 28 namespace stunprober {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 addrs.push_back(kStunAddr2); 77 addrs.push_back(kStunAddr2);
77 // Add a non-existing server. This shouldn't pollute the result. 78 // Add a non-existing server. This shouldn't pollute the result.
78 addrs.push_back(kFailedStunAddr); 79 addrs.push_back(kFailedStunAddr);
79 80
80 rtc::Network ipv4_network1("test_eth0", "Test Network Adapter 1", 81 rtc::Network ipv4_network1("test_eth0", "Test Network Adapter 1",
81 rtc::IPAddress(0x12345600U), 24); 82 rtc::IPAddress(0x12345600U), 24);
82 ipv4_network1.AddIP(rtc::IPAddress(0x12345678)); 83 ipv4_network1.AddIP(rtc::IPAddress(0x12345678));
83 rtc::NetworkManager::NetworkList networks; 84 rtc::NetworkManager::NetworkList networks;
84 networks.push_back(&ipv4_network1); 85 networks.push_back(&ipv4_network1);
85 86
86 rtc::scoped_ptr<rtc::BasicPacketSocketFactory> socket_factory( 87 std::unique_ptr<rtc::BasicPacketSocketFactory> socket_factory(
87 new rtc::BasicPacketSocketFactory()); 88 new rtc::BasicPacketSocketFactory());
88 89
89 // Set up the expected results for verification. 90 // Set up the expected results for verification.
90 std::set<std::string> srflx_addresses; 91 std::set<std::string> srflx_addresses;
91 srflx_addresses.insert(kStunMappedAddr.ToString()); 92 srflx_addresses.insert(kStunMappedAddr.ToString());
92 const uint32_t total_pings_tried = 93 const uint32_t total_pings_tried =
93 static_cast<uint32_t>(pings_per_ip * addrs.size()); 94 static_cast<uint32_t>(pings_per_ip * addrs.size());
94 95
95 // The reported total_pings should not count for pings sent to the 96 // The reported total_pings should not count for pings sent to the
96 // kFailedStunAddr. 97 // kFailedStunAddr.
(...skipping 15 matching lines...) Expand all
112 total_pings_reported); 113 total_pings_reported);
113 } 114 }
114 115
115 private: 116 private:
116 void StopCallback(StunProber* prober, int result) { 117 void StopCallback(StunProber* prober, int result) {
117 EXPECT_EQ(result, result_); 118 EXPECT_EQ(result, result_);
118 stopped_ = true; 119 stopped_ = true;
119 } 120 }
120 121
121 rtc::Thread* main_; 122 rtc::Thread* main_;
122 rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_; 123 std::unique_ptr<rtc::PhysicalSocketServer> pss_;
123 rtc::scoped_ptr<rtc::VirtualSocketServer> ss_; 124 std::unique_ptr<rtc::VirtualSocketServer> ss_;
124 rtc::SocketServerScope ss_scope_; 125 rtc::SocketServerScope ss_scope_;
125 rtc::scoped_ptr<StunProber> prober; 126 std::unique_ptr<StunProber> prober;
126 int result_ = 0; 127 int result_ = 0;
127 bool stopped_ = false; 128 bool stopped_ = false;
128 rtc::scoped_ptr<cricket::TestStunServer> stun_server_1_; 129 std::unique_ptr<cricket::TestStunServer> stun_server_1_;
129 rtc::scoped_ptr<cricket::TestStunServer> stun_server_2_; 130 std::unique_ptr<cricket::TestStunServer> stun_server_2_;
130 }; 131 };
131 132
132 TEST_F(StunProberTest, NonSharedMode) { 133 TEST_F(StunProberTest, NonSharedMode) {
133 RunProber(false); 134 RunProber(false);
134 } 135 }
135 136
136 TEST_F(StunProberTest, SharedMode) { 137 TEST_F(StunProberTest, SharedMode) {
137 RunProber(true); 138 RunProber(true);
138 } 139 }
139 140
140 } // namespace stunprober 141 } // namespace stunprober
OLDNEW
« no previous file with comments | « webrtc/p2p/stunprober/stunprober.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698