| 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 9aaf801cd75c4113f7961b6a496880579371c6c7..22c88533fae143c8f0e69c2d4e28f712cd988f45 100644
|
| --- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc
|
| +++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
|
| @@ -1016,3 +1016,70 @@ TEST_F(HostContentSettingsMapTest, AddContentSettingsObserver) {
|
| std::string(),
|
| CONTENT_SETTING_DEFAULT);
|
| }
|
| +
|
| +TEST_F(HostContentSettingsMapTest, OverrideAllowedWebsiteSetting) {
|
| + TestingProfile profile;
|
| + HostContentSettingsMap* host_content_settings_map =
|
| + profile.GetHostContentSettingsMap();
|
| + GURL host("http://example.com/");
|
| + ContentSettingsPattern pattern =
|
| + ContentSettingsPattern::FromString("[*.]example.com");
|
| + host_content_settings_map->SetContentSetting(
|
| + pattern,
|
| + ContentSettingsPattern::Wildcard(),
|
| + CONTENT_SETTINGS_TYPE_GEOLOCATION,
|
| + std::string(),
|
| + CONTENT_SETTING_ALLOW);
|
| +
|
| + EXPECT_EQ(CONTENT_SETTING_ALLOW,
|
| + host_content_settings_map->GetContentSetting(
|
| + host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
|
| +
|
| + // Disabling should override an allowed exception.
|
| + host_content_settings_map->SetContentSettingOverride(
|
| + CONTENT_SETTINGS_TYPE_GEOLOCATION, false);
|
| + EXPECT_EQ(CONTENT_SETTING_BLOCK,
|
| + host_content_settings_map->GetContentSetting(
|
| + host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
|
| +
|
| + host_content_settings_map->SetContentSettingOverride(
|
| + CONTENT_SETTINGS_TYPE_GEOLOCATION, true);
|
| + EXPECT_EQ(CONTENT_SETTING_ALLOW,
|
| + host_content_settings_map->GetContentSetting(
|
| + host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
|
| +}
|
| +
|
| +TEST_F(HostContentSettingsMapTest, OverrideAllowedDefaultSetting) {
|
| + TestingProfile profile;
|
| + HostContentSettingsMap* host_content_settings_map =
|
| + profile.GetHostContentSettingsMap();
|
| +
|
| + // Check setting defaults.
|
| + EXPECT_EQ(CONTENT_SETTING_ALLOW,
|
| + host_content_settings_map->GetDefaultContentSetting(
|
| + CONTENT_SETTINGS_TYPE_IMAGES, NULL));
|
| +
|
| + GURL host("http://example.com/");
|
| + EXPECT_EQ(CONTENT_SETTING_ALLOW,
|
| + host_content_settings_map->GetContentSetting(
|
| + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
|
| +
|
| + // Disabling should override an allowed default setting.
|
| + host_content_settings_map->SetContentSettingOverride(
|
| + CONTENT_SETTINGS_TYPE_IMAGES, false);
|
| + EXPECT_EQ(CONTENT_SETTING_BLOCK,
|
| + host_content_settings_map->GetContentSetting(
|
| + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
|
| +
|
| + // Enabling shouldn't override positively.
|
| + host_content_settings_map->SetContentSettingOverride(
|
| + CONTENT_SETTINGS_TYPE_IMAGES, true);
|
| + EXPECT_EQ(CONTENT_SETTING_ALLOW,
|
| + host_content_settings_map->GetContentSetting(
|
| + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
|
| + host_content_settings_map->SetDefaultContentSetting(
|
| + CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK);
|
| + EXPECT_EQ(CONTENT_SETTING_BLOCK,
|
| + host_content_settings_map->GetContentSetting(
|
| + host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
|
| +}
|
|
|