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

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

Issue 2853983002: Ensure settings returned from Content Settings providers are valid (Closed)
Patch Set: Ensure settings returned from Content Settings providers are valid Created 3 years, 8 months 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/content_settings_policy_provider_unittest.cc
diff --git a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc
index 433bbd7ab0bd9ecc74f8457d61add2ed48e3c2bc..4f72ccf3ceb2fc5d2e3444e8911447ecf03603b0 100644
--- a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc
+++ b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc
@@ -281,4 +281,23 @@ TEST_F(PolicyProviderTest, AutoSelectCertificateList) {
provider.ShutdownOnUIThread();
}
+TEST_F(PolicyProviderTest, InvalidManagedDefaultContentSetting) {
+ TestingProfile profile;
+ sync_preferences::TestingPrefServiceSyncable* prefs =
+ profile.GetTestingPrefService();
+ PolicyProvider provider(prefs);
+
+ prefs->SetManagedPref(
+ prefs::kManagedDefaultCookiesSetting,
+ base::MakeUnique<base::Value>(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT));
+
+ // The setting provided in the cookies pref is not valid for cookies. It
+ // should be ignored.
+ std::unique_ptr<RuleIterator> rule_iterator(provider.GetRuleIterator(
+ CONTENT_SETTINGS_TYPE_COOKIES, std::string(), false));
+ EXPECT_FALSE(rule_iterator);
+
+ provider.ShutdownOnUIThread();
+}
+
} // namespace content_settings

Powered by Google App Engine
This is Rietveld 408576698