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

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: add copyright to JS file 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..6c080a72a743aa98343ffb991efae19b41729349 100644
--- a/net/proxy/proxy_resolver_v8_unittest.cc
+++ b/net/proxy/proxy_resolver_v8_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -546,5 +546,28 @@ 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;
+ result = resolver.GetProxyForURL(
+ GURL("http://[abcd::efff]:99/watsupdawg"), &proxy_info,
+ CompletionCallback(), NULL, BoundNetLog());
+
+ 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