Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / proxy / individual / test.js
blobd2d39aa4cd796908ad8367f2ca8eb2669c4ee67c
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.ProxyFixedIndividual
8 function expect(expected, message) {
9 return chrome.test.callbackPass(function(value) {
10 chrome.test.assertEq(expected, value, message);
11 });
14 var httpProxy = {
15 scheme: "quic",
16 host: "1.1.1.1"
18 var httpProxyExpected = {
19 scheme: "quic",
20 host: "1.1.1.1",
21 port: 443
23 var httpsProxy = {
24 host: "2.2.2.2"
26 var httpsProxyExpected = {
27 scheme: "http",
28 host: "2.2.2.2",
29 port: 80
31 var ftpProxy = {
32 host: "3.3.3.3",
33 port: 9000
35 var ftpProxyExpected = {
36 scheme: "http", // this is added.
37 host: "3.3.3.3",
38 port: 9000
40 var fallbackProxy = {
41 scheme: "socks4",
42 host: "4.4.4.4",
43 port: 9090
45 var fallbackProxyExpected = fallbackProxy;
47 var rules = {
48 proxyForHttp: httpProxy,
49 proxyForHttps: httpsProxy,
50 proxyForFtp: ftpProxy,
51 fallbackProxy: fallbackProxy,
53 var rulesExpected = {
54 proxyForHttp: httpProxyExpected,
55 proxyForHttps: httpsProxyExpected,
56 proxyForFtp: ftpProxyExpected,
57 fallbackProxy: fallbackProxyExpected,
60 var config = { rules: rules, mode: "fixed_servers" };
61 var configExpected = { rules: rulesExpected, mode: "fixed_servers" };
63 chrome.test.runTests([
64 // Verify that execution has started to make sure flaky timeouts are not
65 // caused by us.
66 function verifyTestsHaveStarted() {
67 chrome.test.succeed();
69 function setIndividualProxies() {
70 chrome.proxy.settings.set(
71 {'value': config},
72 chrome.test.callbackPass());
74 function verifyRegular() {
75 chrome.proxy.settings.get(
76 {'incognito': false},
77 expect({ 'value': configExpected,
78 'levelOfControl': "controlled_by_this_extension" },
79 "invalid proxy settings"));
81 function verifyIncognito() {
82 chrome.proxy.settings.get(
83 {'incognito': true},
84 expect({ 'value': configExpected,
85 'incognitoSpecific': false,
86 'levelOfControl': "controlled_by_this_extension" },
87 "invalid proxy settings"));
89 ]);