OLD | NEW |
1 <script> | 1 <script> |
2 // Content settings API test | 2 // Content settings API test |
3 // Run with browser_tests --gtest_filter=ExtensionApiTest.ContentSettingsOnChang
e | 3 // Run with browser_tests --gtest_filter=ExtensionApiTest.ContentSettingsOnChang
e |
4 | 4 |
5 // Listen until |event| has fired with all of the values in |expected|. | 5 // Listen until |event| has fired with all of the values in |expected|. |
6 function listenUntil(event, expected) { | 6 function listenUntil(event, expected) { |
7 var done = chrome.test.listenForever(event, function(value) { | 7 var done = chrome.test.listenForever(event, function(value) { |
8 for (var i = 0; i < expected.length; i++) { | 8 for (var i = 0; i < expected.length; i++) { |
9 if (chrome.test.checkDeepEq(expected[i], value)) { | 9 if (chrome.test.checkDeepEq(expected[i], value)) { |
10 expected.splice(i, 1); | 10 expected.splice(i, 1); |
(...skipping 17 matching lines...) Expand all Loading... |
28 }, | 28 }, |
29 { | 29 { |
30 'value': true, | 30 'value': true, |
31 'incognitoSpecific': false, | 31 'incognitoSpecific': false, |
32 'levelOfControl': 'ControlledByThisExtension' | 32 'levelOfControl': 'ControlledByThisExtension' |
33 }]); | 33 }]); |
34 cs.misc.blockThirdPartyCookies.set({ | 34 cs.misc.blockThirdPartyCookies.set({ |
35 'value':true | 35 'value':true |
36 }, chrome.test.callbackPass()); | 36 }, chrome.test.callbackPass()); |
37 }, | 37 }, |
| 38 // TODO(battre): re-enable when incognito is available again. |
| 39 /* |
38 function changeIncognitoOnly() { | 40 function changeIncognitoOnly() { |
39 listenUntil(cs.misc.blockThirdPartyCookies.onChange, [{ | 41 listenUntil(cs.misc.blockThirdPartyCookies.onChange, [{ |
40 'value': false, | 42 'value': false, |
41 'incognitoSpecific': true, | 43 'incognitoSpecific': true, |
42 'levelOfControl': 'ControlledByThisExtension' | 44 'levelOfControl': 'ControlledByThisExtension' |
43 }]); | 45 }]); |
44 cs.misc.blockThirdPartyCookies.set({ | 46 cs.misc.blockThirdPartyCookies.set({ |
45 'value': false, | 47 'value': false, |
46 'incognito': true | 48 'incognito': true |
47 }, chrome.test.callbackPass()); | 49 }, chrome.test.callbackPass()); |
48 }, | 50 }, |
| 51 */ |
49 function changeDefaultOnly() { | 52 function changeDefaultOnly() { |
50 listenUntil(cs.misc.blockThirdPartyCookies.onChange, [{ | 53 listenUntil(cs.misc.blockThirdPartyCookies.onChange, [{ |
51 'value': false, | 54 'value': false, |
52 'levelOfControl': 'ControlledByThisExtension' | 55 'levelOfControl': 'ControlledByThisExtension' |
53 }]); | 56 }]); |
54 cs.misc.blockThirdPartyCookies.set({ | 57 cs.misc.blockThirdPartyCookies.set({ |
55 'value': false | 58 'value': false |
56 }, chrome.test.callbackPass()); | 59 }, chrome.test.callbackPass()); |
57 }, | 60 }, |
| 61 // TODO(battre): re-enable when incognito is available again. |
| 62 /* |
58 function changeIncognitoOnlyBack() { | 63 function changeIncognitoOnlyBack() { |
59 // Change the incognito setting back to true so that we get an event when | 64 // Change the incognito setting back to true so that we get an event when |
60 // clearing the value. | 65 // clearing the value. |
61 listenUntil(cs.misc.blockThirdPartyCookies.onChange, [{ | 66 listenUntil(cs.misc.blockThirdPartyCookies.onChange, [{ |
62 'value': true, | 67 'value': true, |
63 'incognitoSpecific': true, | 68 'incognitoSpecific': true, |
64 'levelOfControl': 'ControlledByThisExtension' | 69 'levelOfControl': 'ControlledByThisExtension' |
65 }]); | 70 }]); |
66 cs.misc.blockThirdPartyCookies.set({ | 71 cs.misc.blockThirdPartyCookies.set({ |
67 'value': true, | 72 'value': true, |
68 'incognito': true | 73 'incognito': true |
69 }, chrome.test.callbackPass()); | 74 }, chrome.test.callbackPass()); |
70 }, | 75 }, |
71 function clearIncognito() { | 76 function clearIncognito() { |
72 listenUntil(cs.misc.blockThirdPartyCookies.onChange, [{ | 77 listenUntil(cs.misc.blockThirdPartyCookies.onChange, [{ |
73 'value': false, | 78 'value': false, |
74 'incognitoSpecific': false, | 79 'incognitoSpecific': false, |
75 'levelOfControl': 'ControlledByThisExtension' | 80 'levelOfControl': 'ControlledByThisExtension' |
76 }]); | 81 }]); |
77 cs.misc.blockThirdPartyCookies.clear({ | 82 cs.misc.blockThirdPartyCookies.clear({ |
78 'incognito': true | 83 'incognito': true |
79 }, chrome.test.callbackPass()); | 84 }, chrome.test.callbackPass()); |
80 }, | 85 }, |
| 86 */ |
81 function clearDefault() { | 87 function clearDefault() { |
82 listenUntil(cs.misc.blockThirdPartyCookies.onChange, [{ | 88 listenUntil(cs.misc.blockThirdPartyCookies.onChange, [{ |
83 'value': false, | 89 'value': false, |
84 'levelOfControl': 'ControllableByThisExtension' | 90 'levelOfControl': 'ControllableByThisExtension' |
85 }, | 91 }, |
86 { | 92 { |
87 'value': false, | 93 'value': false, |
88 'incognitoSpecific': false, | 94 'incognitoSpecific': false, |
89 'levelOfControl': 'ControllableByThisExtension' | 95 'levelOfControl': 'ControllableByThisExtension' |
90 }]); | 96 }]); |
91 cs.misc.blockThirdPartyCookies.clear({}, chrome.test.callbackPass()); | 97 cs.misc.blockThirdPartyCookies.clear({}, chrome.test.callbackPass()); |
92 } | 98 } |
93 ]); | 99 ]); |
94 | 100 |
95 </script> | 101 </script> |
OLD | NEW |