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

Unified Diff: chrome/browser/extensions/extension_content_settings_apitest.cc

Issue 6480033: Implement experimental.contentSettings.misc.blockThirdPartyCookies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 9 years, 10 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 | « no previous file | chrome/browser/extensions/extension_function_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_content_settings_apitest.cc
diff --git a/chrome/browser/extensions/extension_content_settings_apitest.cc b/chrome/browser/extensions/extension_content_settings_apitest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5757702d45ad4006229da5649d689a19626819e4
--- /dev/null
+++ b/chrome/browser/extensions/extension_content_settings_apitest.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/extension_apitest.h"
+#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/pref_names.h"
+
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableExperimentalExtensionApis);
+
+ PrefService* pref_service = browser()->profile()->GetPrefs();
+ pref_service->SetBoolean(prefs::kBlockThirdPartyCookies, true);
+
+ EXPECT_TRUE(RunExtensionTest("content_settings/standard")) << message_;
+
+ const PrefService::Preference* pref = pref_service->FindPreference(
+ prefs::kBlockThirdPartyCookies);
+ ASSERT_TRUE(pref);
+ EXPECT_TRUE(pref->IsExtensionControlled());
+ EXPECT_EQ(false, pref_service->GetBoolean(prefs::kBlockThirdPartyCookies));
+}
+
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoContentSettings) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableExperimentalExtensionApis);
+
+ PrefService* prefs = browser()->profile()->GetPrefs();
+ prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false);
+
+ EXPECT_TRUE(RunExtensionTest("content_settings/incognito")) << message_;
+
+ // Setting an incognito preference should not create an incognito profile.
+ EXPECT_FALSE(browser()->profile()->HasOffTheRecordProfile());
+
+ PrefService* otr_prefs =
+ browser()->profile()->GetOffTheRecordProfile()->GetPrefs();
+ const PrefService::Preference* pref =
+ otr_prefs->FindPreference(prefs::kBlockThirdPartyCookies);
+ ASSERT_TRUE(pref);
+ EXPECT_TRUE(pref->IsExtensionControlled());
+ EXPECT_EQ(true, otr_prefs->GetBoolean(prefs::kBlockThirdPartyCookies));
+
+ pref = prefs->FindPreference(prefs::kBlockThirdPartyCookies);
+ ASSERT_TRUE(pref);
+ EXPECT_FALSE(pref->IsExtensionControlled());
+ EXPECT_EQ(false, prefs->GetBoolean(prefs::kBlockThirdPartyCookies));
+}
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_function_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698