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

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

Issue 1417173010: Adding <keygen> Content Setting (core) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing test_runner. Created 5 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/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 892ddcbd918e1145022154e225c76ac3d1f8f712..aebda812851909dd484abac73166a10577335199 100644
--- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc
+++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
@@ -56,6 +56,9 @@ TEST_F(HostContentSettingsMapTest, DefaultValues) {
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_JAVASCRIPT, NULL));
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetDefaultContentSetting(
+ CONTENT_SETTINGS_TYPE_KEYGEN, NULL));
host_content_settings_map->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
@@ -147,6 +150,12 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
+ host_content_settings_map->SetContentSetting(
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_KEYGEN,
+ std::string(), CONTENT_SETTING_BLOCK);
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetContentSetting(
+ host, host, CONTENT_SETTINGS_TYPE_KEYGEN, std::string()));
#if defined(ENABLE_PLUGINS)
host_content_settings_map->SetContentSetting(
pattern,
@@ -514,6 +523,25 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) {
CONTENT_SETTINGS_TYPE_JAVASCRIPT,
std::string()));
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetContentSetting(
+ host_ending_with_dot, host_ending_with_dot,
+ CONTENT_SETTINGS_TYPE_KEYGEN, std::string()));
+ host_content_settings_map->SetContentSetting(
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_KEYGEN,
+ std::string(), CONTENT_SETTING_DEFAULT);
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetContentSetting(
+ host_ending_with_dot, host_ending_with_dot,
+ CONTENT_SETTINGS_TYPE_KEYGEN, std::string()));
+ host_content_settings_map->SetContentSetting(
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_KEYGEN,
+ std::string(), CONTENT_SETTING_BLOCK);
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetContentSetting(
+ host_ending_with_dot, host_ending_with_dot,
+ CONTENT_SETTINGS_TYPE_KEYGEN, std::string()));
+
#if defined(ENABLE_PLUGINS)
EXPECT_EQ(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT,
host_content_settings_map->GetContentSetting(
@@ -626,6 +654,9 @@ TEST_F(HostContentSettingsMapTest, NestedSettings) {
host, host, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
+ host, host, CONTENT_SETTINGS_TYPE_KEYGEN, std::string()));
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string()));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
@@ -779,6 +810,23 @@ TEST_F(HostContentSettingsMapTest, ManagedDefaultContentSetting) {
host_content_settings_map->GetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_JAVASCRIPT, NULL));
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetDefaultContentSetting(
+ CONTENT_SETTINGS_TYPE_KEYGEN, NULL));
+
+ // Set managed-default-content-setting through the coresponding preferences.
+ prefs->SetManagedPref(prefs::kManagedDefaultKeygenSetting,
+ new base::FundamentalValue(CONTENT_SETTING_BLOCK));
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetDefaultContentSetting(
+ CONTENT_SETTINGS_TYPE_KEYGEN, NULL));
+
+ // Remove managed-default-content-settings-preferences.
+ prefs->RemoveManagedPref(prefs::kManagedDefaultKeygenSetting);
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetDefaultContentSetting(
+ CONTENT_SETTINGS_TYPE_KEYGEN, NULL));
+
// Set preference to manage the default-content-setting for Plugins.
prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting,
new base::FundamentalValue(CONTENT_SETTING_BLOCK));

Powered by Google App Engine
This is Rietveld 408576698