OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/tests/test_network_monitor_private.h" | 5 #include "ppapi/tests/test_network_monitor_private.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "ppapi/cpp/instance_handle.h" | 9 #include "ppapi/cpp/instance_handle.h" |
10 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 for (size_t iface = 0; iface < count; ++iface) { | 93 for (size_t iface = 0; iface < count; ++iface) { |
94 // Verify that the first interface has at least one address. | 94 // Verify that the first interface has at least one address. |
95 std::vector<PP_NetAddress_Private> addresses; | 95 std::vector<PP_NetAddress_Private> addresses; |
96 network_list.GetIpAddresses(iface, &addresses); | 96 network_list.GetIpAddresses(iface, &addresses); |
97 ASSERT_TRUE(addresses.size() >= 1U); | 97 ASSERT_TRUE(addresses.size() >= 1U); |
98 // Verify that the addresses are valid. | 98 // Verify that the addresses are valid. |
99 for (size_t i = 0; i < addresses.size(); ++i) { | 99 for (size_t i = 0; i < addresses.size(); ++i) { |
100 PP_NetAddressFamily_Private family = | 100 PP_NetAddressFamily_Private family = |
101 pp::NetAddressPrivate::GetFamily(addresses[i]); | 101 pp::NetAddressPrivate::GetFamily(addresses[i]); |
102 | 102 |
103 ASSERT_TRUE(family == PP_NETADDRESSFAMILY_IPV4 || | 103 ASSERT_TRUE(family == PP_NETADDRESSFAMILY_PRIVATE_IPV4 || |
104 family == PP_NETADDRESSFAMILY_IPV6); | 104 family == PP_NETADDRESSFAMILY_PRIVATE_IPV6); |
105 | 105 |
106 char ip[16] = { 0 }; | 106 char ip[16] = { 0 }; |
107 ASSERT_TRUE(pp::NetAddressPrivate::GetAddress( | 107 ASSERT_TRUE(pp::NetAddressPrivate::GetAddress( |
108 addresses[i], ip, sizeof(ip))); | 108 addresses[i], ip, sizeof(ip))); |
109 | 109 |
110 // Verify that the address is not zero. | 110 // Verify that the address is not zero. |
111 size_t j; | 111 size_t j; |
112 for (j = 0; j < sizeof(ip); ++j) { | 112 for (j = 0; j < sizeof(ip); ++j) { |
113 if (ip[j] != 0) | 113 if (ip[j] != 0) |
114 break; | 114 break; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 PASS(); | 213 PASS(); |
214 } | 214 } |
215 | 215 |
216 std::string TestNetworkMonitorPrivate::TestListObserver() { | 216 std::string TestNetworkMonitorPrivate::TestListObserver() { |
217 TestNetworkListObserver observer(instance_); | 217 TestNetworkListObserver observer(instance_); |
218 observer.event.Wait(); | 218 observer.event.Wait(); |
219 ASSERT_SUBTEST_SUCCESS(VerifyNetworkList(observer.current_list)); | 219 ASSERT_SUBTEST_SUCCESS(VerifyNetworkList(observer.current_list)); |
220 PASS(); | 220 PASS(); |
221 } | 221 } |
OLD | NEW |