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 "webrtc/base/network.h" | 11 #include "webrtc/base/network.h" |
12 | 12 |
| 13 #include "webrtc/base/checks.h" |
13 #include "webrtc/base/nethelpers.h" | 14 #include "webrtc/base/nethelpers.h" |
14 #include "webrtc/base/networkmonitor.h" | 15 #include "webrtc/base/networkmonitor.h" |
15 #include <memory> | 16 #include <memory> |
16 #include <vector> | 17 #include <vector> |
17 #if defined(WEBRTC_POSIX) | 18 #if defined(WEBRTC_POSIX) |
18 #include <sys/types.h> | 19 #include <sys/types.h> |
19 #include <net/if.h> | 20 #include <net/if.h> |
20 #include "webrtc/base/ifaddrs_converter.h" | 21 #include "webrtc/base/ifaddrs_converter.h" |
21 #endif // defined(WEBRTC_POSIX) | 22 #endif // defined(WEBRTC_POSIX) |
22 #include "webrtc/base/gunit.h" | 23 #include "webrtc/base/gunit.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 for (const auto& kv : network_manager.networks_map_) { | 97 for (const auto& kv : network_manager.networks_map_) { |
97 delete kv.second; | 98 delete kv.second; |
98 } | 99 } |
99 network_manager.networks_.clear(); | 100 network_manager.networks_.clear(); |
100 network_manager.networks_map_.clear(); | 101 network_manager.networks_map_.clear(); |
101 } | 102 } |
102 | 103 |
103 AdapterType GetAdapterType(BasicNetworkManager& network_manager) { | 104 AdapterType GetAdapterType(BasicNetworkManager& network_manager) { |
104 BasicNetworkManager::NetworkList list; | 105 BasicNetworkManager::NetworkList list; |
105 network_manager.GetNetworks(&list); | 106 network_manager.GetNetworks(&list); |
106 ASSERT(list.size() == 1u); | 107 RTC_CHECK(list.size() == 1u); |
107 return list[0]->type(); | 108 return list[0]->type(); |
108 } | 109 } |
109 | 110 |
110 #if defined(WEBRTC_POSIX) | 111 #if defined(WEBRTC_POSIX) |
111 // Separated from CreateNetworks for tests. | 112 // Separated from CreateNetworks for tests. |
112 static void CallConvertIfAddrs(const BasicNetworkManager& network_manager, | 113 static void CallConvertIfAddrs(const BasicNetworkManager& network_manager, |
113 struct ifaddrs* interfaces, | 114 struct ifaddrs* interfaces, |
114 bool include_ignored, | 115 bool include_ignored, |
115 NetworkManager::NetworkList* networks) { | 116 NetworkManager::NetworkList* networks) { |
116 // Use the base IfAddrsConverter for test cases. | 117 // Use the base IfAddrsConverter for test cases. |
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 // If the set default address is in a network, GetDefaultLocalAddress will | 1145 // If the set default address is in a network, GetDefaultLocalAddress will |
1145 // return the best IP in that network. | 1146 // return the best IP in that network. |
1146 manager.set_default_local_addresses(GetLoopbackIP(AF_INET), ip2); | 1147 manager.set_default_local_addresses(GetLoopbackIP(AF_INET), ip2); |
1147 EXPECT_TRUE(manager.GetDefaultLocalAddress(AF_INET6, &ip)); | 1148 EXPECT_TRUE(manager.GetDefaultLocalAddress(AF_INET6, &ip)); |
1148 EXPECT_EQ(static_cast<IPAddress>(ip1), ip); | 1149 EXPECT_EQ(static_cast<IPAddress>(ip1), ip); |
1149 | 1150 |
1150 manager.StopUpdating(); | 1151 manager.StopUpdating(); |
1151 } | 1152 } |
1152 | 1153 |
1153 } // namespace rtc | 1154 } // namespace rtc |
OLD | NEW |