OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 <string> | 12 #include <string> |
12 | 13 |
13 #include "webrtc/base/gunit.h" | 14 #include "webrtc/base/gunit.h" |
14 #include "webrtc/base/logging.h" | 15 #include "webrtc/base/logging.h" |
15 #include "webrtc/base/natserver.h" | 16 #include "webrtc/base/natserver.h" |
16 #include "webrtc/base/natsocketfactory.h" | 17 #include "webrtc/base/natsocketfactory.h" |
17 #include "webrtc/base/nethelpers.h" | 18 #include "webrtc/base/nethelpers.h" |
18 #include "webrtc/base/network.h" | 19 #include "webrtc/base/network.h" |
19 #include "webrtc/base/physicalsocketserver.h" | 20 #include "webrtc/base/physicalsocketserver.h" |
20 #include "webrtc/base/testclient.h" | 21 #include "webrtc/base/testclient.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 201 |
201 void TestPhysicalInternal(const SocketAddress& int_addr) { | 202 void TestPhysicalInternal(const SocketAddress& int_addr) { |
202 BasicNetworkManager network_manager; | 203 BasicNetworkManager network_manager; |
203 network_manager.set_ipv6_enabled(true); | 204 network_manager.set_ipv6_enabled(true); |
204 network_manager.StartUpdating(); | 205 network_manager.StartUpdating(); |
205 // Process pending messages so the network list is updated. | 206 // Process pending messages so the network list is updated. |
206 Thread::Current()->ProcessMessages(0); | 207 Thread::Current()->ProcessMessages(0); |
207 | 208 |
208 std::vector<Network*> networks; | 209 std::vector<Network*> networks; |
209 network_manager.GetNetworks(&networks); | 210 network_manager.GetNetworks(&networks); |
| 211 networks.erase(std::remove_if(networks.begin(), networks.end(), |
| 212 [](rtc::Network* network) { |
| 213 return rtc::kDefaultNetworkIgnoreMask & |
| 214 network->type(); |
| 215 }), |
| 216 networks.end()); |
210 if (networks.empty()) { | 217 if (networks.empty()) { |
211 LOG(LS_WARNING) << "Not enough network adapters for test."; | 218 LOG(LS_WARNING) << "Not enough network adapters for test."; |
212 return; | 219 return; |
213 } | 220 } |
214 | 221 |
215 SocketAddress ext_addr1(int_addr); | 222 SocketAddress ext_addr1(int_addr); |
216 SocketAddress ext_addr2; | 223 SocketAddress ext_addr2; |
217 // Find an available IP with matching family. The test breaks if int_addr | 224 // Find an available IP with matching family. The test breaks if int_addr |
218 // can't talk to ip, so check for connectivity as well. | 225 // can't talk to ip, so check for connectivity as well. |
219 for (std::vector<Network*>::iterator it = networks.begin(); | 226 for (std::vector<Network*>::iterator it = networks.begin(); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 size_t len = strlen(buf); | 386 size_t len = strlen(buf); |
380 | 387 |
381 in->Send(buf, len); | 388 in->Send(buf, len); |
382 SocketAddress trans_addr; | 389 SocketAddress trans_addr; |
383 EXPECT_TRUE(out->CheckNextPacket(buf, len, &trans_addr)); | 390 EXPECT_TRUE(out->CheckNextPacket(buf, len, &trans_addr)); |
384 | 391 |
385 out->Send(buf, len); | 392 out->Send(buf, len); |
386 EXPECT_TRUE(in->CheckNextPacket(buf, len, &trans_addr)); | 393 EXPECT_TRUE(in->CheckNextPacket(buf, len, &trans_addr)); |
387 } | 394 } |
388 // #endif | 395 // #endif |
OLD | NEW |