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>2010-05-05 20:04:34 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-05 20:04:34 +0000
commitd35c36649f96c03db3cb99ec7c4cccb39f65edf7 (patch)
tree290a27869510d4665c0780117fa5b3bfcfd23885 /net/data/proxy_resolver_v8_unittest
parentffdb96f586bb5604ba21bf5931e4c6c2f4ba6c78 (diff)
downloadchromium_src-d35c36649f96c03db3cb99ec7c4cccb39f65edf7.zip
chromium_src-d35c36649f96c03db3cb99ec7c4cccb39f65edf7.tar.gz
chromium_src-d35c36649f96c03db3cb99ec7c4cccb39f65edf7.tar.bz2
Change the V8 proxy resolver bindings so that dnsResolve(XXX) returns null when XXX is not a string.
(The current behavior is to stringize XXX). This is consistent with other browsers. BUG=42646 TEST=ProxyResolverV8Test.V8indings Review URL: http://codereview.chromium.org/1954004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46487 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/data/proxy_resolver_v8_unittest')
-rw-r--r--net/data/proxy_resolver_v8_unittest/bindings.js25
1 files changed, 17 insertions, 8 deletions
diff --git a/net/data/proxy_resolver_v8_unittest/bindings.js b/net/data/proxy_resolver_v8_unittest/bindings.js
index 3026569..7cf9f26 100644
--- a/net/data/proxy_resolver_v8_unittest/bindings.js
+++ b/net/data/proxy_resolver_v8_unittest/bindings.js
@@ -10,16 +10,25 @@ MyObject.prototype.toString = function() {
throw "exception from calling toString()";
}
+function expectEquals(expectation, actual) {
+ if (!(expectation === actual)) {
+ throw "FAIL: expected: " + expectation + ", actual: " + actual;
+ }
+}
+
function FindProxyForURL(url, host) {
// Call dnsResolve with some wonky arguments.
- dnsResolve();
- dnsResolve(null);
- dnsResolve(undefined);
- dnsResolve("");
- dnsResolve({foo: 'bar'});
- dnsResolve(fn);
- dnsResolve(['3']);
- dnsResolve("arg1", "arg2", "arg3", "arg4");
+ // Those expected to fail (because we have passed a non-string parameter)
+ // will return |null|, whereas those that have called through to the C++
+ // bindings will return '127.0.0.1'.
+ expectEquals(null, dnsResolve());
+ expectEquals(null, dnsResolve(null));
+ expectEquals(null, dnsResolve(undefined));
+ expectEquals('127.0.0.1', dnsResolve(""));
+ expectEquals(null, dnsResolve({foo: 'bar'}));
+ expectEquals(null, dnsResolve(fn));
+ expectEquals(null, dnsResolve(['3']));
+ expectEquals('127.0.0.1', dnsResolve("arg1", "arg2", "arg3", "arg4"));
// Call alert with some wonky arguments.
alert();