| 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_net_address_private.h" | 5 #include "ppapi/tests/test_net_address_private.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "ppapi/cpp/private/net_address_private.h" | 9 #include "ppapi/cpp/private/net_address_private.h" |
| 10 #include "ppapi/c/private/ppb_net_address_private.h" | 10 #include "ppapi/c/private/ppb_net_address_private.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 NetAddressPrivate::Describe(addr, false)); | 245 NetAddressPrivate::Describe(addr, false)); |
| 246 ASSERT_EQ(test_cases[i].expected_with_port, | 246 ASSERT_EQ(test_cases[i].expected_with_port, |
| 247 NetAddressPrivate::Describe(addr, true)); | 247 NetAddressPrivate::Describe(addr, true)); |
| 248 } | 248 } |
| 249 | 249 |
| 250 PASS(); | 250 PASS(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 std::string TestNetAddressPrivate::TestGetFamily() { | 253 std::string TestNetAddressPrivate::TestGetFamily() { |
| 254 PP_NetAddress_Private ipv4 = MakeIPv4NetAddress("127.0.0.1", 80); | 254 PP_NetAddress_Private ipv4 = MakeIPv4NetAddress("127.0.0.1", 80); |
| 255 ASSERT_EQ(NetAddressPrivate::GetFamily(ipv4), AF_INET); | 255 ASSERT_EQ(NetAddressPrivate::GetFamily(ipv4), PP_NETADDRESSFAMILY_IPV4); |
| 256 | 256 |
| 257 uint16_t ipv6_address[8] = { 0x1234, 0xabcd, 0, 0, 0xff, 0, 0, 0xcdef }; | 257 uint16_t ipv6_address[8] = { 0x1234, 0xabcd, 0, 0, 0xff, 0, 0, 0xcdef }; |
| 258 PP_NetAddress_Private ipv6 = MakeIPv6NetAddress(ipv6_address, | 258 PP_NetAddress_Private ipv6 = MakeIPv6NetAddress(ipv6_address, |
| 259 123, | 259 123, |
| 260 0); | 260 0); |
| 261 ASSERT_EQ(NetAddressPrivate::GetFamily(ipv6), AF_INET6); | 261 ASSERT_EQ(NetAddressPrivate::GetFamily(ipv6), PP_NETADDRESSFAMILY_IPV6); |
| 262 | 262 |
| 263 PASS(); | 263 PASS(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 std::string TestNetAddressPrivate::TestGetPort() { | 266 std::string TestNetAddressPrivate::TestGetPort() { |
| 267 PP_NetAddress_Private localhost_80 = MakeIPv4NetAddress("127.0.0.1", 80); | 267 PP_NetAddress_Private localhost_80 = MakeIPv4NetAddress("127.0.0.1", 80); |
| 268 ASSERT_EQ(NetAddressPrivate::GetPort(localhost_80), 80); | 268 ASSERT_EQ(NetAddressPrivate::GetPort(localhost_80), 80); |
| 269 | 269 |
| 270 uint16_t ipv6_address[8] = { 0x1234, 0xabcd, 0, 0, 0xff, 0, 0, 0xcdef }; | 270 uint16_t ipv6_address[8] = { 0x1234, 0xabcd, 0, 0, 0xff, 0, 0, 0xcdef }; |
| 271 | 271 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 addr_storage_len)); | 313 addr_storage_len)); |
| 314 ASSERT_EQ(memcmp(addr_storage, ipv6_address, 16), 0); | 314 ASSERT_EQ(memcmp(addr_storage, ipv6_address, 16), 0); |
| 315 | 315 |
| 316 // Insufficient storage for address. | 316 // Insufficient storage for address. |
| 317 ASSERT_FALSE(NetAddressPrivate::GetAddress(ipv6_addr, | 317 ASSERT_FALSE(NetAddressPrivate::GetAddress(ipv6_addr, |
| 318 addr_storage, | 318 addr_storage, |
| 319 1)); | 319 1)); |
| 320 | 320 |
| 321 PASS(); | 321 PASS(); |
| 322 } | 322 } |
| OLD | NEW |