summaryrefslogtreecommitdiffstats
path: root/net/data/proxy_resolver_v8_unittest
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-26 23:51:28 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-26 23:51:28 +0000
commit21f20c8940b8b9f06b04ff142716201a2530f0a3 (patch)
treed68fcccc003b0c7edb4ce7620f2270fb608d4022 /net/data/proxy_resolver_v8_unittest
parent13d54f79c040c2e6beeed94e096d1fcf2b0f7101 (diff)
downloadchromium_src-21f20c8940b8b9f06b04ff142716201a2530f0a3.zip
chromium_src-21f20c8940b8b9f06b04ff142716201a2530f0a3.tar.gz
chromium_src-21f20c8940b8b9f06b04ff142716201a2530f0a3.tar.bz2
Add three of the six extensions to PAC that Internet Explorer supports.
The following descriptions were taken from <http://blogs.msdn.com/wndp/articles/IPV6_PAC_Extensions_v0_9.aspx> ---------------------------- * myIpAddressEx(): Returns a semi-colon delimited string containing all IP addresses for localhost (IPv6 and/or IPv4), or an empty string if unable to resolve localhost to an IP address. * dnsResolveEx(host): Returns semi-colon delimited string containing IPv6 and IPv4 addresses or an empty string if host is not resolvable. * isResolvableEx(): Returns TRUE if the host is resolvable to a IPv4 or IPv6 address, FALSE otherwise. ---------------------------- These differ from the vanilla PAC functions in the following ways: * myIpAddressEx() returns all the addrsses for localhost (including IPv6 ones), whereas myIpAddress() only returns the first IPv4 one. * On failure, myIpAddress() returns "127.0.0.1" whereas on failure myIpAddressEx() returns empty string. * dnsResolveEx() returns a list of addresses (including IPV6 ones), whereas dnsResolve() only returns the first IPv4 address. * On failure, dnsResolve() returns |null|, whereas on failure dnsResolveEx() returns empty string. BUG=25407 TEST=ProxyResolverV8Test.DNSResolutionFailure, ProxyResolverJSBindingsTest.RestrictAddressFamily, ProxyResolverJSBindingsTest.ExFunctionsReturnList Review URL: http://codereview.chromium.org/333006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30127 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/data/proxy_resolver_v8_unittest')
-rw-r--r--net/data/proxy_resolver_v8_unittest/bindings.js9
-rw-r--r--net/data/proxy_resolver_v8_unittest/dns_fail.js27
2 files changed, 35 insertions, 1 deletions
diff --git a/net/data/proxy_resolver_v8_unittest/bindings.js b/net/data/proxy_resolver_v8_unittest/bindings.js
index 0e748c1..3026569 100644
--- a/net/data/proxy_resolver_v8_unittest/bindings.js
+++ b/net/data/proxy_resolver_v8_unittest/bindings.js
@@ -35,10 +35,17 @@ function FindProxyForURL(url, host) {
alert(e);
}
- // Call myIpAddress() with wonky arguments
+ // Call myIpAddress() with wonky arguments
myIpAddress(null);
myIpAddress(null, null);
+ // Call myIpAddressEx() correctly (no arguments).
+ myIpAddressEx();
+
+ // Call dnsResolveEx() (note that isResolvableEx() implicity calls it.)
+ isResolvableEx("is_resolvable");
+ dnsResolveEx("foobar");
+
return "DIRECT";
}
diff --git a/net/data/proxy_resolver_v8_unittest/dns_fail.js b/net/data/proxy_resolver_v8_unittest/dns_fail.js
new file mode 100644
index 0000000..c71bcc3
--- /dev/null
+++ b/net/data/proxy_resolver_v8_unittest/dns_fail.js
@@ -0,0 +1,27 @@
+// This script should be run in an environment where all DNS resolution are
+// failing. It tests that functions return the expected values.
+//
+// Returns "PROXY success:80" on success.
+function FindProxyForURL(url, host) {
+ try {
+ expectEq("127.0.0.1", myIpAddress());
+ expectEq("", myIpAddressEx());
+
+ expectEq(null, dnsResolve("not-found"));
+ expectEq("", dnsResolveEx("not-found"));
+
+ expectEq(false, isResolvable("not-found"));
+ expectEq(false, isResolvableEx("not-found"));
+
+ return "PROXY success:80";
+ } catch(e) {
+ alert(e);
+ return "PROXY failed:80";
+ }
+}
+
+function expectEq(expected, actual) {
+ if (expected != actual)
+ throw "Expected " + expected + " but was " + actual;
+}
+