OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 // proxy api test |
| 6 // browser_tests.exe --gtest_filter=ProxySettingsApiTest.ProxyEventsParseError |
| 7 |
| 8 var expected_error = { |
| 9 error: "net::ERR_PAC_SCRIPT_FAILED", |
| 10 details: "line: 1: Uncaught SyntaxError: Unexpected token !", |
| 11 fatal: false |
| 12 }; |
| 13 |
| 14 function test() { |
| 15 // Install error handler and get the test server config. |
| 16 chrome.proxy.onProxyError.addListener(function (error) { |
| 17 chrome.test.assertEq(expected_error, error); |
| 18 chrome.test.notifyPass(); |
| 19 }); |
| 20 |
| 21 // Set an invalid PAC script. This should trigger a proxy errors. |
| 22 var config = { |
| 23 mode: "pac_script", |
| 24 pacScript: { |
| 25 data: "trash!", |
| 26 mandatory: false |
| 27 } |
| 28 }; |
| 29 chrome.proxy.settings.set({'value': config}, testDone); |
| 30 } |
| 31 |
| 32 function testDone() { |
| 33 // Do nothing. The test success/failure is decided in the event handler. |
| 34 } |
| 35 |
| 36 test(); |
OLD | NEW |