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

Unified Diff: net/proxy/proxy_resolver_v8_unittest.cc

Issue 9383010: Strip brackets from IPv6 host literals before passing down to PAC script. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/proxy/proxy_resolver_v8.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/proxy/proxy_resolver_v8.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698