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

Unified Diff: chrome/browser/policy/configuration_policy_handler_unittest.cc

Issue 11183029: Don't reject extension list policies with invalid entries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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/policy/configuration_policy_handler_unittest.cc
diff --git a/chrome/browser/policy/configuration_policy_handler_unittest.cc b/chrome/browser/policy/configuration_policy_handler_unittest.cc
index cf0c9fefaa3136b3020b0db21dbe0ee2f1ff8d4f..92fc28c4964ba029359c6d553c8264b83284127d 100644
--- a/chrome/browser/policy/configuration_policy_handler_unittest.cc
+++ b/chrome/browser/policy/configuration_policy_handler_unittest.cc
@@ -44,13 +44,14 @@ TEST(ExtensionListPolicyHandlerTest, CheckPolicySettings) {
policy_map.Set(key::kExtensionInstallBlacklist, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, list.DeepCopy());
errors.Clear();
- EXPECT_FALSE(handler.CheckPolicySettings(policy_map, &errors));
+ EXPECT_TRUE(handler.CheckPolicySettings(policy_map, &errors));
EXPECT_FALSE(errors.empty());
EXPECT_FALSE(errors.GetErrors(key::kExtensionInstallBlacklist).empty());
}
TEST(ExtensionListPolicyHandlerTest, ApplyPolicySettings) {
- base::ListValue list;
+ base::ListValue policy;
+ base::ListValue expected;
PolicyMap policy_map;
PrefValueMap prefs;
base::Value* value = NULL;
@@ -58,12 +59,21 @@ TEST(ExtensionListPolicyHandlerTest, ApplyPolicySettings) {
prefs::kExtensionInstallDenyList,
false);
- list.Append(Value::CreateStringValue("abcdefghijklmnopabcdefghijklmnop"));
+ policy.Append(Value::CreateStringValue("abcdefghijklmnopabcdefghijklmnop"));
+ expected.Append(Value::CreateStringValue("abcdefghijklmnopabcdefghijklmnop"));
+
policy_map.Set(key::kExtensionInstallBlacklist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, list.DeepCopy());
+ POLICY_SCOPE_USER, policy.DeepCopy());
handler.ApplyPolicySettings(policy_map, &prefs);
EXPECT_TRUE(prefs.GetValue(prefs::kExtensionInstallDenyList, &value));
- EXPECT_TRUE(base::Value::Equals(&list, value));
+ EXPECT_TRUE(base::Value::Equals(&expected, value));
+
+ policy.Append(Value::CreateStringValue("invalid"));
+ policy_map.Set(key::kExtensionInstallBlacklist, POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER, policy.DeepCopy());
+ handler.ApplyPolicySettings(policy_map, &prefs);
+ EXPECT_TRUE(prefs.GetValue(prefs::kExtensionInstallDenyList, &value));
+ EXPECT_TRUE(base::Value::Equals(&expected, value));
}
TEST(ExtensionURLPatternListPolicyHandlerTest, CheckPolicySettings) {

Powered by Google App Engine
This is Rietveld 408576698