summaryrefslogtreecommitdiffstats
path: root/chrome/browser/host_content_settings_map_unittest.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 10:02:16 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 10:02:16 +0000
commitceb98432ad0891542fb213193dd8312aed41e3c6 (patch)
tree9372263ed8c7e045ad7226f44f28079a75661a46 /chrome/browser/host_content_settings_map_unittest.cc
parentf85f070f8fca83ca373929584218d7185ff89220 (diff)
downloadchromium_src-ceb98432ad0891542fb213193dd8312aed41e3c6.zip
chromium_src-ceb98432ad0891542fb213193dd8312aed41e3c6.tar.gz
chromium_src-ceb98432ad0891542fb213193dd8312aed41e3c6.tar.bz2
Hook up some of the content settings UI to the actual settings map object. This also rewrites the affected UI bits to make it easier to do this, get rid of unnecessary code, and be more consistent with the blocked content bubble code.
BUG=32719 TEST=Content settings windows now have radio buttons that work, and remember their settings. The Flash link works too. Review URL: http://codereview.chromium.org/558060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37631 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/host_content_settings_map_unittest.cc')
-rw-r--r--chrome/browser/host_content_settings_map_unittest.cc27
1 files changed, 16 insertions, 11 deletions
diff --git a/chrome/browser/host_content_settings_map_unittest.cc b/chrome/browser/host_content_settings_map_unittest.cc
index b509129..eaaa9ce 100644
--- a/chrome/browser/host_content_settings_map_unittest.cc
+++ b/chrome/browser/host_content_settings_map_unittest.cc
@@ -12,8 +12,7 @@ namespace {
bool SettingsEqual(const ContentSettings& settings1,
const ContentSettings& settings2) {
- for (int i = CONTENT_SETTINGS_FIRST_TYPE; i < CONTENT_SETTINGS_NUM_TYPES;
- ++i) {
+ for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
if (settings1.settings[i] != settings2.settings[i])
return false;
}
@@ -36,7 +35,7 @@ TEST_F(HostContentSettingsMapTest, DefaultValues) {
profile.GetHostContentSettingsMap();
// Check setting defaults.
- EXPECT_EQ(CONTENT_SETTING_DEFAULT,
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_JAVASCRIPT));
host_content_settings_map->SetDefaultContentSetting(
@@ -55,18 +54,18 @@ TEST_F(HostContentSettingsMapTest, DefaultValues) {
host_content_settings_map->GetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_POPUPS));
host_content_settings_map->ResetToDefaults();
- EXPECT_EQ(CONTENT_SETTING_DEFAULT,
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_POPUPS));
+ CONTENT_SETTINGS_TYPE_PLUGINS));
// Check returning individual settings.
std::string host("example.com");
- EXPECT_EQ(CONTENT_SETTING_DEFAULT,
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
host, CONTENT_SETTINGS_TYPE_IMAGES));
host_content_settings_map->SetContentSetting(host,
CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_DEFAULT);
- EXPECT_EQ(CONTENT_SETTING_DEFAULT,
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
host, CONTENT_SETTINGS_TYPE_IMAGES));
host_content_settings_map->SetContentSetting(host,
@@ -77,16 +76,22 @@ TEST_F(HostContentSettingsMapTest, DefaultValues) {
// Check returning all settings for a host.
ContentSettings desired_settings;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_COOKIES] =
+ CONTENT_SETTING_ALLOW;
host_content_settings_map->SetContentSetting(host,
CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_DEFAULT);
- host_content_settings_map->SetContentSetting(host,
- CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW);
- desired_settings.settings[CONTENT_SETTINGS_TYPE_PLUGINS] =
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_IMAGES] =
CONTENT_SETTING_ALLOW;
host_content_settings_map->SetContentSetting(host,
- CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_ALLOW);
+ CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK);
desired_settings.settings[CONTENT_SETTINGS_TYPE_JAVASCRIPT] =
+ CONTENT_SETTING_BLOCK;
+ host_content_settings_map->SetContentSetting(host,
+ CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW);
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_PLUGINS] =
CONTENT_SETTING_ALLOW;
+ desired_settings.settings[CONTENT_SETTINGS_TYPE_POPUPS] =
+ CONTENT_SETTING_BLOCK;
ContentSettings settings =
host_content_settings_map->GetContentSettings(host);
EXPECT_TRUE(SettingsEqual(desired_settings, settings));