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

Side by Side Diff: ppapi/tests/test_net_address_private.cc

Issue 8764004: Add DEPS include rules so we don't accidentally use base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove rules to include self where possible Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/test_flash.cc ('k') | ppapi/tests/test_tcp_socket_private.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/basictypes.h"
8 #include "build/build_config.h"
9 #include "ppapi/cpp/private/net_address_private.h" 7 #include "ppapi/cpp/private/net_address_private.h"
10 #include "ppapi/c/private/ppb_net_address_private.h" 8 #include "ppapi/c/private/ppb_net_address_private.h"
9 #include "ppapi/tests/test_utils.h"
11 #include "ppapi/tests/testing_instance.h" 10 #include "ppapi/tests/testing_instance.h"
12 11
13 // Other than |GetAnyAddress()|, there's no way to actually get 12 // Other than |GetAnyAddress()|, there's no way to actually get
14 // |PP_NetAddress_Private| structs from just this interface. We'll cheat and 13 // |PP_NetAddress_Private| structs from just this interface. We'll cheat and
15 // synthesize some. 14 // synthesize some.
16 15
17 #if defined(OS_POSIX) 16 #if defined(PPAPI_POSIX)
18 #include <arpa/inet.h> 17 #include <arpa/inet.h>
19 #include <netdb.h> 18 #include <netdb.h>
20 #include <netinet/in.h> 19 #include <netinet/in.h>
21 #include <sys/socket.h> 20 #include <sys/socket.h>
22 #endif 21 #endif
23 22
24 #if defined(OS_MACOSX) 23 #if defined(PPAPI_OS_MACOSX)
25 // This is a bit evil, but it's standard operating procedure for |s6_addr|.... 24 // This is a bit evil, but it's standard operating procedure for |s6_addr|....
26 #define s6_addr16 __u6_addr.__u6_addr16 25 #define s6_addr16 __u6_addr.__u6_addr16
27 #endif 26 #endif
28 27
29 #if defined(OS_WIN) 28 #if defined(PPAPI_OS_WIN)
30 #include <ws2tcpip.h> 29 #include <ws2tcpip.h>
31 30
32 #define s6_addr16 u.Word 31 #define s6_addr16 u.Word
33 #endif 32 #endif
34 33
35 using pp::NetAddressPrivate; 34 using pp::NetAddressPrivate;
36 35
37 namespace { 36 namespace {
38 37
39 // |host| should be an IP address represented as text, e.g., "192.168.0.1". 38 // |host| should be an IP address represented as text, e.g., "192.168.0.1".
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 { // ... with non-zero scope. 225 { // ... with non-zero scope.
227 { 0, 0, 0, 0, 0, 0xffff, 0xc0a8, 0x102 }, 123, 789, 226 { 0, 0, 0, 0, 0, 0xffff, 0xc0a8, 0x102 }, 123, 789,
228 "::ffff:192.168.1.2%789", "[::ffff:192.168.1.2%789]:123" 227 "::ffff:192.168.1.2%789", "[::ffff:192.168.1.2%789]:123"
229 }, 228 },
230 { // *Not* IPv4 embedded in IPv6. 229 { // *Not* IPv4 embedded in IPv6.
231 { 0, 0, 0, 0, 0, 0x1234, 0xc0a8, 0x102 }, 123, 0, 230 { 0, 0, 0, 0, 0, 0x1234, 0xc0a8, 0x102 }, 123, 0,
232 "::1234:c0a8:102", "[::1234:c0a8:102]:123" 231 "::1234:c0a8:102", "[::1234:c0a8:102]:123"
233 } 232 }
234 }; 233 };
235 234
236 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); i++) { 235 for (size_t i = 0; i < sizeof(test_cases)/sizeof(test_cases[0]); i++) {
237 PP_NetAddress_Private addr = MakeIPv6NetAddress(test_cases[i].address, 236 PP_NetAddress_Private addr = MakeIPv6NetAddress(test_cases[i].address,
238 test_cases[i].port, 237 test_cases[i].port,
239 test_cases[i].scope); 238 test_cases[i].scope);
240 ASSERT_EQ(test_cases[i].expected_without_port, 239 ASSERT_EQ(test_cases[i].expected_without_port,
241 NetAddressPrivate::Describe(addr, false)); 240 NetAddressPrivate::Describe(addr, false));
242 ASSERT_EQ(test_cases[i].expected_with_port, 241 ASSERT_EQ(test_cases[i].expected_with_port,
243 NetAddressPrivate::Describe(addr, true)); 242 NetAddressPrivate::Describe(addr, true));
244 } 243 }
245 244
246 PASS(); 245 PASS();
247 } 246 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_flash.cc ('k') | ppapi/tests/test_tcp_socket_private.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698