summaryrefslogtreecommitdiff
path: root/chromium/net/data/proxy_resolver_v8_unittest/dns_fail.js
blob: c71bcc38304a95d4ace32adf4f7aba6487b8f359 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// This script should be run in an environment where all DNS resolution are
// failing. It tests that functions return the expected values.
//
// Returns "PROXY success:80" on success.
function FindProxyForURL(url, host) {
  try {
    expectEq("127.0.0.1", myIpAddress());
    expectEq("", myIpAddressEx());

    expectEq(null, dnsResolve("not-found"));
    expectEq("", dnsResolveEx("not-found"));

    expectEq(false, isResolvable("not-found"));
    expectEq(false, isResolvableEx("not-found"));

    return "PROXY success:80";
  } catch(e) {
    alert(e);
    return "PROXY failed:80";
  }
}

function expectEq(expected, actual) {
  if (expected != actual)
    throw "Expected " + expected + " but was " + actual;
}