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

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

Issue 302010: Add a mechanism to disable IPv6.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Address darin's comments Created 11 years, 2 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/address_list.h" 5 #include "net/base/address_list.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "net/base/host_resolver_proc.h" 8 #include "net/base/host_resolver_proc.h"
9 #include "net/base/net_util.h" 9 #include "net/base/net_util.h"
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
11 #include "net/base/winsock_init.h" 11 #include "net/base/winsock_init.h"
12 #endif 12 #endif
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace { 15 namespace {
16 16
17 // Use getaddrinfo() to allocate an addrinfo structure. 17 // Use getaddrinfo() to allocate an addrinfo structure.
18 void CreateAddressList(net::AddressList* addrlist, int port) { 18 void CreateAddressList(net::AddressList* addrlist, int port) {
19 #if defined(OS_WIN) 19 #if defined(OS_WIN)
20 net::EnsureWinsockInit(); 20 net::EnsureWinsockInit();
21 #endif 21 #endif
22 int rv = SystemHostResolverProc("192.168.1.1", addrlist); 22 int rv = SystemHostResolverProc("192.168.1.1",
23 net::ADDRESS_FAMILY_UNSPECIFIED,
24 addrlist);
23 EXPECT_EQ(0, rv); 25 EXPECT_EQ(0, rv);
24 addrlist->SetPort(port); 26 addrlist->SetPort(port);
25 } 27 }
26 28
27 TEST(AddressListTest, GetPort) { 29 TEST(AddressListTest, GetPort) {
28 net::AddressList addrlist; 30 net::AddressList addrlist;
29 CreateAddressList(&addrlist, 81); 31 CreateAddressList(&addrlist, 81);
30 EXPECT_EQ(81, addrlist.GetPort()); 32 EXPECT_EQ(81, addrlist.GetPort());
31 33
32 addrlist.SetPort(83); 34 addrlist.SetPort(83);
(...skipping 29 matching lines...) Expand all
62 64
63 // Changes to addrlist1 are not reflected in addrlist2. 65 // Changes to addrlist1 are not reflected in addrlist2.
64 addrlist1.SetPort(70); 66 addrlist1.SetPort(70);
65 addrlist2.SetPort(90); 67 addrlist2.SetPort(90);
66 68
67 EXPECT_EQ(70, addrlist1.GetPort()); 69 EXPECT_EQ(70, addrlist1.GetPort());
68 EXPECT_EQ(90, addrlist2.GetPort()); 70 EXPECT_EQ(90, addrlist2.GetPort());
69 } 71 }
70 72
71 } // namespace 73 } // namespace
OLDNEW
« no previous file with comments | « net/base/address_family.h ('k') | net/base/host_cache.h » ('j') | net/base/host_resolver_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698