1 // Try calling the browser-side bound functions with varying (invalid)
2 // inputs. There is no notion of "success" for this test, other than
3 // verifying the correct C++ bindings were reached with expected values.
9 MyObject.prototype.toString = function() {
10 throw "exception from calling toString()";
13 function expectEquals(expectation, actual) {
14 if (!(expectation === actual)) {
15 throw "FAIL: expected: " + expectation + ", actual: " + actual;
19 function FindProxyForURL(url, host) {
20 // Call dnsResolve with some wonky arguments.
21 // Those expected to fail (because we have passed a non-string parameter)
22 // will return |null|, whereas those that have called through to the C++
23 // bindings will return '127.0.0.1'.
24 expectEquals(null, dnsResolve());
25 expectEquals(null, dnsResolve(null));
26 expectEquals(null, dnsResolve(undefined));
27 expectEquals('127.0.0.1', dnsResolve(""));
28 expectEquals(null, dnsResolve({foo: 'bar'}));
29 expectEquals(null, dnsResolve(fn));
30 expectEquals(null, dnsResolve(['3']));
31 expectEquals('127.0.0.1', dnsResolve("arg1", "arg2", "arg3", "arg4"));
33 // Call alert with some wonky arguments.
39 // This should throw an exception when we toString() the argument
40 // to alert in the bindings.
42 alert(new MyObject());
47 // Call myIpAddress() with wonky arguments
49 myIpAddress(null, null);
51 // Call myIpAddressEx() correctly (no arguments).
54 // Call dnsResolveEx() (note that isResolvableEx() implicity calls it.)
55 isResolvableEx("is_resolvable");
56 dnsResolveEx("foobar");