Chromium Code Reviews| Index: net/proxy/proxy_resolver_v8_unittest.cc |
| diff --git a/net/proxy/proxy_resolver_v8_unittest.cc b/net/proxy/proxy_resolver_v8_unittest.cc |
| index 9782bb171f0ed529f564fbc8358f8d116ba4b21f..efa41e99162e5b66c6f1da51888c8c8f55fac578 100644 |
| --- a/net/proxy/proxy_resolver_v8_unittest.cc |
| +++ b/net/proxy/proxy_resolver_v8_unittest.cc |
| @@ -546,5 +546,29 @@ TEST(ProxyResolverV8Test, DNSResolutionOfInternationDomainName) { |
| EXPECT_EQ("xn--bcher-kva.ch", bindings->dns_resolves_ex[0]); |
| } |
| +// Test that when resolving a URL which contains an IPv6 string literal, the |
| +// brackets are removed from the host before passing it down to the PAC script. |
| +// If we don't do this, then subsequent calls to dnsResolveEx(host) will be |
| +// doomed to fail since it won't correspond with a valid name. |
| +TEST(ProxyResolverV8Test, IPv6HostnamesNotBracketed) { |
| + ProxyResolverV8WithMockBindings resolver; |
| + int result = resolver.SetPacScriptFromDisk("resolve_host.js"); |
| + EXPECT_EQ(OK, result); |
| + |
| + ProxyInfo proxy_info; |
| + CapturingBoundNetLog log(CapturingNetLog::kUnbounded); |
|
mmenke
2012/02/10 20:53:50
Doesn't seem to be any reason not to just use a Bo
eroman
2012/02/10 21:03:53
Done. I had copy-pasted this without thinking :-)
|
| + result = resolver.GetProxyForURL( |
| + GURL("http://[abcd::efff]:99/watsupdawg"), &proxy_info, |
| + CompletionCallback(), NULL, log.bound()); |
| + |
| + EXPECT_EQ(OK, result); |
| + EXPECT_TRUE(proxy_info.is_direct()); |
| + |
| + // We called dnsResolveEx() exactly once, by passing through the "host" |
| + // argument to FindProxyForURL(). The brackets should have been stripped. |
| + ASSERT_EQ(1U, resolver.mock_js_bindings()->dns_resolves_ex.size()); |
| + EXPECT_EQ("abcd::efff", resolver.mock_js_bindings()->dns_resolves_ex[0]); |
| +} |
| + |
| } // namespace |
| } // namespace net |