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

Unified Diff: chrome/browser/host_content_settings_map_unittest.cc

Issue 5238002: Reintegrate 552 r66225-r66645.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/552d/src/
Patch Set: '' Created 10 years, 1 month 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/host_content_settings_map_unittest.cc
===================================================================
--- chrome/browser/host_content_settings_map_unittest.cc (revision 66837)
+++ chrome/browser/host_content_settings_map_unittest.cc (working copy)
@@ -4,6 +4,7 @@
#include "chrome/browser/host_content_settings_map.h"
+#include "base/auto_reset.h"
#include "base/command_line.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
@@ -89,12 +90,19 @@
EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetContentSetting(
GURL(chrome::kChromeUINewTabURL),
CONTENT_SETTINGS_TYPE_IMAGES, ""));
+ {
+ // Click-to-play needs to be enabled to set the content setting to ASK.
+ CommandLine* cmd = CommandLine::ForCurrentProcess();
+ AutoReset<CommandLine> auto_reset(cmd, *cmd);
+ cmd->AppendSwitch(switches::kEnableClickToPlay);
+
+ host_content_settings_map->SetDefaultContentSetting(
+ CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ASK);
+ EXPECT_EQ(CONTENT_SETTING_ASK,
+ host_content_settings_map->GetDefaultContentSetting(
+ CONTENT_SETTINGS_TYPE_PLUGINS));
+ }
host_content_settings_map->SetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ASK);
- EXPECT_EQ(CONTENT_SETTING_ASK,
- host_content_settings_map->GetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_PLUGINS));
- host_content_settings_map->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_POPUPS, CONTENT_SETTING_ALLOW);
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetDefaultContentSetting(
@@ -553,9 +561,9 @@
TEST_F(HostContentSettingsMapTest, ResourceIdentifier) {
// This feature is currently behind a flag.
- CommandLine cl(*CommandLine::ForCurrentProcess());
- CommandLine::ForCurrentProcess()->AppendSwitch(
- switches::kEnableResourceContentSettings);
+ CommandLine* cmd = CommandLine::ForCurrentProcess();
+ AutoReset<CommandLine> auto_reset(cmd, *cmd);
+ cmd->AppendSwitch(switches::kEnableResourceContentSettings);
TestingProfile profile;
HostContentSettingsMap* host_content_settings_map =
@@ -577,14 +585,13 @@
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
host, CONTENT_SETTINGS_TYPE_PLUGINS, resource2));
- *CommandLine::ForCurrentProcess() = cl;
}
TEST_F(HostContentSettingsMapTest, ResourceIdentifierPrefs) {
// This feature is currently behind a flag.
- CommandLine cl(*CommandLine::ForCurrentProcess());
- CommandLine::ForCurrentProcess()->AppendSwitch(
- switches::kEnableResourceContentSettings);
+ CommandLine* cmd = CommandLine::ForCurrentProcess();
+ AutoReset<CommandLine> auto_reset(cmd, *cmd);
+ cmd->AppendSwitch(switches::kEnableResourceContentSettings);
TestingProfile profile;
scoped_ptr<Value> value(base::JSONReader::Read(
@@ -619,7 +626,6 @@
base::JSONWriter::Write(content_setting_prefs, false, &prefs_as_json);
EXPECT_STREQ("{\"[*.]example.com\":{\"per_plugin\":{\"otherplugin\":2}}}",
prefs_as_json.c_str());
- *CommandLine::ForCurrentProcess() = cl;
}
} // namespace
« no previous file with comments | « chrome/browser/host_content_settings_map.cc ('k') | chrome/browser/renderer_host/browser_render_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698