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

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

Issue 106713004: Remove kEnableResourceContentSettings and all the code that uses it since it's been behind a flag f… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 7 years 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
===================================================================
--- chrome/browser/content_settings/host_content_settings_map_unittest.cc (revision 239860)
+++ chrome/browser/content_settings/host_content_settings_map_unittest.cc (working copy)
@@ -715,103 +715,6 @@
prefs_as_json.c_str());
}
-TEST_F(HostContentSettingsMapTest, ResourceIdentifier) {
- // This feature is currently behind a flag.
- CommandLine* cmd = CommandLine::ForCurrentProcess();
- base::AutoReset<CommandLine> auto_reset(cmd, *cmd);
- cmd->AppendSwitch(switches::kEnableResourceContentSettings);
-
- TestingProfile profile;
- HostContentSettingsMap* host_content_settings_map =
- profile.GetHostContentSettingsMap();
-
- GURL host("http://example.com/");
- ContentSettingsPattern pattern =
- ContentSettingsPattern::FromString("[*.]example.com");
- std::string resource1("someplugin");
- std::string resource2("otherplugin");
-
- // If resource content settings are enabled, GetContentSettings should return
- // the default values for all plugins
- ContentSetting default_plugin_setting =
- host_content_settings_map->GetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_PLUGINS, NULL);
- EXPECT_EQ(default_plugin_setting,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string()));
-
- // If no resource-specific content settings are defined, the setting should be
- // DEFAULT.
- EXPECT_EQ(CONTENT_SETTING_DEFAULT,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_PLUGINS, resource1));
-
- host_content_settings_map->SetContentSetting(
- pattern,
- ContentSettingsPattern::Wildcard(),
- CONTENT_SETTINGS_TYPE_PLUGINS,
- resource1,
- CONTENT_SETTING_BLOCK);
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_PLUGINS, resource1));
- EXPECT_EQ(CONTENT_SETTING_DEFAULT,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_PLUGINS, resource2));
-}
-
-TEST_F(HostContentSettingsMapTest, ResourceIdentifierPrefs) {
- // This feature is currently behind a flag.
- CommandLine* cmd = CommandLine::ForCurrentProcess();
- base::AutoReset<CommandLine> auto_reset(cmd, *cmd);
- cmd->AppendSwitch(switches::kEnableResourceContentSettings);
-
- TestingProfile profile;
- scoped_ptr<Value> value(base::JSONReader::Read(
- "{\"[*.]example.com,*\":{\"per_plugin\":{\"someplugin\":2}}}"));
- profile.GetPrefs()->Set(prefs::kContentSettingsPatternPairs, *value);
- HostContentSettingsMap* host_content_settings_map =
- profile.GetHostContentSettingsMap();
-
- GURL host("http://example.com/");
- ContentSettingsPattern item_pattern =
- ContentSettingsPattern::FromString("[*.]example.com");
- ContentSettingsPattern top_level_frame_pattern =
- ContentSettingsPattern::Wildcard();
- std::string resource1("someplugin");
- std::string resource2("otherplugin");
-
- EXPECT_EQ(CONTENT_SETTING_BLOCK,
- host_content_settings_map->GetContentSetting(
- host, host, CONTENT_SETTINGS_TYPE_PLUGINS, resource1));
-
- host_content_settings_map->SetContentSetting(
- item_pattern,
- top_level_frame_pattern,
- CONTENT_SETTINGS_TYPE_PLUGINS,
- resource1,
- CONTENT_SETTING_DEFAULT);
-
- const DictionaryValue* content_setting_prefs =
- profile.GetPrefs()->GetDictionary(prefs::kContentSettingsPatternPairs);
- std::string prefs_as_json;
- base::JSONWriter::Write(content_setting_prefs, &prefs_as_json);
- EXPECT_EQ("{}", prefs_as_json);
-
- host_content_settings_map->SetContentSetting(
- item_pattern,
- top_level_frame_pattern,
- CONTENT_SETTINGS_TYPE_PLUGINS,
- resource2,
- CONTENT_SETTING_BLOCK);
-
- content_setting_prefs =
- profile.GetPrefs()->GetDictionary(prefs::kContentSettingsPatternPairs);
- base::JSONWriter::Write(content_setting_prefs, &prefs_as_json);
- EXPECT_EQ("{\"[*.]example.com,*\":{\"per_plugin\":{\"otherplugin\":2}}}",
- prefs_as_json);
-}
-
// If a default-content-setting is managed, the managed value should be used
// instead of the default value.
TEST_F(HostContentSettingsMapTest, ManagedDefaultContentSetting) {

Powered by Google App Engine
This is Rietveld 408576698