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

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

Issue 1166013002: Better determination of Symmetric NAT (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 6 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
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
(...skipping 13 matching lines...) Expand all
24 using stunprober::HostNameResolverInterface; 24 using stunprober::HostNameResolverInterface;
25 using stunprober::TaskRunner; 25 using stunprober::TaskRunner;
26 using stunprober::SocketFactory; 26 using stunprober::SocketFactory;
27 using stunprober::StunProber; 27 using stunprober::StunProber;
28 using stunprober::AsyncCallback; 28 using stunprober::AsyncCallback;
29 using stunprober::ClientSocketInterface; 29 using stunprober::ClientSocketInterface;
30 using stunprober::ServerSocketInterface; 30 using stunprober::ServerSocketInterface;
31 using stunprober::SocketFactory; 31 using stunprober::SocketFactory;
32 using stunprober::TaskRunner; 32 using stunprober::TaskRunner;
33 33
34 using NATTYPE = stunprober::StunProber::NATTYPE;
35
34 namespace stunprober { 36 namespace stunprober {
35 37
36 namespace { 38 namespace {
37 39
38 const rtc::SocketAddress kLocalAddr("192.168.0.1", 0); 40 const rtc::SocketAddress kLocalAddr("192.168.0.1", 0);
39 const rtc::SocketAddress kStunAddr1("1.1.1.1", 3478); 41 const rtc::SocketAddress kStunAddr1("1.1.1.1", 3478);
40 const rtc::SocketAddress kStunAddr2("1.1.1.2", 3478); 42 const rtc::SocketAddress kStunAddr2("1.1.1.2", 3478);
41 const rtc::SocketAddress kFailedStunAddr("1.1.1.3", 3478); 43 const rtc::SocketAddress kFailedStunAddr("1.1.1.3", 3478);
42 const rtc::SocketAddress kStunMappedAddr("77.77.77.77", 0); 44 const rtc::SocketAddress kStunMappedAddr("77.77.77.77", 0);
43 45
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 163
162 StartProbing(resolver.release(), socket_factory.release(), addr, 164 StartProbing(resolver.release(), socket_factory.release(), addr,
163 shared_mode, 3, pings_per_ip); 165 shared_mode, 3, pings_per_ip);
164 166
165 WAIT(stopped_, 1000); 167 WAIT(stopped_, 1000);
166 168
167 StunProber::Stats stats; 169 StunProber::Stats stats;
168 EXPECT_EQ(ss_->num_socket(), total_sockets); 170 EXPECT_EQ(ss_->num_socket(), total_sockets);
169 EXPECT_TRUE(prober->GetStats(&stats)); 171 EXPECT_TRUE(prober->GetStats(&stats));
170 EXPECT_EQ(stats.success_percent, 100); 172 EXPECT_EQ(stats.success_percent, 100);
171 EXPECT_TRUE(stats.behind_nat); 173 EXPECT_TRUE(stats.nat_type > NATTYPE::NATTYPE_NO_NAT);
172 EXPECT_EQ(stats.host_ip, kLocalAddr.ipaddr().ToString()); 174 EXPECT_EQ(stats.host_ip, kLocalAddr.ipaddr().ToString());
173 EXPECT_EQ(stats.srflx_addrs, srflx_addresses); 175 EXPECT_EQ(stats.srflx_addrs, srflx_addresses);
174 EXPECT_EQ(static_cast<uint32>(stats.num_request_sent), 176 EXPECT_EQ(static_cast<uint32>(stats.num_request_sent),
175 total_pings_reported); 177 total_pings_reported);
176 EXPECT_EQ(static_cast<uint32>(stats.num_response_received), 178 EXPECT_EQ(static_cast<uint32>(stats.num_response_received),
177 total_pings_reported); 179 total_pings_reported);
178 } 180 }
179 181
180 private: 182 private:
181 void StopCallback(int result) { 183 void StopCallback(int result) {
(...skipping 27 matching lines...) Expand all
209 211
210 TEST_F(StunProberTest, NonSharedMode) { 212 TEST_F(StunProberTest, NonSharedMode) {
211 RunProber(false); 213 RunProber(false);
212 } 214 }
213 215
214 TEST_F(StunProberTest, SharedMode) { 216 TEST_F(StunProberTest, SharedMode) {
215 RunProber(true); 217 RunProber(true);
216 } 218 }
217 219
218 } // namespace stunprober 220 } // namespace stunprober
OLDNEW
« webrtc/p2p/stunprober/stunprober.cc ('K') | « webrtc/p2p/stunprober/stunprober.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698