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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_function_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/extension_apitest.h"
6 #include "chrome/browser/prefs/pref_service.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/common/pref_names.h"
11
12 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) {
13 CommandLine::ForCurrentProcess()->AppendSwitch(
14 switches::kEnableExperimentalExtensionApis);
15
16 PrefService* pref_service = browser()->profile()->GetPrefs();
17 pref_service->SetBoolean(prefs::kBlockThirdPartyCookies, true);
18
19 EXPECT_TRUE(RunExtensionTest("content_settings/standard")) << message_;
20
21 const PrefService::Preference* pref = pref_service->FindPreference(
22 prefs::kBlockThirdPartyCookies);
23 ASSERT_TRUE(pref);
24 EXPECT_TRUE(pref->IsExtensionControlled());
25 EXPECT_EQ(false, pref_service->GetBoolean(prefs::kBlockThirdPartyCookies));
26 }
27
28 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoContentSettings) {
29 CommandLine::ForCurrentProcess()->AppendSwitch(
30 switches::kEnableExperimentalExtensionApis);
31
32 PrefService* prefs = browser()->profile()->GetPrefs();
33 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false);
34
35 EXPECT_TRUE(RunExtensionTest("content_settings/incognito")) << message_;
36
37 // Setting an incognito preference should not create an incognito profile.
38 EXPECT_FALSE(browser()->profile()->HasOffTheRecordProfile());
39
40 PrefService* otr_prefs =
41 browser()->profile()->GetOffTheRecordProfile()->GetPrefs();
42 const PrefService::Preference* pref =
43 otr_prefs->FindPreference(prefs::kBlockThirdPartyCookies);
44 ASSERT_TRUE(pref);
45 EXPECT_TRUE(pref->IsExtensionControlled());
46 EXPECT_EQ(true, otr_prefs->GetBoolean(prefs::kBlockThirdPartyCookies));
47
48 pref = prefs->FindPreference(prefs::kBlockThirdPartyCookies);
49 ASSERT_TRUE(pref);
50 EXPECT_FALSE(pref->IsExtensionControlled());
51 EXPECT_EQ(false, prefs->GetBoolean(prefs::kBlockThirdPartyCookies));
52 }
OLDNEW
« 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