OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "net/base/host_resolver.h" | 5 #include "net/base/host_resolver.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <ws2tcpip.h> | 8 #include <ws2tcpip.h> |
9 #include <wspiapi.h> | 9 #include <wspiapi.h> |
10 #elif defined(OS_POSIX) | 10 #elif defined(OS_POSIX) |
(...skipping 13 matching lines...) Expand all Loading... |
24 const int kPortnum = 5555; | 24 const int kPortnum = 5555; |
25 int err = host_resolver.Resolve("127.0.0.1", kPortnum, &adrlist, NULL); | 25 int err = host_resolver.Resolve("127.0.0.1", kPortnum, &adrlist, NULL); |
26 EXPECT_EQ(0, err); | 26 EXPECT_EQ(0, err); |
27 | 27 |
28 const struct addrinfo* ainfo = adrlist.head(); | 28 const struct addrinfo* ainfo = adrlist.head(); |
29 EXPECT_EQ(static_cast<addrinfo*>(NULL), ainfo->ai_next); | 29 EXPECT_EQ(static_cast<addrinfo*>(NULL), ainfo->ai_next); |
30 EXPECT_EQ(sizeof(struct sockaddr_in), ainfo->ai_addrlen); | 30 EXPECT_EQ(sizeof(struct sockaddr_in), ainfo->ai_addrlen); |
31 | 31 |
32 const struct sockaddr* sa = ainfo->ai_addr; | 32 const struct sockaddr* sa = ainfo->ai_addr; |
33 const struct sockaddr_in* sa_in = (const struct sockaddr_in*) sa; | 33 const struct sockaddr_in* sa_in = (const struct sockaddr_in*) sa; |
34 EXPECT_EQ(htons(kPortnum), sa_in->sin_port); | 34 EXPECT_TRUE(htons(kPortnum) == sa_in->sin_port); |
35 EXPECT_EQ(htonl(0x7f000001), sa_in->sin_addr.s_addr); | 35 EXPECT_TRUE(htonl(0x7f000001) == sa_in->sin_addr.s_addr); |
36 } | 36 } |
37 | 37 |
38 } // namespace | 38 } // namespace |
OLD | NEW |