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

Unified Diff: chrome/browser/content_settings/host_content_settings_map_unittest.cc

Issue 2039803002: Unregister Images, Plugins and Mouselock content settings on android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@only_register_platform_used_contentsettingtypes
Patch Set: Created 4 years, 6 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
Index: chrome/browser/content_settings/host_content_settings_map_unittest.cc
diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
index 1532e97e05c277bbe8f931f0b235ccf1b60acab3..81198a918686f2f2bf2670573c41953475002a26 100644
--- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc
+++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
@@ -98,7 +98,7 @@ class TesterForType {
host_content_settings_map_->GetWebsiteSetting(
url, url, content_type_, std::string(), &setting_info);
return setting_info.source;
- };
+ }
private:
syncable_prefs::TestingPrefServiceSyncable* prefs_;
@@ -119,15 +119,15 @@ TEST_F(HostContentSettingsMapTest, DefaultValues) {
host_content_settings_map->GetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_JAVASCRIPT, NULL));
host_content_settings_map->SetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK);
+ CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_IMAGES, NULL));
- EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting(
- GURL(chrome::kChromeUINewTabURL),
- GURL(chrome::kChromeUINewTabURL),
- CONTENT_SETTINGS_TYPE_IMAGES,
- std::string()));
+ CONTENT_SETTINGS_TYPE_JAVASCRIPT, NULL));
+ EXPECT_EQ(
+ CONTENT_SETTING_ALLOW,
+ host_content_settings_map->GetContentSetting(
+ GURL(chrome::kChromeUINewTabURL), GURL(chrome::kChromeUINewTabURL),
+ CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
#if defined(ENABLE_PLUGINS)
host_content_settings_map->SetDefaultContentSetting(
@@ -166,25 +166,26 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
GURL host("http://example.com/");
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
host_content_settings_map->SetContentSettingDefaultScope(
- host, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
CONTENT_SETTING_DEFAULT);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
host_content_settings_map->SetContentSettingDefaultScope(
- host, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
#if defined(ENABLE_PLUGINS)
EXPECT_EQ(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT,
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string()));
#endif
+#if !defined(OS_ANDROID)
// Check returning all settings for a host.
host_content_settings_map->SetContentSettingDefaultScope(
host, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
@@ -192,6 +193,7 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+#endif
raymes 2016/06/07 01:40:44 Maybe we can just remove this? The only coverage i
lshang 2016/06/07 06:39:59 Done.
host_content_settings_map->SetContentSettingDefaultScope(
host, GURL(), CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(),
CONTENT_SETTING_BLOCK);
@@ -219,9 +221,11 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
EXPECT_EQ(CONTENT_SETTING_ASK,
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string()));
+#if !defined(OS_ANDROID)
EXPECT_EQ(CONTENT_SETTING_ASK,
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()));
+#endif
raymes 2016/06/07 01:40:44 Same with this one.
lshang 2016/06/07 06:39:59 Done.
host_content_settings_map->SetContentSettingDefaultScope(
host, GURL(), CONTENT_SETTINGS_TYPE_KEYGEN, std::string(),
@@ -240,7 +244,7 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
// Check returning all hosts for a setting.
GURL host2("http://example.org/");
host_content_settings_map->SetContentSettingDefaultScope(
- host2, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host2, GURL(), CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(),
CONTENT_SETTING_BLOCK);
#if defined(ENABLE_PLUGINS)
host_content_settings_map->SetContentSettingDefaultScope(
@@ -249,9 +253,9 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
#endif
ContentSettingsForOneType host_settings;
host_content_settings_map->GetSettingsForOneType(
- CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &host_settings);
- // |host_settings| contains the default setting and an exception.
- EXPECT_EQ(2U, host_settings.size());
+ CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), &host_settings);
+ // |host_settings| contains the default setting and 2 exception.
+ EXPECT_EQ(3U, host_settings.size());
#if defined(ENABLE_PLUGINS)
host_content_settings_map->GetSettingsForOneType(
CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), &host_settings);
@@ -273,10 +277,10 @@ TEST_F(HostContentSettingsMapTest, Clear) {
GURL host("http://example.org/");
GURL host2("http://example.net/");
host_content_settings_map->SetContentSettingDefaultScope(
- host2, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host2, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
CONTENT_SETTING_BLOCK);
host_content_settings_map->SetContentSettingDefaultScope(
- host, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
CONTENT_SETTING_BLOCK);
#if defined(ENABLE_PLUGINS)
host_content_settings_map->SetContentSettingDefaultScope(
@@ -284,13 +288,13 @@ TEST_F(HostContentSettingsMapTest, Clear) {
CONTENT_SETTING_BLOCK);
#endif
host_content_settings_map->SetContentSettingDefaultScope(
- host2, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host2, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
CONTENT_SETTING_BLOCK);
host_content_settings_map->ClearSettingsForOneType(
- CONTENT_SETTINGS_TYPE_IMAGES);
+ CONTENT_SETTINGS_TYPE_COOKIES);
ContentSettingsForOneType host_settings;
host_content_settings_map->GetSettingsForOneType(
- CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &host_settings);
+ CONTENT_SETTINGS_TYPE_COOKIES, std::string(), &host_settings);
// |host_settings| contains only the default setting.
EXPECT_EQ(1U, host_settings.size());
#if defined(ENABLE_PLUGINS)
@@ -311,25 +315,25 @@ TEST_F(HostContentSettingsMapTest, Patterns) {
GURL host3("http://example.org/");
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host1, host1, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
host_content_settings_map->SetContentSettingDefaultScope(
- host1, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host1, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host1, host1, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host2, host2, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host2, host2, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host3, host3, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
host_content_settings_map->SetContentSettingDefaultScope(
- host3, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host3, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host3, host3, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
}
TEST_F(HostContentSettingsMapTest, Observer) {
@@ -343,32 +347,27 @@ TEST_F(HostContentSettingsMapTest, Observer) {
ContentSettingsPattern::FromString("[*.]example.com");
ContentSettingsPattern secondary_pattern =
ContentSettingsPattern::Wildcard();
- EXPECT_CALL(observer,
- OnContentSettingsChanged(host_content_settings_map,
- CONTENT_SETTINGS_TYPE_IMAGES,
- false,
- primary_pattern,
- secondary_pattern,
- false));
+ EXPECT_CALL(observer, OnContentSettingsChanged(host_content_settings_map,
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ false, primary_pattern,
+ secondary_pattern, false));
host_content_settings_map->SetContentSettingDefaultScope(
- host, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
CONTENT_SETTING_ALLOW);
::testing::Mock::VerifyAndClearExpectations(&observer);
- EXPECT_CALL(observer,
- OnContentSettingsChanged(host_content_settings_map,
- CONTENT_SETTINGS_TYPE_IMAGES, false,
- _, _, true));
+ EXPECT_CALL(observer, OnContentSettingsChanged(host_content_settings_map,
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ false, _, _, true));
host_content_settings_map->ClearSettingsForOneType(
- CONTENT_SETTINGS_TYPE_IMAGES);
+ CONTENT_SETTINGS_TYPE_COOKIES);
::testing::Mock::VerifyAndClearExpectations(&observer);
- EXPECT_CALL(observer,
- OnContentSettingsChanged(host_content_settings_map,
- CONTENT_SETTINGS_TYPE_IMAGES, false,
- _, _, true));
+ EXPECT_CALL(observer, OnContentSettingsChanged(host_content_settings_map,
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ false, _, _, true));
host_content_settings_map->SetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK);
+ CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_BLOCK);
}
TEST_F(HostContentSettingsMapTest, ObserveDefaultPref) {
@@ -380,25 +379,25 @@ TEST_F(HostContentSettingsMapTest, ObserveDefaultPref) {
GURL host("http://example.com");
host_content_settings_map->SetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK);
+ CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
const content_settings::WebsiteSettingsInfo* info =
content_settings::WebsiteSettingsRegistry::GetInstance()->Get(
- CONTENT_SETTINGS_TYPE_IMAGES);
+ CONTENT_SETTINGS_TYPE_COOKIES);
// Clearing the backing pref should also clear the internal cache.
prefs->ClearPref(info->default_value_pref_name());
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
// Reseting the pref to its previous value should update the cache.
prefs->SetInteger(info->default_value_pref_name(), CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
}
TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) {
@@ -410,7 +409,7 @@ TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) {
// Make a copy of the default pref value so we can reset it later.
std::unique_ptr<base::Value> default_value(
- prefs->FindPreference(GetPrefName(CONTENT_SETTINGS_TYPE_IMAGES))
+ prefs->FindPreference(GetPrefName(CONTENT_SETTINGS_TYPE_COOKIES))
->GetValue()
->DeepCopy());
@@ -418,32 +417,32 @@ TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) {
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
host_content_settings_map->SetContentSettingDefaultScope(
- host, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
// Make a copy of the pref's new value so we can reset it later.
std::unique_ptr<base::Value> new_value(
- prefs->FindPreference(GetPrefName(CONTENT_SETTINGS_TYPE_IMAGES))
+ prefs->FindPreference(GetPrefName(CONTENT_SETTINGS_TYPE_COOKIES))
->GetValue()
->DeepCopy());
// Clearing the backing pref should also clear the internal cache.
- prefs->Set(GetPrefName(CONTENT_SETTINGS_TYPE_IMAGES), *default_value);
+ prefs->Set(GetPrefName(CONTENT_SETTINGS_TYPE_COOKIES), *default_value);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
// Reseting the pref to its previous value should update the cache.
- prefs->Set(GetPrefName(CONTENT_SETTINGS_TYPE_IMAGES), *new_value);
+ prefs->Set(GetPrefName(CONTENT_SETTINGS_TYPE_COOKIES), *new_value);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
}
TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) {
@@ -455,6 +454,7 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) {
GURL host_ending_with_dot("http://example.com./");
+#if !defined(OS_ANDROID)
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
host_ending_with_dot,
@@ -479,6 +479,7 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) {
host_ending_with_dot,
CONTENT_SETTINGS_TYPE_IMAGES,
std::string()));
+#endif
raymes 2016/06/07 01:40:44 nit: likewise we can probably remove this chunk -
lshang 2016/06/07 06:39:59 Done.
EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed(
host_ending_with_dot, host_ending_with_dot));
@@ -619,7 +620,7 @@ TEST_F(HostContentSettingsMapTest, NestedSettings) {
GURL host2("http://b.example.com/");
host_content_settings_map->SetContentSettingDefaultScope(
- host1, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host1, GURL(), CONTENT_SETTINGS_TYPE_POPUPS, std::string(),
CONTENT_SETTING_BLOCK);
host_content_settings_map->SetContentSettingDefaultScope(
@@ -627,7 +628,7 @@ TEST_F(HostContentSettingsMapTest, NestedSettings) {
CONTENT_SETTING_BLOCK);
host_content_settings_map->SetContentSettingDefaultScope(
- host, GURL(), CONTENT_SETTINGS_TYPE_PLUGINS, std::string(),
+ host, GURL(), CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, std::string(),
CONTENT_SETTING_BLOCK);
host_content_settings_map->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK);
@@ -637,16 +638,14 @@ TEST_F(HostContentSettingsMapTest, NestedSettings) {
host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_POPUPS, std::string()));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string()));
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_POPUPS, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS,
+ std::string()));
EXPECT_EQ(CONTENT_SETTING_ASK,
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
@@ -657,9 +656,11 @@ TEST_F(HostContentSettingsMapTest, NestedSettings) {
EXPECT_EQ(CONTENT_SETTING_ASK,
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string()));
+#if !defined(OS_ANDROID)
EXPECT_EQ(CONTENT_SETTING_ASK,
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()));
+#endif
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_KEYGEN, std::string()));
@@ -680,34 +681,34 @@ TEST_F(HostContentSettingsMapTest, OffTheRecord) {
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
EXPECT_EQ(CONTENT_SETTING_ALLOW,
otr_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
// Changing content settings on the main map should also affect the
// incognito map.
host_content_settings_map->SetContentSettingDefaultScope(
- host, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
otr_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
// Changing content settings on the incognito map should NOT affect the
// main map.
otr_map->SetContentSettingDefaultScope(host, GURL(),
- CONTENT_SETTINGS_TYPE_IMAGES,
+ CONTENT_SETTINGS_TYPE_COOKIES,
std::string(), CONTENT_SETTING_ALLOW);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
EXPECT_EQ(CONTENT_SETTING_ALLOW,
otr_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
}
TEST_F(HostContentSettingsMapTest, OffTheRecordPartialInheritPref) {
@@ -908,7 +909,7 @@ TEST_F(HostContentSettingsMapTest, CanonicalizeExceptionsUnicodeOnly) {
// Set utf-8 data.
{
DictionaryPrefUpdate update(prefs,
- GetPrefName(CONTENT_SETTINGS_TYPE_PLUGINS));
+ GetPrefName(CONTENT_SETTINGS_TYPE_COOKIES));
base::DictionaryValue* all_settings_dictionary = update.Get();
ASSERT_TRUE(NULL != all_settings_dictionary);
@@ -921,7 +922,7 @@ TEST_F(HostContentSettingsMapTest, CanonicalizeExceptionsUnicodeOnly) {
HostContentSettingsMapFactory::GetForProfile(&profile);
const base::DictionaryValue* all_settings_dictionary =
- prefs->GetDictionary(GetPrefName(CONTENT_SETTINGS_TYPE_PLUGINS));
+ prefs->GetDictionary(GetPrefName(CONTENT_SETTINGS_TYPE_COOKIES));
const base::DictionaryValue* result = NULL;
EXPECT_FALSE(all_settings_dictionary->GetDictionaryWithoutPathExpansion(
"[*.]\xC4\x87ira.com,*", &result));
@@ -982,6 +983,7 @@ TEST_F(HostContentSettingsMapTest, ManagedDefaultContentSetting) {
host_content_settings_map->GetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_JAVASCRIPT, NULL));
+#if defined(ENABLE_PLUGINS)
// Set preference to manage the default-content-setting for Plugins.
prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting,
new base::FundamentalValue(CONTENT_SETTING_BLOCK));
@@ -989,7 +991,6 @@ TEST_F(HostContentSettingsMapTest, ManagedDefaultContentSetting) {
host_content_settings_map->GetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_PLUGINS, NULL));
-#if defined(ENABLE_PLUGINS)
// Remove the preference to manage the default-content-setting for Plugins.
prefs->RemoveManagedPref(prefs::kManagedDefaultPluginsSetting);
EXPECT_EQ(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT,
@@ -1128,22 +1129,22 @@ TEST_F(HostContentSettingsMapTest, SettingDefaultContentSettingsWhenManaged) {
syncable_prefs::TestingPrefServiceSyncable* prefs =
profile.GetTestingPrefService();
- prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting,
+ prefs->SetManagedPref(prefs::kManagedDefaultCookiesSetting,
new base::FundamentalValue(CONTENT_SETTING_ALLOW));
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_PLUGINS, NULL));
+ CONTENT_SETTINGS_TYPE_COOKIES, NULL));
host_content_settings_map->SetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK);
+ CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_PLUGINS, NULL));
+ CONTENT_SETTINGS_TYPE_COOKIES, NULL));
- prefs->RemoveManagedPref(prefs::kManagedDefaultPluginsSetting);
+ prefs->RemoveManagedPref(prefs::kManagedDefaultCookiesSetting);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_PLUGINS, NULL));
+ CONTENT_SETTINGS_TYPE_COOKIES, NULL));
}
TEST_F(HostContentSettingsMapTest, GetContentSetting) {
@@ -1154,14 +1155,14 @@ TEST_F(HostContentSettingsMapTest, GetContentSetting) {
GURL host("http://example.com/");
GURL embedder("chrome://foo");
host_content_settings_map->SetContentSettingDefaultScope(
- host, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- embedder, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ embedder, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
}
TEST_F(HostContentSettingsMapTest, IsDefaultSettingAllowedForType) {
@@ -1180,19 +1181,17 @@ TEST_F(HostContentSettingsMapTest, AddContentSettingsObserver) {
GURL host("http://example.com/");
ContentSettingsPattern pattern =
ContentSettingsPattern::FromString("[*.]example.com");
- EXPECT_CALL(mock_observer,
- OnContentSettingChanged(pattern,
- ContentSettingsPattern::Wildcard(),
- CONTENT_SETTINGS_TYPE_IMAGES,
- ""));
+ EXPECT_CALL(mock_observer, OnContentSettingChanged(
+ pattern, ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_COOKIES, ""));
host_content_settings_map->AddObserver(&mock_observer);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
host_content_settings_map->SetContentSettingDefaultScope(
- host, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
CONTENT_SETTING_DEFAULT);
}
@@ -1208,20 +1207,20 @@ TEST_F(HostContentSettingsMapTest, GuestProfile) {
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
// Changing content settings should not result in any prefs being stored
// however the value should be set in memory.
host_content_settings_map->SetContentSettingDefaultScope(
- host, GURL(), CONTENT_SETTINGS_TYPE_IMAGES, std::string(),
+ host, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
const base::DictionaryValue* all_settings_dictionary =
profile.GetPrefs()->GetDictionary(
- GetPrefName(CONTENT_SETTINGS_TYPE_IMAGES));
+ GetPrefName(CONTENT_SETTINGS_TYPE_COOKIES));
EXPECT_TRUE(all_settings_dictionary->empty());
}
@@ -1238,14 +1237,14 @@ TEST_F(HostContentSettingsMapTest, GuestProfileDefaultSetting) {
// There are no custom rules, so this should be the default.
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
host_content_settings_map->SetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK);
+ CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
+ host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
}
// We used to incorrectly store content settings in prefs for the guest profile.
@@ -1257,14 +1256,14 @@ TEST_F(HostContentSettingsMapTest, GuestProfileMigration) {
// Set a pref manually in the guest profile.
std::unique_ptr<base::Value> value =
base::JSONReader::Read("{\"[*.]\\xC4\\x87ira.com,*\":{\"setting\":1}}");
- profile.GetPrefs()->Set(GetPrefName(CONTENT_SETTINGS_TYPE_IMAGES), *value);
+ profile.GetPrefs()->Set(GetPrefName(CONTENT_SETTINGS_TYPE_COOKIES), *value);
// Test that during construction all the prefs get cleared.
HostContentSettingsMapFactory::GetForProfile(&profile);
const base::DictionaryValue* all_settings_dictionary =
profile.GetPrefs()->GetDictionary(
- GetPrefName(CONTENT_SETTINGS_TYPE_IMAGES));
+ GetPrefName(CONTENT_SETTINGS_TYPE_COOKIES));
EXPECT_TRUE(all_settings_dictionary->empty());
}

Powered by Google App Engine
This is Rietveld 408576698