OLD | NEW |
(Empty) | |
| 1 // This script should be run in an environment where all DNS resolution are |
| 2 // failing. It tests that functions return the expected values. |
| 3 // |
| 4 // Returns "PROXY success:80" on success. |
| 5 function FindProxyForURL(url, host) { |
| 6 try { |
| 7 expectEq("127.0.0.1", myIpAddress()); |
| 8 expectEq("", myIpAddressEx()); |
| 9 |
| 10 expectEq(null, dnsResolve("not-found")); |
| 11 expectEq("", dnsResolveEx("not-found")); |
| 12 |
| 13 expectEq(false, isResolvable("not-found")); |
| 14 expectEq(false, isResolvableEx("not-found")); |
| 15 |
| 16 return "PROXY success:80"; |
| 17 } catch(e) { |
| 18 alert(e); |
| 19 return "PROXY failed:80"; |
| 20 } |
| 21 } |
| 22 |
| 23 function expectEq(expected, actual) { |
| 24 if (expected != actual) |
| 25 throw "Expected " + expected + " but was " + actual; |
| 26 } |
| 27 |
OLD | NEW |