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

Unified Diff: chrome/browser/cocoa/content_settings_dialog_controller_unittest.mm

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/cocoa/content_settings_dialog_controller_unittest.mm
===================================================================
--- chrome/browser/cocoa/content_settings_dialog_controller_unittest.mm (revision 66837)
+++ chrome/browser/cocoa/content_settings_dialog_controller_unittest.mm (working copy)
@@ -4,6 +4,8 @@
#import "chrome/browser/cocoa/content_settings_dialog_controller.h"
+#include "base/auto_reset.h"
+#include "base/command_line.h"
#import "base/scoped_nsobject.h"
#include "base/ref_counted.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
@@ -13,6 +15,7 @@
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
+#include "chrome/common/chrome_switches.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
@@ -164,10 +167,17 @@
CONTENT_SETTING_BLOCK);
EXPECT_EQ(kPluginsBlockIndex, [controller_ pluginsEnabledIndex]);
- settingsMap_->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS,
- CONTENT_SETTING_ASK);
- EXPECT_EQ(kPluginsAskIndex, [controller_ pluginsEnabledIndex]);
+ {
+ // 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);
+ settingsMap_->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS,
+ CONTENT_SETTING_ASK);
+ EXPECT_EQ(kPluginsAskIndex, [controller_ pluginsEnabledIndex]);
+ }
+
// Change dialog property, check setting.
NSInteger setting;
[controller_ setPluginsEnabledIndex:kPluginsAllowIndex];
@@ -180,10 +190,16 @@
settingsMap_->GetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS);
EXPECT_EQ(CONTENT_SETTING_BLOCK, setting);
- [controller_ setPluginsEnabledIndex:kPluginsAskIndex];
- setting =
- settingsMap_->GetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS);
- EXPECT_EQ(CONTENT_SETTING_ASK, setting);
+ {
+ CommandLine* cmd = CommandLine::ForCurrentProcess();
+ AutoReset<CommandLine> auto_reset(cmd, *cmd);
+ cmd->AppendSwitch(switches::kEnableClickToPlay);
+
+ [controller_ setPluginsEnabledIndex:kPluginsAskIndex];
+ setting =
+ settingsMap_->GetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS);
+ EXPECT_EQ(CONTENT_SETTING_ASK, setting);
+ }
}
TEST_F(ContentSettingsDialogControllerTest, PopupsSetting) {
« no previous file with comments | « chrome/browser/cocoa/content_settings_dialog_controller.mm ('k') | chrome/browser/content_setting_bubble_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698