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

Side by Side Diff: net/base/host_resolver_unittest.cc

Issue 267: Fix "passing NULL to non-pointer argument" warning in gcc 4.1 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 3 months 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 | « no previous file | no next file » | 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) 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 #include "net/base/address_list.h" 6 #include "net/base/address_list.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 #ifdef OS_WIN 9 #ifdef OS_WIN
10 #include <ws2tcpip.h> 10 #include <ws2tcpip.h>
(...skipping 11 matching lines...) Expand all
22 TEST(HostResolverTest, NumericAddresses) { 22 TEST(HostResolverTest, NumericAddresses) {
23 // Stevens says dotted quads with AI_UNSPEC resolve to a single sockaddr_in. 23 // Stevens says dotted quads with AI_UNSPEC resolve to a single sockaddr_in.
24 24
25 net::HostResolver host_resolver; 25 net::HostResolver host_resolver;
26 net::AddressList adrlist; 26 net::AddressList adrlist;
27 const int kPortnum = 5555; 27 const int kPortnum = 5555;
28 int err = host_resolver.Resolve("127.0.0.1", kPortnum, &adrlist, NULL); 28 int err = host_resolver.Resolve("127.0.0.1", kPortnum, &adrlist, NULL);
29 EXPECT_EQ(0, err); 29 EXPECT_EQ(0, err);
30 30
31 const struct addrinfo* ainfo = adrlist.head(); 31 const struct addrinfo* ainfo = adrlist.head();
32 EXPECT_EQ(NULL, ainfo->ai_next); 32 EXPECT_EQ(static_cast<addrinfo*>(NULL), ainfo->ai_next);
33 EXPECT_EQ(sizeof(struct sockaddr_in), ainfo->ai_addrlen); 33 EXPECT_EQ(sizeof(struct sockaddr_in), ainfo->ai_addrlen);
34 34
35 const struct sockaddr* sa = ainfo->ai_addr; 35 const struct sockaddr* sa = ainfo->ai_addr;
36 const struct sockaddr_in* sa_in = (const struct sockaddr_in*) sa; 36 const struct sockaddr_in* sa_in = (const struct sockaddr_in*) sa;
37 EXPECT_EQ(htons(kPortnum), sa_in->sin_port); 37 EXPECT_EQ(htons(kPortnum), sa_in->sin_port);
38 EXPECT_EQ(htonl(0x7f000001), sa_in->sin_addr.s_addr); 38 EXPECT_EQ(htonl(0x7f000001), sa_in->sin_addr.s_addr);
39 } 39 }
40 40
41 } // namespace 41 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698