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

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

Issue 10384145: Removed ConfigurationPolicyProvider::Provide(). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressed comments Created 8 years, 7 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/policy_bundle_unittest.cc
diff --git a/chrome/browser/policy/policy_bundle_unittest.cc b/chrome/browser/policy/policy_bundle_unittest.cc
index 6c955aad0bfef5592104c2db3fd6c77590840966..2d5ebae65f4660595bd8a00e1ba69d33e35790be 100644
--- a/chrome/browser/policy/policy_bundle_unittest.cc
+++ b/chrome/browser/policy/policy_bundle_unittest.cc
@@ -188,4 +188,43 @@ TEST(PolicyBundleTest, MergeFrom) {
merged.Get(POLICY_DOMAIN_EXTENSIONS, kExtension2).Equals(policy2));
}
+TEST(PolicyBundleTest, Equals) {
+ PolicyBundle bundle;
+ AddTestPolicies(&bundle.Get(POLICY_DOMAIN_CHROME, std::string()));
+ AddTestPolicies(&bundle.Get(POLICY_DOMAIN_EXTENSIONS, kExtension0));
+
+ PolicyBundle other;
+ EXPECT_FALSE(bundle.Equals(other));
+ other.CopyFrom(bundle);
+ EXPECT_TRUE(bundle.Equals(other));
+
+ AddTestPolicies(&bundle.Get(POLICY_DOMAIN_EXTENSIONS, kExtension1));
+ EXPECT_FALSE(bundle.Equals(other));
+ other.CopyFrom(bundle);
+ EXPECT_TRUE(bundle.Equals(other));
+ AddTestPolicies(&other.Get(POLICY_DOMAIN_EXTENSIONS, kExtension2));
+ EXPECT_FALSE(bundle.Equals(other));
+
+ other.CopyFrom(bundle);
+ bundle.Get(POLICY_DOMAIN_CHROME, std::string())
+ .Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
+ base::Value::CreateIntegerValue(123));
+ EXPECT_FALSE(bundle.Equals(other));
+ other.CopyFrom(bundle);
+ EXPECT_TRUE(bundle.Equals(other));
+ bundle.Get(POLICY_DOMAIN_CHROME, std::string())
+ .Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
+ base::Value::CreateIntegerValue(123));
+ EXPECT_FALSE(bundle.Equals(other));
+
+ // Test non-const Get().
+ bundle.Clear();
+ other.Clear();
+ PolicyMap& policy_map = bundle.Get(POLICY_DOMAIN_CHROME, "");
+ EXPECT_TRUE(bundle.Equals(other));
+ policy_map.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
+ base::Value::CreateIntegerValue(123));
+ EXPECT_FALSE(bundle.Equals(other));
+}
+
} // namespace policy
« chrome/browser/policy/policy_bundle.cc ('K') | « chrome/browser/policy/policy_bundle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698