| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // proxy api test | 5 // proxy api test |
| 6 // browser_tests.exe --gtest_filter=ProxySettingsApiTest.ProxyPacData | 6 // browser_tests.exe --gtest_filter=ProxySettingsApiTest.ProxyPacData |
| 7 | 7 |
| 8 function expect(expected, message) { | 8 function expect(expected, message) { |
| 9 return chrome.test.callbackPass(function(value) { | 9 return chrome.test.callbackPass(function(value) { |
| 10 chrome.test.assertEq(expected, value, message); | 10 chrome.test.assertEq(expected, value, message); |
| 11 }); | 11 }); |
| 12 } | 12 } |
| 13 | 13 |
| 14 chrome.test.runTests([ | 14 chrome.test.runTests([ |
| 15 function setAutoSettings() { | 15 function setAutoSettings() { |
| 16 var pacScriptObject = { | 16 var pacScriptObject = { |
| 17 data: "function FindProxyForURL(url, host) {\n" + | 17 data: "function FindProxyForURL(url, host) {\n" + |
| 18 " if (host == 'foobar.com')\n" + | 18 " if (host == 'foobar.com')\n" + |
| 19 " return 'PROXY blackhole:80';\n" + | 19 " return 'PROXY blackhole:80';\n" + |
| 20 " return 'DIRECT';\n" + | 20 " return 'DIRECT';\n" + |
| 21 "}" | 21 "}", |
| 22 mandatory: false |
| 22 }; | 23 }; |
| 23 var config = { | 24 var config = { |
| 24 mode: "pac_script", | 25 mode: "pac_script", |
| 25 pacScript: pacScriptObject | 26 pacScript: pacScriptObject |
| 26 }; | 27 }; |
| 27 chrome.experimental.proxy.settings.set( | 28 chrome.experimental.proxy.settings.set( |
| 28 {'value': config}, | 29 {'value': config}, |
| 29 chrome.test.callbackPass()); | 30 chrome.test.callbackPass()); |
| 30 chrome.experimental.proxy.settings.get( | 31 chrome.experimental.proxy.settings.get( |
| 31 {'incognito': false}, | 32 {'incognito': false}, |
| 32 expect({ 'value': config, | 33 expect({ 'value': config, |
| 33 'levelOfControl': "ControlledByThisExtension" }, | 34 'levelOfControl': "ControlledByThisExtension" }, |
| 34 "invalid proxy settings")); | 35 "invalid proxy settings")); |
| 35 } | 36 } |
| 36 ]); | 37 ]); |
| OLD | NEW |