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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/proxy/proxy_resolver_v8.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
mmenke 2012/02/10 20:53:50 nit: Update date.
eroman 2012/02/10 21:03:53 Done.
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 "base/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 // before passing it onto the bindings layer. 539 // before passing it onto the bindings layer.
540 MockJSBindings* bindings = resolver.mock_js_bindings(); 540 MockJSBindings* bindings = resolver.mock_js_bindings();
541 541
542 ASSERT_EQ(1u, bindings->dns_resolves.size()); 542 ASSERT_EQ(1u, bindings->dns_resolves.size());
543 EXPECT_EQ("xn--bcher-kva.ch", bindings->dns_resolves[0]); 543 EXPECT_EQ("xn--bcher-kva.ch", bindings->dns_resolves[0]);
544 544
545 ASSERT_EQ(1u, bindings->dns_resolves_ex.size()); 545 ASSERT_EQ(1u, bindings->dns_resolves_ex.size());
546 EXPECT_EQ("xn--bcher-kva.ch", bindings->dns_resolves_ex[0]); 546 EXPECT_EQ("xn--bcher-kva.ch", bindings->dns_resolves_ex[0]);
547 } 547 }
548 548
549 // Test that when resolving a URL which contains an IPv6 string literal, the
550 // brackets are removed from the host before passing it down to the PAC script.
551 // If we don't do this, then subsequent calls to dnsResolveEx(host) will be
552 // doomed to fail since it won't correspond with a valid name.
553 TEST(ProxyResolverV8Test, IPv6HostnamesNotBracketed) {
554 ProxyResolverV8WithMockBindings resolver;
555 int result = resolver.SetPacScriptFromDisk("resolve_host.js");
556 EXPECT_EQ(OK, result);
557
558 ProxyInfo proxy_info;
559 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 :-)
560 result = resolver.GetProxyForURL(
561 GURL("http://[abcd::efff]:99/watsupdawg"), &proxy_info,
562 CompletionCallback(), NULL, log.bound());
563
564 EXPECT_EQ(OK, result);
565 EXPECT_TRUE(proxy_info.is_direct());
566
567 // We called dnsResolveEx() exactly once, by passing through the "host"
568 // argument to FindProxyForURL(). The brackets should have been stripped.
569 ASSERT_EQ(1U, resolver.mock_js_bindings()->dns_resolves_ex.size());
570 EXPECT_EQ("abcd::efff", resolver.mock_js_bindings()->dns_resolves_ex[0]);
571 }
572
549 } // namespace 573 } // namespace
550 } // namespace net 574 } // namespace net
OLDNEW
« 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