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

Unified Diff: chrome/test/data/extensions/api_test/content_settings/session_only_incognito/test.html

Issue 7067040: Enable incognito_session_only preferences (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/extensions/api_test/content_settings/session_only_incognito/manifest.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/content_settings/session_only_incognito/test.html
diff --git a/chrome/test/data/extensions/api_test/content_settings/session_only_incognito/test.html b/chrome/test/data/extensions/api_test/content_settings/session_only_incognito/test.html
new file mode 100644
index 0000000000000000000000000000000000000000..3fac32a78e1b00d087185baff7ff019aebb9d8ae
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/content_settings/session_only_incognito/test.html
@@ -0,0 +1,82 @@
+<script>
+// Content settings API test
+// Run with browser_tests --gtest_filter=ExtensionApiTest.SessionOnlyIncognitoContentSettings
+
+var cs = chrome.experimental.contentSettings;
+function expect(expected, message) {
+ return chrome.test.callbackPass(function(value) {
+ chrome.test.assertNoLastError();
+ chrome.test.assertEq(expected, value, message);
+ });
+}
+chrome.test.runTests([
+ function getRegular() {
+ cs.misc.blockThirdPartyCookies.get(
+ {},
+ expect({ 'value': false,
+ 'levelOfControl': "ControllableByThisExtension" },
+ "third-party cookies should not be blocked"));
+ },
+ function getIncognito() {
+ cs.misc.blockThirdPartyCookies.get(
+ { 'incognito': true },
+ expect({ 'value': false,
+ 'incognitoSpecific': false,
+ 'levelOfControl': "ControllableByThisExtension" },
+ "third-party cookies should not be blocked in incognito mode"));
+ },
+ function set() {
+ cs.misc.blockThirdPartyCookies.set(
+ { 'scope': 'incognito_persistent', 'value': true },
+ chrome.test.callbackPass());
+ },
+ function getRegular2() {
+ cs.misc.blockThirdPartyCookies.get(
+ {},
+ expect({ 'value': false,
+ 'levelOfControl': "ControllableByThisExtension" },
+ "third-party cookies should not be blocked"));
+ },
+ function getIncognito2() {
+ cs.misc.blockThirdPartyCookies.get(
+ { 'incognito': true },
+ expect({ 'value': true,
+ 'incognitoSpecific': true,
+ 'levelOfControl': "ControlledByThisExtension" },
+ "third-party cookies should be blocked in incognito mode"));
+ },
+ // We cannot set session_only_persistent preferences if there is no incognito
+ // session.
+ function set2() {
+ cs.misc.blockThirdPartyCookies.set(
+ { 'scope': 'incognito_session_only', 'value': false },
+ chrome.test.callbackFail("You cannot set a preference with scope " +
+ "'incognito_session_only' when no incognito " +
+ "window is open."));
+ },
+ function openIncognito() {
+ chrome.windows.create({incognito: true}, chrome.test.callbackPass());
+ },
+ // session_only_persistent overrides incognito_persistent.
+ function set3() {
+ cs.misc.blockThirdPartyCookies.set(
+ { 'scope': 'incognito_session_only', 'value': false },
+ chrome.test.callbackPass());
+ },
+ function getRegular3() {
+ cs.misc.blockThirdPartyCookies.get(
+ {},
+ expect({ 'value': false,
+ 'levelOfControl': "ControllableByThisExtension" },
+ "third-party cookies should not be blocked"));
+ },
+ function getIncognito3() {
+ cs.misc.blockThirdPartyCookies.get(
+ { 'incognito': true },
+ expect({ 'value': false,
+ 'incognitoSpecific': true,
+ 'levelOfControl': "ControlledByThisExtension" },
+ "third-party cookies should be blocked in incognito mode"));
+ },
+]);
+</script>
« no previous file with comments | « chrome/test/data/extensions/api_test/content_settings/session_only_incognito/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698