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

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: Fixing ContentSetting Register. 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..04eac30aaa1dbde21d758886ecdcd97193367931 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_ALLOW);
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
+ 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_ALLOW);
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
+ 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()));
}
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_ALLOW));
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
+ 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,
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/content_settings/tab_specific_content_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698