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

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

Issue 8757010: Move another block of extension tests to manifest_version 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 <script> 1 <!--
2 // Content settings API test 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this
3 // Run with browser_tests --gtest_filter=ExtensionApiTest.PreferenceOnChange 3 * source code is governed by a BSD-style license that can be found in the
4 4 * LICENSE file.
5 // Listen until |event| has fired with all of the values in |expected|. 5 -->
6 function listenUntil(event, expected) { 6 <script src="test.js"></script>
7 var done = chrome.test.listenForever(event, function(value) {
8 for (var i = 0; i < expected.length; i++) {
9 if (chrome.test.checkDeepEq(expected[i], value)) {
10 expected.splice(i, 1);
11 if (expected.length == 0)
12 done();
13 return;
14 }
15 }
16 chrome.test.fail("Unexpected event: " + JSON.stringify(value));
17 });
18 }
19
20 var pw = chrome.experimental.privacy.websites;
21 chrome.test.runTests([
22 function changeDefault() {
23 // Changing the regular settings when no incognito-specific settings are
24 // defined should fire two events.
25 listenUntil(pw.thirdPartyCookiesAllowed.onChange, [{
26 'value': false,
27 'levelOfControl': 'controlled_by_this_extension'
28 },
29 {
30 'value': false,
31 'incognitoSpecific': false,
32 'levelOfControl': 'controlled_by_this_extension'
33 }]);
34 pw.thirdPartyCookiesAllowed.set({
35 'value':false
36 }, chrome.test.callbackPass());
37 },
38 function changeIncognitoOnly() {
39 listenUntil(pw.thirdPartyCookiesAllowed.onChange, [{
40 'value': true,
41 'incognitoSpecific': true,
42 'levelOfControl': 'controlled_by_this_extension'
43 }]);
44 pw.thirdPartyCookiesAllowed.set({
45 'value': true,
46 'scope': 'incognito_persistent'
47 }, chrome.test.callbackPass());
48 },
49 function changeDefaultOnly() {
50 listenUntil(pw.thirdPartyCookiesAllowed.onChange, [{
51 'value': true,
52 'levelOfControl': 'controlled_by_this_extension'
53 }]);
54 pw.thirdPartyCookiesAllowed.set({
55 'value': true
56 }, chrome.test.callbackPass());
57 },
58 function changeIncognitoOnlyBack() {
59 // Change the incognito setting back to false so that we get an event when
60 // clearing the value.
61 listenUntil(pw.thirdPartyCookiesAllowed.onChange, [{
62 'value': false,
63 'incognitoSpecific': true,
64 'levelOfControl': 'controlled_by_this_extension'
65 }]);
66 pw.thirdPartyCookiesAllowed.set({
67 'value': false,
68 'scope': 'incognito_persistent'
69 }, chrome.test.callbackPass());
70 },
71 function clearIncognito() {
72 listenUntil(pw.thirdPartyCookiesAllowed.onChange, [{
73 'value': true,
74 'incognitoSpecific': false,
75 'levelOfControl': 'controlled_by_this_extension'
76 }]);
77 pw.thirdPartyCookiesAllowed.clear({
78 'scope': 'incognito_persistent'
79 }, chrome.test.callbackPass());
80 },
81 function clearDefault() {
82 listenUntil(pw.thirdPartyCookiesAllowed.onChange, [{
83 'value': true,
84 'levelOfControl': 'controllable_by_this_extension'
85 },
86 {
87 'value': true,
88 'incognitoSpecific': false,
89 'levelOfControl': 'controllable_by_this_extension'
90 }]);
91 pw.thirdPartyCookiesAllowed.clear({}, chrome.test.callbackPass());
92 }
93 ]);
94
95 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698