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 217ef0c91668ea413239aa91bca022e7dbc87fd9..f6beb6d86091866e6329dd4fb5ebac9874dbced6 100644 |
--- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc |
+++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc |
@@ -107,21 +107,15 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) { |
EXPECT_EQ(CONTENT_SETTING_ALLOW, |
host_content_settings_map->GetContentSetting( |
host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_DEFAULT); |
+ host_content_settings_map->SetContentSettingCustomScope( |
raymes
2016/03/01 06:17:31
Can we use the default scope in some of these case
lshang
2016/03/02 04:02:28
Done.
|
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, |
+ std::string(), CONTENT_SETTING_DEFAULT); |
EXPECT_EQ(CONTENT_SETTING_ALLOW, |
host_content_settings_map->GetContentSetting( |
host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, |
+ std::string(), CONTENT_SETTING_BLOCK); |
EXPECT_EQ(CONTENT_SETTING_BLOCK, |
host_content_settings_map->GetContentSetting( |
host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
@@ -132,31 +126,22 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) { |
#endif |
// Check returning all settings for a host. |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_DEFAULT); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, |
+ std::string(), CONTENT_SETTING_DEFAULT); |
EXPECT_EQ(CONTENT_SETTING_ALLOW, |
host_content_settings_map->GetContentSetting( |
host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), CONTENT_SETTING_BLOCK); |
EXPECT_EQ(CONTENT_SETTING_BLOCK, |
host_content_settings_map->GetContentSetting( |
host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); |
#if defined(ENABLE_PLUGINS) |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_PLUGINS, |
- std::string(), |
- CONTENT_SETTING_ALLOW); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), CONTENT_SETTING_ALLOW); |
EXPECT_EQ(CONTENT_SETTING_ALLOW, |
host_content_settings_map->GetContentSetting( |
host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); |
@@ -177,7 +162,7 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) { |
EXPECT_EQ(CONTENT_SETTING_ASK, |
host_content_settings_map->GetContentSetting( |
host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); |
- host_content_settings_map->SetContentSetting( |
+ host_content_settings_map->SetContentSettingCustomScope( |
pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_KEYGEN, |
std::string(), CONTENT_SETTING_ALLOW); |
EXPECT_EQ(CONTENT_SETTING_ALLOW, |
@@ -187,19 +172,13 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) { |
// Check returning all hosts for a setting. |
ContentSettingsPattern pattern2 = |
ContentSettingsPattern::FromString("[*.]example.org"); |
- host_content_settings_map->SetContentSetting( |
- pattern2, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern2, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_IMAGES, std::string(), CONTENT_SETTING_BLOCK); |
#if defined(ENABLE_PLUGINS) |
- host_content_settings_map->SetContentSetting( |
- pattern2, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_PLUGINS, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern2, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), CONTENT_SETTING_BLOCK); |
#endif |
ContentSettingsForOneType host_settings; |
host_content_settings_map->GetSettingsForOneType( |
@@ -228,32 +207,20 @@ TEST_F(HostContentSettingsMapTest, Clear) { |
ContentSettingsPattern::FromString("[*.]example.org"); |
ContentSettingsPattern pattern2 = |
ContentSettingsPattern::FromString("[*.]example.net"); |
- host_content_settings_map->SetContentSetting( |
- pattern2, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern2, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_IMAGES, std::string(), CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, |
+ std::string(), CONTENT_SETTING_BLOCK); |
#if defined(ENABLE_PLUGINS) |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_PLUGINS, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), CONTENT_SETTING_BLOCK); |
#endif |
- host_content_settings_map->SetContentSetting( |
- pattern2, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern2, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_IMAGES, std::string(), CONTENT_SETTING_BLOCK); |
host_content_settings_map->ClearSettingsForOneType( |
CONTENT_SETTINGS_TYPE_IMAGES); |
ContentSettingsForOneType host_settings; |
@@ -284,12 +251,9 @@ TEST_F(HostContentSettingsMapTest, Patterns) { |
EXPECT_EQ(CONTENT_SETTING_ALLOW, |
host_content_settings_map->GetContentSetting( |
host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern1, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern1, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_IMAGES, std::string(), CONTENT_SETTING_BLOCK); |
EXPECT_EQ(CONTENT_SETTING_BLOCK, |
host_content_settings_map->GetContentSetting( |
host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
@@ -299,12 +263,9 @@ TEST_F(HostContentSettingsMapTest, Patterns) { |
EXPECT_EQ(CONTENT_SETTING_ALLOW, |
host_content_settings_map->GetContentSetting( |
host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern2, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern2, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_IMAGES, std::string(), CONTENT_SETTING_BLOCK); |
EXPECT_EQ(CONTENT_SETTING_BLOCK, |
host_content_settings_map->GetContentSetting( |
host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
@@ -327,12 +288,9 @@ TEST_F(HostContentSettingsMapTest, Observer) { |
primary_pattern, |
secondary_pattern, |
false)); |
- host_content_settings_map->SetContentSetting( |
- primary_pattern, |
- secondary_pattern, |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_ALLOW); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ primary_pattern, secondary_pattern, CONTENT_SETTINGS_TYPE_IMAGES, |
+ std::string(), CONTENT_SETTING_ALLOW); |
::testing::Mock::VerifyAndClearExpectations(&observer); |
EXPECT_CALL(observer, |
@@ -402,12 +360,9 @@ TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) { |
host_content_settings_map->GetContentSetting( |
host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, |
+ std::string(), CONTENT_SETTING_BLOCK); |
EXPECT_EQ(CONTENT_SETTING_BLOCK, |
host_content_settings_map->GetContentSetting( |
host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
@@ -448,24 +403,18 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { |
host_ending_with_dot, |
CONTENT_SETTINGS_TYPE_IMAGES, |
std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_DEFAULT); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, |
+ std::string(), CONTENT_SETTING_DEFAULT); |
EXPECT_EQ( |
CONTENT_SETTING_ALLOW, |
host_content_settings_map->GetContentSetting(host_ending_with_dot, |
host_ending_with_dot, |
CONTENT_SETTINGS_TYPE_IMAGES, |
std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, |
+ std::string(), CONTENT_SETTING_BLOCK); |
EXPECT_EQ( |
CONTENT_SETTING_BLOCK, |
host_content_settings_map->GetContentSetting(host_ending_with_dot, |
@@ -475,20 +424,14 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { |
EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed( |
host_ending_with_dot, host_ending_with_dot)); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_COOKIES, |
- std::string(), |
- CONTENT_SETTING_DEFAULT); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_COOKIES, std::string(), CONTENT_SETTING_DEFAULT); |
EXPECT_TRUE(cookie_settings->IsSettingCookieAllowed( |
host_ending_with_dot, host_ending_with_dot)); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_COOKIES, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_COOKIES, std::string(), CONTENT_SETTING_BLOCK); |
EXPECT_FALSE(cookie_settings->IsSettingCookieAllowed( |
host_ending_with_dot, host_ending_with_dot)); |
@@ -498,24 +441,18 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { |
host_ending_with_dot, |
CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
- std::string(), |
- CONTENT_SETTING_DEFAULT); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), CONTENT_SETTING_DEFAULT); |
EXPECT_EQ(CONTENT_SETTING_ALLOW, |
host_content_settings_map->GetContentSetting( |
host_ending_with_dot, |
host_ending_with_dot, |
CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), CONTENT_SETTING_BLOCK); |
EXPECT_EQ(CONTENT_SETTING_BLOCK, |
host_content_settings_map->GetContentSetting( |
host_ending_with_dot, |
@@ -530,24 +467,18 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { |
host_ending_with_dot, |
CONTENT_SETTINGS_TYPE_PLUGINS, |
std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_PLUGINS, |
- std::string(), |
- CONTENT_SETTING_DEFAULT); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), CONTENT_SETTING_DEFAULT); |
EXPECT_EQ(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, |
host_content_settings_map->GetContentSetting( |
host_ending_with_dot, |
host_ending_with_dot, |
CONTENT_SETTINGS_TYPE_PLUGINS, |
std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_PLUGINS, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), CONTENT_SETTING_BLOCK); |
EXPECT_EQ(CONTENT_SETTING_BLOCK, |
host_content_settings_map->GetContentSetting( |
host_ending_with_dot, |
@@ -562,24 +493,18 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { |
host_ending_with_dot, |
CONTENT_SETTINGS_TYPE_POPUPS, |
std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_POPUPS, |
- std::string(), |
- CONTENT_SETTING_DEFAULT); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_POPUPS, |
+ std::string(), CONTENT_SETTING_DEFAULT); |
EXPECT_EQ( |
CONTENT_SETTING_BLOCK, |
host_content_settings_map->GetContentSetting(host_ending_with_dot, |
host_ending_with_dot, |
CONTENT_SETTINGS_TYPE_POPUPS, |
std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_POPUPS, |
- std::string(), |
- CONTENT_SETTING_ALLOW); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_POPUPS, |
+ std::string(), CONTENT_SETTING_ALLOW); |
EXPECT_EQ( |
CONTENT_SETTING_ALLOW, |
host_content_settings_map->GetContentSetting(host_ending_with_dot, |
@@ -591,14 +516,14 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { |
host_content_settings_map->GetContentSetting( |
host_ending_with_dot, host_ending_with_dot, |
CONTENT_SETTINGS_TYPE_KEYGEN, std::string())); |
- host_content_settings_map->SetContentSetting( |
+ host_content_settings_map->SetContentSettingCustomScope( |
pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_KEYGEN, |
std::string(), CONTENT_SETTING_ALLOW); |
EXPECT_EQ(CONTENT_SETTING_ALLOW, |
host_content_settings_map->GetContentSetting( |
host_ending_with_dot, host_ending_with_dot, |
CONTENT_SETTINGS_TYPE_KEYGEN, std::string())); |
- host_content_settings_map->SetContentSetting( |
+ host_content_settings_map->SetContentSettingCustomScope( |
pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_KEYGEN, |
std::string(), CONTENT_SETTING_DEFAULT); |
EXPECT_EQ(CONTENT_SETTING_BLOCK, |
@@ -620,26 +545,17 @@ TEST_F(HostContentSettingsMapTest, NestedSettings) { |
ContentSettingsPattern pattern3 = |
ContentSettingsPattern::FromString("a.b.example.com"); |
- host_content_settings_map->SetContentSetting( |
- pattern1, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern1, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_IMAGES, std::string(), CONTENT_SETTING_BLOCK); |
- host_content_settings_map->SetContentSetting( |
- pattern2, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_COOKIES, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern2, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_COOKIES, std::string(), CONTENT_SETTING_BLOCK); |
- host_content_settings_map->SetContentSetting( |
- pattern3, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_PLUGINS, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern3, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), CONTENT_SETTING_BLOCK); |
host_content_settings_map->SetDefaultContentSetting( |
CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); |
@@ -697,12 +613,9 @@ TEST_F(HostContentSettingsMapTest, OffTheRecord) { |
// Changing content settings on the main map should also affect the |
// incognito map. |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, |
+ std::string(), CONTENT_SETTING_BLOCK); |
EXPECT_EQ(CONTENT_SETTING_BLOCK, |
host_content_settings_map->GetContentSetting( |
host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
@@ -712,11 +625,9 @@ TEST_F(HostContentSettingsMapTest, OffTheRecord) { |
// Changing content settings on the incognito map should NOT affect the |
// main map. |
- otr_map->SetContentSetting(pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_ALLOW); |
+ otr_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, |
+ std::string(), CONTENT_SETTING_ALLOW); |
EXPECT_EQ(CONTENT_SETTING_BLOCK, |
host_content_settings_map->GetContentSetting( |
host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
@@ -737,8 +648,6 @@ TEST_F(HostContentSettingsMapTest, OffTheRecordPartialInheritPref) { |
HostContentSettingsMapFactory::GetForProfile(otr_profile); |
GURL host("http://example.com/"); |
- ContentSettingsPattern pattern = |
- ContentSettingsPattern::FromURLNoWildcard(host); |
EXPECT_EQ( |
CONTENT_SETTING_ASK, |
@@ -750,11 +659,8 @@ TEST_F(HostContentSettingsMapTest, OffTheRecordPartialInheritPref) { |
host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); |
// BLOCK should be inherited from the main map to the incognito map. |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
- std::string(), |
+ host_content_settings_map->SetContentSettingDefaultScope( |
+ host, GURL(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string(), |
CONTENT_SETTING_BLOCK); |
EXPECT_EQ( |
CONTENT_SETTING_BLOCK, |
@@ -767,11 +673,8 @@ TEST_F(HostContentSettingsMapTest, OffTheRecordPartialInheritPref) { |
// ALLOW should not be inherited from the main map to the incognito map (but |
// it still overwrites the BLOCK, hence incognito reverts to ASK). |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
- std::string(), |
+ host_content_settings_map->SetContentSettingDefaultScope( |
+ host, GURL(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string(), |
CONTENT_SETTING_ALLOW); |
EXPECT_EQ( |
CONTENT_SETTING_ALLOW, |
@@ -1014,12 +917,9 @@ TEST_F(HostContentSettingsMapTest, |
// Set pattern for JavaScript setting. |
ContentSettingsPattern pattern = |
ContentSettingsPattern::FromString("[*.]example.com"); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), CONTENT_SETTING_BLOCK); |
EXPECT_EQ(CONTENT_SETTING_ALLOW, |
host_content_settings_map->GetDefaultContentSetting( |
@@ -1056,12 +956,9 @@ TEST_F(HostContentSettingsMapTest, |
ContentSettingsPattern pattern = |
ContentSettingsPattern::FromString("[*.]example.com"); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
- std::string(), |
- CONTENT_SETTING_ALLOW); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), |
+ CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), CONTENT_SETTING_ALLOW); |
EXPECT_EQ(CONTENT_SETTING_BLOCK, |
host_content_settings_map->GetDefaultContentSetting( |
@@ -1152,12 +1049,9 @@ TEST_F(HostContentSettingsMapTest, GetContentSetting) { |
GURL embedder("chrome://foo"); |
ContentSettingsPattern pattern = |
ContentSettingsPattern::FromString("[*.]example.com"); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_BLOCK); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, |
+ std::string(), CONTENT_SETTING_BLOCK); |
EXPECT_EQ(CONTENT_SETTING_BLOCK, |
host_content_settings_map->GetContentSetting( |
host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
@@ -1193,12 +1087,9 @@ TEST_F(HostContentSettingsMapTest, AddContentSettingsObserver) { |
EXPECT_EQ(CONTENT_SETTING_ALLOW, |
host_content_settings_map->GetContentSetting( |
host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
- host_content_settings_map->SetContentSetting( |
- pattern, |
- ContentSettingsPattern::Wildcard(), |
- CONTENT_SETTINGS_TYPE_IMAGES, |
- std::string(), |
- CONTENT_SETTING_DEFAULT); |
+ host_content_settings_map->SetContentSettingCustomScope( |
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, |
+ std::string(), CONTENT_SETTING_DEFAULT); |
} |
TEST_F(HostContentSettingsMapTest, GuestProfile) { |
@@ -1217,7 +1108,7 @@ TEST_F(HostContentSettingsMapTest, GuestProfile) { |
// Changing content settings should not result in any prefs being stored |
// however the value should be set in memory. |
- host_content_settings_map->SetContentSetting( |
+ host_content_settings_map->SetContentSettingCustomScope( |
pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_IMAGES, |
std::string(), CONTENT_SETTING_BLOCK); |
EXPECT_EQ(CONTENT_SETTING_BLOCK, |