| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 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 Loading... |
| 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 result = resolver.GetProxyForURL( |
| 560 GURL("http://[abcd::efff]:99/watsupdawg"), &proxy_info, |
| 561 CompletionCallback(), NULL, BoundNetLog()); |
| 562 |
| 563 EXPECT_EQ(OK, result); |
| 564 EXPECT_TRUE(proxy_info.is_direct()); |
| 565 |
| 566 // We called dnsResolveEx() exactly once, by passing through the "host" |
| 567 // argument to FindProxyForURL(). The brackets should have been stripped. |
| 568 ASSERT_EQ(1U, resolver.mock_js_bindings()->dns_resolves_ex.size()); |
| 569 EXPECT_EQ("abcd::efff", resolver.mock_js_bindings()->dns_resolves_ex[0]); |
| 570 } |
| 571 |
| 549 } // namespace | 572 } // namespace |
| 550 } // namespace net | 573 } // namespace net |
| OLD | NEW |