summaryrefslogtreecommitdiffstats
path: root/net/socket
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-18 08:02:08 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-18 08:02:08 +0000
commit40f153572764e76066588fd2e358d05b8fa453bb (patch)
tree9c8bf3de47da4fac879d1035addf2a6780f163e4 /net/socket
parenta2c2fb9ff48cd37dbed258dca5b40461c92b71a8 (diff)
downloadchromium_src-40f153572764e76066588fd2e358d05b8fa453bb.zip
chromium_src-40f153572764e76066588fd2e358d05b8fa453bb.tar.gz
chromium_src-40f153572764e76066588fd2e358d05b8fa453bb.tar.bz2
Use manually constructed IPv6 socket addresses for tests, rather than system created ones.
The advantage is that GURL's parsing of IPv6 addresses works on all systems, whereas getaddrinfo(ipv6_literal) only succeeds on IPv6 enabled systems. This allows the tests to run consistently on all systems, including our own WinXP buildbots (which do not support IPv6). BUG=http://crbug.com/16452 TEST=[net_unittests] SOCKS5ClientSocketTest.IPv6Domain, SOCKSClientSocketTest.SOCKS4AIfDomainInIPv6 Review URL: http://codereview.chromium.org/155618 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21053 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket')
-rw-r--r--net/socket/socks5_client_socket_unittest.cc14
-rw-r--r--net/socket/socks_client_socket_unittest.cc2
2 files changed, 3 insertions, 13 deletions
diff --git a/net/socket/socks5_client_socket_unittest.cc b/net/socket/socks5_client_socket_unittest.cc
index b225887..33b3fa3 100644
--- a/net/socket/socks5_client_socket_unittest.cc
+++ b/net/socket/socks5_client_socket_unittest.cc
@@ -179,17 +179,7 @@ TEST_F(SOCKS5ClientSocketTest, IPv6Domain) {
const uint8 ipv6_addr[] = { 0x20, 0x01, 0x0d, 0xb8, 0x87, 0x14, 0x3a, 0x90,
0x00, 0x00, 0x00, 0x00, 0x00, 0x000, 0x00, 0x12 };
- host_resolver_->rules()->AddRule(hostname, "2001:db8:8714:3a90::12");
-
- AddressList address_list;
- HostResolver::RequestInfo info(hostname, 80);
- int rv = host_resolver_->Resolve(info, &address_list, NULL, NULL);
- if (rv != OK || !address_list.head()) {
- // This machine does not support IPv6. We skip this test altogether.
- // TODO(arindam): create a MockIPv6HostResolver to manually
- // populate the |address_list| in case of a machine with no IPv6 suppport.
- return;
- }
+ host_resolver_->rules()->AddIPv6Rule(hostname, "2001:db8:8714:3a90::12");
std::string request(kSOCKS5IPv6Request,
arraysize(kSOCKS5IPv6Request));
@@ -205,7 +195,7 @@ TEST_F(SOCKS5ClientSocketTest, IPv6Domain) {
user_sock_.reset(BuildMockSocket(data_reads, data_writes, hostname, 80));
- rv = user_sock_->Connect(&callback_);
+ int rv = user_sock_->Connect(&callback_);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback_.WaitForResult();
EXPECT_EQ(OK, rv);
diff --git a/net/socket/socks_client_socket_unittest.cc b/net/socket/socks_client_socket_unittest.cc
index 3d7fa85..32eb725 100644
--- a/net/socket/socks_client_socket_unittest.cc
+++ b/net/socket/socks_client_socket_unittest.cc
@@ -253,7 +253,7 @@ TEST_F(SOCKSClientSocketTest, SOCKS4AFailedDNS) {
TEST_F(SOCKSClientSocketTest, SOCKS4AIfDomainInIPv6) {
const char hostname[] = "an.ipv6.address";
- host_resolver_->rules()->AddRule(hostname, "2001:db8:8714:3a90::12");
+ host_resolver_->rules()->AddIPv6Rule(hostname, "2001:db8:8714:3a90::12");
std::string request(kSOCKS4aInitialRequest,
arraysize(kSOCKS4aInitialRequest));