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