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

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: Fix typos. 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..0202bc8b8ece2f412a66940e0673e9db9bd7a4cb 100644
--- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc
+++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
@@ -90,6 +90,9 @@ TEST_F(HostContentSettingsMapTest, DefaultValues) {
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_POPUPS, NULL));
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetDefaultContentSetting(
+ CONTENT_SETTINGS_TYPE_KEYGEN, NULL));
}
TEST_F(HostContentSettingsMapTest, IndividualSettings) {
@@ -174,6 +177,12 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
EXPECT_EQ(CONTENT_SETTING_ASK,
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()));
+ host_content_settings_map->SetContentSetting(
+ pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_KEYGEN,
+ std::string(), CONTENT_SETTING_BLOCK);
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
msramek 2015/11/06 16:56:15 nit: This test would be better if you tested ALLOW
svaldez 2015/11/06 21:30:07 Done.
+ host_content_settings_map->GetContentSetting(
+ host, host, CONTENT_SETTINGS_TYPE_KEYGEN, std::string()));
// Check returning all hosts for a setting.
ContentSettingsPattern pattern2 =
@@ -577,6 +586,25 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) {
host_ending_with_dot,
CONTENT_SETTINGS_TYPE_POPUPS,
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);
msramek 2015/11/06 16:56:15 Like above: To test that SetContentSetting works,
svaldez 2015/11/06 21:30:07 Done.
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetContentSetting(
+ host_ending_with_dot, host_ending_with_dot,
+ CONTENT_SETTINGS_TYPE_KEYGEN, std::string()));
}
TEST_F(HostContentSettingsMapTest, NestedSettings) {
@@ -643,6 +671,9 @@ TEST_F(HostContentSettingsMapTest, NestedSettings) {
EXPECT_EQ(CONTENT_SETTING_ASK,
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()));
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ host_content_settings_map->GetContentSetting(
+ host, host, CONTENT_SETTINGS_TYPE_KEYGEN, std::string()));
}
TEST_F(HostContentSettingsMapTest, OffTheRecord) {
@@ -793,6 +824,23 @@ TEST_F(HostContentSettingsMapTest, ManagedDefaultContentSetting) {
host_content_settings_map->GetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_PLUGINS, NULL));
#endif
+
+ 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));
msramek 2015/11/06 16:56:15 Ditto as above.
svaldez 2015/11/06 21:30:07 Done.
+ 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));
}
TEST_F(HostContentSettingsMapTest,

Powered by Google App Engine
This is Rietveld 408576698