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

Side by Side Diff: chrome/test/data/extensions/api_test/preference/onchange/test.js

Issue 9244005: Move the `privacy` extension API out of experimental. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: License. Created 8 years, 11 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) 2012 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 // Content settings API test 5 // Content settings API test
6 // Run with browser_tests --gtest_filter=ExtensionApiTest.PreferenceOnChange 6 // Run with browser_tests --gtest_filter=ExtensionApiTest.PreferenceOnChange
7 7
8 // Listen until |event| has fired with all of the values in |expected|. 8 // Listen until |event| has fired with all of the values in |expected|.
9 function listenUntil(event, expected) { 9 function listenUntil(event, expected) {
10 var done = chrome.test.listenForever(event, function(value) { 10 var done = chrome.test.listenForever(event, function(value) {
11 for (var i = 0; i < expected.length; i++) { 11 for (var i = 0; i < expected.length; i++) {
12 if (chrome.test.checkDeepEq(expected[i], value)) { 12 if (chrome.test.checkDeepEq(expected[i], value)) {
13 expected.splice(i, 1); 13 expected.splice(i, 1);
14 if (expected.length == 0) 14 if (expected.length == 0)
15 done(); 15 done();
16 return; 16 return;
17 } 17 }
18 } 18 }
19 chrome.test.fail("Unexpected event: " + JSON.stringify(value)); 19 chrome.test.fail("Unexpected event: " + JSON.stringify(value));
20 }); 20 });
21 } 21 }
22 22
23 var pw = chrome.experimental.privacy.websites; 23 var pw = chrome.privacy.websites;
24 chrome.test.runTests([ 24 chrome.test.runTests([
25 function changeDefault() { 25 function changeDefault() {
26 // Changing the regular settings when no incognito-specific settings are 26 // Changing the regular settings when no incognito-specific settings are
27 // defined should fire two events. 27 // defined should fire two events.
28 listenUntil(pw.thirdPartyCookiesAllowed.onChange, [{ 28 listenUntil(pw.thirdPartyCookiesAllowed.onChange, [{
29 'value': false, 29 'value': false,
30 'levelOfControl': 'controlled_by_this_extension' 30 'levelOfControl': 'controlled_by_this_extension'
31 }, 31 },
32 { 32 {
33 'value': false, 33 'value': false,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 'levelOfControl': 'controllable_by_this_extension' 87 'levelOfControl': 'controllable_by_this_extension'
88 }, 88 },
89 { 89 {
90 'value': true, 90 'value': true,
91 'incognitoSpecific': false, 91 'incognitoSpecific': false,
92 'levelOfControl': 'controllable_by_this_extension' 92 'levelOfControl': 'controllable_by_this_extension'
93 }]); 93 }]);
94 pw.thirdPartyCookiesAllowed.clear({}, chrome.test.callbackPass()); 94 pw.thirdPartyCookiesAllowed.clear({}, chrome.test.callbackPass());
95 } 95 }
96 ]); 96 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698