summaryrefslogtreecommitdiffstats
path: root/net/data
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-02 21:45:18 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-02 21:45:18 +0000
commit50d7d7283db42b531a9df9c6f5a34b8526d4d5b0 (patch)
tree6d29abd0b0a82a658a9a526e37279a26a636142e /net/data
parente97cdd5e81a3f8c3bd735ab1e7d264c36c2c3870 (diff)
downloadchromium_src-50d7d7283db42b531a9df9c6f5a34b8526d4d5b0.zip
chromium_src-50d7d7283db42b531a9df9c6f5a34b8526d4d5b0.tar.gz
chromium_src-50d7d7283db42b531a9df9c6f5a34b8526d4d5b0.tar.bz2
Add js bindings layer for ProxyResolverV8 {"alert()", "dnsResolve()", "myIpAddress" <-- [partial]}.
Also adds a utility function to net_util for turning a addrinfo into an IP address string. BUG=2764 Review URL: http://codereview.chromium.org/31009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10730 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/data')
-rw-r--r--net/data/proxy_resolver_v8_unittest/bindings.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/net/data/proxy_resolver_v8_unittest/bindings.js b/net/data/proxy_resolver_v8_unittest/bindings.js
new file mode 100644
index 0000000..0e748c1
--- /dev/null
+++ b/net/data/proxy_resolver_v8_unittest/bindings.js
@@ -0,0 +1,46 @@
+// Try calling the browser-side bound functions with varying (invalid)
+// inputs. There is no notion of "success" for this test, other than
+// verifying the correct C++ bindings were reached with expected values.
+
+function MyObject() {
+ this.x = "3";
+}
+
+MyObject.prototype.toString = function() {
+ throw "exception from calling toString()";
+}
+
+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");
+
+ // Call alert with some wonky arguments.
+ alert();
+ alert(null);
+ alert(undefined);
+ alert({foo:'bar'});
+
+ // This should throw an exception when we toString() the argument
+ // to alert in the bindings.
+ try {
+ alert(new MyObject());
+ } catch (e) {
+ alert(e);
+ }
+
+ // Call myIpAddress() with wonky arguments
+ myIpAddress(null);
+ myIpAddress(null, null);
+
+ return "DIRECT";
+}
+
+function fn() {}
+