Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: chrome/test/data/extensions/api_test/proxy/events/test.js

Issue 6992022: Move Proxy Settings API out of experimental (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed remainder of merge conflict. Fixes unit test Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.ProxyEvents 6 // browser_tests.exe --gtest_filter=ProxySettingsApiTest.ProxyEvents
7 7
8 var captured_events = []; 8 var captured_events = [];
9 var expected_events = [ 9 var expected_events = [
10 { 10 {
11 error: "net::ERR_PROXY_CONNECTION_FAILED", 11 error: "net::ERR_PROXY_CONNECTION_FAILED",
12 details: "", 12 details: "",
13 fatal: true 13 fatal: true
14 }, 14 },
15 { 15 {
16 error: "net::ERR_PROXY_CONNECTION_FAILED", 16 error: "net::ERR_PROXY_CONNECTION_FAILED",
17 details: "", 17 details: "",
18 fatal: true 18 fatal: true
19 }, 19 },
20 { 20 {
21 error: "net::ERR_PAC_SCRIPT_FAILED", 21 error: "net::ERR_PAC_SCRIPT_FAILED",
22 details: "line: 1: Uncaught SyntaxError: Unexpected token !", 22 details: "line: 1: Uncaught SyntaxError: Unexpected token !",
23 fatal: false 23 fatal: false
24 } 24 }
25 ]; 25 ];
26 26
27 chrome.experimental.proxy.onProxyError.addListener(function (error) { 27 chrome.proxy.onProxyError.addListener(function (error) {
28 captured_events.push(error); 28 captured_events.push(error);
29 if (captured_events.length < expected_events.length) 29 if (captured_events.length < expected_events.length)
30 return; 30 return;
31 chrome.test.assertEq(expected_events, captured_events); 31 chrome.test.assertEq(expected_events, captured_events);
32 chrome.test.notifyPass(); 32 chrome.test.notifyPass();
33 }); 33 });
34 34
35 function pacTest(e) { 35 function pacTest(e) {
36 var config = { 36 var config = {
37 mode: "pac_script", 37 mode: "pac_script",
38 pacScript: { 38 pacScript: {
39 data: "trash!", 39 data: "trash!",
40 mandatory: false 40 mandatory: false
41 } 41 }
42 }; 42 };
43 chrome.experimental.proxy.settings.set({'value': config}); 43 chrome.proxy.settings.set({'value': config});
44 } 44 }
45 45
46 var rules = { 46 var rules = {
47 singleProxy: { host: "does.not.exist" } 47 singleProxy: { host: "does.not.exist" }
48 }; 48 };
49 49
50 var config = { rules: rules, mode: "fixed_servers" }; 50 var config = { rules: rules, mode: "fixed_servers" };
51 chrome.experimental.proxy.settings.set({'value': config}, function () { 51 chrome.proxy.settings.set({'value': config}, function () {
52 var req = new XMLHttpRequest(); 52 var req = new XMLHttpRequest();
53 req.open("GET", "http://127.0.0.1/", true); 53 req.open("GET", "http://127.0.0.1/", true);
54 req.onload = function () { 54 req.onload = function () {
55 chrome.test.notifyFail("proxy settings should not work"); 55 chrome.test.notifyFail("proxy settings should not work");
56 } 56 }
57 req.onerror = pacTest; 57 req.onerror = pacTest;
58 req.send(null); 58 req.send(null);
59 }); 59 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698