Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / proxy / bypass / test.js
blob8896c699f9d8412919503c47529d77b36ef817a6
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // proxy api test
6 // browser_tests.exe --gtest_filter=ProxySettingsApiTest.ProxyBypass
8 function expect(expected, message) {
9 return chrome.test.callbackPass(function(value) {
10 chrome.test.assertEq(expected, value, message);
11 });
14 var httpProxy = {
15 host: "1.1.1.1"
17 var httpProxyExpected = {
18 scheme: "http",
19 host: "1.1.1.1",
20 port: 80
23 var rules = {
24 proxyForHttp: httpProxy,
25 bypassList: ["localhost", "::1", "foo.bar", "<local>"]
27 var rulesExpected = {
28 proxyForHttp: httpProxyExpected,
29 bypassList: ["localhost", "::1", "foo.bar", "<local>"]
32 var config = { rules: rules, mode: "fixed_servers" };
33 var configExpected = { rules: rulesExpected, mode: "fixed_servers" };
35 chrome.test.runTests([
36 // Verify that execution has started to make sure flaky timeouts are not
37 // caused by us.
38 function verifyTestsHaveStarted() {
39 chrome.test.succeed();
41 function setIndividualProxies() {
42 chrome.proxy.settings.set(
43 {'value': config},
44 chrome.test.callbackPass());
46 function verifyRegular() {
47 chrome.proxy.settings.get(
48 {'incognito': false},
49 expect({ 'value': configExpected,
50 'levelOfControl': "controlled_by_this_extension" },
51 "invalid proxy settings"));
53 function verifyIncognito() {
54 chrome.proxy.settings.get(
55 {'incognito': true},
56 expect({ 'value': configExpected,
57 'incognitoSpecific': false,
58 'levelOfControl': "controlled_by_this_extension" },
59 "invalid proxy settings"));
61 ]);