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

Side by Side Diff: chrome/browser/extensions/extension_content_settings_apitest.cc

Issue 6773006: Add enableReferrers and enableHyperlinkAuditing to contentSettings.misc API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try Created 9 years, 8 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_apitest.h" 5 #include "chrome/browser/extensions/extension_apitest.h"
6 #include "chrome/browser/prefs/pref_service.h" 6 #include "chrome/browser/prefs/pref_service.h"
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
11 11
12 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) { 12 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) {
13 CommandLine::ForCurrentProcess()->AppendSwitch( 13 CommandLine::ForCurrentProcess()->AppendSwitch(
14 switches::kEnableExperimentalExtensionApis); 14 switches::kEnableExperimentalExtensionApis);
15 15
16 PrefService* pref_service = browser()->profile()->GetPrefs(); 16 PrefService* pref_service = browser()->profile()->GetPrefs();
17 pref_service->SetBoolean(prefs::kBlockThirdPartyCookies, true); 17 pref_service->SetBoolean(prefs::kBlockThirdPartyCookies, true);
18 pref_service->SetBoolean(prefs::kEnableReferrers, false);
18 19
19 EXPECT_TRUE(RunExtensionTest("content_settings/standard")) << message_; 20 EXPECT_TRUE(RunExtensionTest("content_settings/standard")) << message_;
20 21
21 const PrefService::Preference* pref = pref_service->FindPreference( 22 const PrefService::Preference* pref = pref_service->FindPreference(
22 prefs::kBlockThirdPartyCookies); 23 prefs::kBlockThirdPartyCookies);
23 ASSERT_TRUE(pref); 24 ASSERT_TRUE(pref);
24 EXPECT_TRUE(pref->IsExtensionControlled()); 25 EXPECT_TRUE(pref->IsExtensionControlled());
25 EXPECT_FALSE(pref_service->GetBoolean(prefs::kBlockThirdPartyCookies)); 26 EXPECT_FALSE(pref_service->GetBoolean(prefs::kBlockThirdPartyCookies));
27 EXPECT_TRUE(pref_service->GetBoolean(prefs::kEnableReferrers));
jam 2011/04/04 23:36:32 nit: what is this testing?
Bernhard Bauer 2011/04/05 07:26:14 The test extension reads the preference value and
26 } 28 }
27 29
28 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoContentSettings) { 30 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoContentSettings) {
29 CommandLine::ForCurrentProcess()->AppendSwitch( 31 CommandLine::ForCurrentProcess()->AppendSwitch(
30 switches::kEnableExperimentalExtensionApis); 32 switches::kEnableExperimentalExtensionApis);
31 33
32 PrefService* prefs = browser()->profile()->GetPrefs(); 34 PrefService* prefs = browser()->profile()->GetPrefs();
33 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false); 35 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false);
34 36
35 EXPECT_TRUE(RunExtensionTestIncognito("content_settings/incognito")) << 37 EXPECT_TRUE(RunExtensionTestIncognito("content_settings/incognito")) <<
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettingsOnChange) { 80 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettingsOnChange) {
79 CommandLine::ForCurrentProcess()->AppendSwitch( 81 CommandLine::ForCurrentProcess()->AppendSwitch(
80 switches::kEnableExperimentalExtensionApis); 82 switches::kEnableExperimentalExtensionApis);
81 83
82 PrefService* prefs = browser()->profile()->GetPrefs(); 84 PrefService* prefs = browser()->profile()->GetPrefs();
83 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false); 85 prefs->SetBoolean(prefs::kBlockThirdPartyCookies, false);
84 86
85 EXPECT_TRUE(RunExtensionTestIncognito("content_settings/onchange")) << 87 EXPECT_TRUE(RunExtensionTestIncognito("content_settings/onchange")) <<
86 message_; 88 message_;
87 } 89 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_preference_api.cc » ('j') | chrome/browser/prefs/pref_member.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698