Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / proxy / pacdata / test.js
blobbc0b0c410cf591dd58518747dfab19b71c38d8dc
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.ProxyPacData
8 function expect(expected, message) {
9 return chrome.test.callbackPass(function(value) {
10 chrome.test.assertEq(expected, value, message);
11 });
14 var pacScriptObject = {
15 data: "function FindProxyForURL(url, host) {\n" +
16 " if (host == 'foobar.com')\n" +
17 " return 'PROXY blackhole:80';\n" +
18 " return 'DIRECT';\n" +
19 "}",
20 mandatory: false
22 var config = {
23 mode: "pac_script",
24 pacScript: pacScriptObject
27 chrome.test.runTests([
28 // Verify that execution has started to make sure flaky timeouts are not
29 // caused by us.
30 function verifyTestsHaveStarted() {
31 chrome.test.succeed();
33 function setAutoSettings() {
34 chrome.proxy.settings.set(
35 {'value': config},
36 chrome.test.callbackPass());
38 function verifySettings() {
39 chrome.proxy.settings.get(
40 {'incognito': false},
41 expect({ 'value': config,
42 'levelOfControl': "controlled_by_this_extension" },
43 "invalid proxy settings"));
45 ]);