summaryrefslogtreecommitdiffstats
path: root/net/data
diff options
context:
space:
mode:
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() {}
+