Explicitly add python-numpy dependency to install-build-deps.
[chromium-blink-merge.git] / net / data / proxy_resolver_v8_unittest / bindings.js
blob7cf9f2634653885e77709fcd3437f3667f4388b4
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.
5 function MyObject() {
6 this.x = "3";
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.
34 alert();
35 alert(null);
36 alert(undefined);
37 alert({foo:'bar'});
39 // This should throw an exception when we toString() the argument
40 // to alert in the bindings.
41 try {
42 alert(new MyObject());
43 } catch (e) {
44 alert(e);
47 // Call myIpAddress() with wonky arguments
48 myIpAddress(null);
49 myIpAddress(null, null);
51 // Call myIpAddressEx() correctly (no arguments).
52 myIpAddressEx();
54 // Call dnsResolveEx() (note that isResolvableEx() implicity calls it.)
55 isResolvableEx("is_resolvable");
56 dnsResolveEx("foobar");
58 return "DIRECT";
61 function fn() {}