OLD | NEW |
1 <script> | 1 <script> |
2 // Content settings API test | 2 // Content settings API test |
3 // Run with browser_tests --gtest_filter=ExtensionApiTest.IncognitoContentSettin
gs | 3 // Run with browser_tests --gtest_filter=ExtensionApiTest.IncognitoContentSettin
gs |
4 | 4 |
5 var cs = chrome.experimental.contentSettings; | 5 var cs = chrome.experimental.contentSettings; |
6 function expect(expected, message) { | 6 function expect(expected, message) { |
7 return chrome.test.callbackPass(function(value) { | 7 return chrome.test.callbackPass(function(value) { |
8 chrome.test.assertNoLastError(); | 8 chrome.test.assertNoLastError(); |
9 chrome.test.assertEq(expected, value, message); | 9 chrome.test.assertEq(expected, value, message); |
10 }); | 10 }); |
11 } | 11 } |
12 chrome.test.runTests([ | 12 chrome.test.runTests([ |
13 function getRegular() { | 13 function getRegular() { |
14 cs.misc.blockThirdPartyCookies.get( | 14 cs.misc.blockThirdPartyCookies.get( |
15 {}, | 15 {}, |
16 expect({ 'value': false, | 16 expect({ 'value': false, |
17 'levelOfControl': "ControllableByThisExtension" }, | 17 'levelOfControl': "ControllableByThisExtension" }, |
18 "third-party cookies should not be blocked")); | 18 "third-party cookies should not be blocked")); |
19 }, | 19 }, |
20 function getIncognito() { | 20 function getIncognito() { |
21 cs.misc.blockThirdPartyCookies.get( | 21 cs.misc.blockThirdPartyCookies.get( |
22 { 'incognito': true }, | 22 { 'incognito': true }, |
23 expect({ 'value': false, | 23 expect({ 'value': false, |
24 'incognitoSpecific': false, | 24 'incognitoSpecific': false, |
25 'levelOfControl': "ControllableByThisExtension" }, | 25 'levelOfControl': "ControllableByThisExtension" }, |
26 "third-party cookies should not be blocked in incognito mode")); | 26 "third-party cookies should not be blocked in incognito mode")); |
27 }, | 27 }, |
| 28 // TODO(battre): re-enable when incognito preferences are available again. |
| 29 /* |
28 function set() { | 30 function set() { |
29 cs.misc.blockThirdPartyCookies.set( | 31 cs.misc.blockThirdPartyCookies.set( |
30 { 'incognito': true, 'value': true }, chrome.test.callbackPass()); | 32 { 'incognito': true, 'value': true }, chrome.test.callbackPass()); |
31 }, | 33 }, |
32 function getRegular2() { | 34 function getRegular2() { |
33 cs.misc.blockThirdPartyCookies.get( | 35 cs.misc.blockThirdPartyCookies.get( |
34 {}, | 36 {}, |
35 expect({ 'value': false, | 37 expect({ 'value': false, |
36 'levelOfControl': "ControllableByThisExtension" }, | 38 'levelOfControl': "ControllableByThisExtension" }, |
37 "third-party cookies should not be blocked")); | 39 "third-party cookies should not be blocked")); |
38 }, | 40 }, |
39 function getIncognito2() { | 41 function getIncognito2() { |
40 cs.misc.blockThirdPartyCookies.get( | 42 cs.misc.blockThirdPartyCookies.get( |
41 { 'incognito': true }, | 43 { 'incognito': true }, |
42 expect({ 'value': true, | 44 expect({ 'value': true, |
43 'incognitoSpecific': true, | 45 'incognitoSpecific': true, |
44 'levelOfControl': "ControlledByThisExtension" }, | 46 'levelOfControl': "ControlledByThisExtension" }, |
45 "third-party cookies should be blocked in incognito mode")); | 47 "third-party cookies should be blocked in incognito mode")); |
46 }, | 48 }, |
| 49 */ |
47 ]); | 50 ]); |
48 </script> | 51 </script> |
OLD | NEW |