OLD | NEW |
1 <script> | 1 <!-- |
2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this |
3 // Use of this source code is governed by a BSD-style license that can be | 3 * source code is governed by a BSD-style license that can be found in the |
4 // found in the LICENSE file. | 4 * LICENSE file. |
5 | 5 --> |
6 // proxy api test | 6 <script src="parse_error.js"></script> |
7 // browser_tests.exe --gtest_filter=ProxySettingsApiTest.ProxyEventsParseError | |
8 | |
9 var expected_error = { | |
10 error: "net::ERR_PAC_SCRIPT_FAILED", | |
11 details: "line: 1: Uncaught SyntaxError: Unexpected token !", | |
12 fatal: false | |
13 }; | |
14 | |
15 function test() { | |
16 // Install error handler and get the test server config. | |
17 chrome.proxy.onProxyError.addListener(function (error) { | |
18 chrome.test.assertEq(expected_error, error); | |
19 chrome.test.notifyPass(); | |
20 }); | |
21 | |
22 // Set an invalid PAC script. This should trigger a proxy errors. | |
23 var config = { | |
24 mode: "pac_script", | |
25 pacScript: { | |
26 data: "trash!", | |
27 mandatory: false | |
28 } | |
29 }; | |
30 chrome.proxy.settings.set({'value': config}, testDone); | |
31 } | |
32 | |
33 function testDone() { | |
34 // Do nothing. The test success/failure is decided in the event handler. | |
35 } | |
36 | |
37 test(); | |
38 </script> | |
OLD | NEW |