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

Side by Side 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: Rebased 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/policy/policy_bundle.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/policy/policy_bundle.h" 5 #include "chrome/browser/policy/policy_bundle.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/policy/policy_map.h" 9 #include "chrome/browser/policy/policy_map.h"
10 #include "policy/policy_constants.h" 10 #include "policy/policy_constants.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 EXPECT_TRUE( 181 EXPECT_TRUE(
182 merged.Get(POLICY_DOMAIN_EXTENSIONS, kExtension0).Equals(policy0)); 182 merged.Get(POLICY_DOMAIN_EXTENSIONS, kExtension0).Equals(policy0));
183 // extension1 comes only from bundle1. 183 // extension1 comes only from bundle1.
184 EXPECT_TRUE( 184 EXPECT_TRUE(
185 merged.Get(POLICY_DOMAIN_EXTENSIONS, kExtension1).Equals(policy1)); 185 merged.Get(POLICY_DOMAIN_EXTENSIONS, kExtension1).Equals(policy1));
186 // extension2 comes only from bundle2. 186 // extension2 comes only from bundle2.
187 EXPECT_TRUE( 187 EXPECT_TRUE(
188 merged.Get(POLICY_DOMAIN_EXTENSIONS, kExtension2).Equals(policy2)); 188 merged.Get(POLICY_DOMAIN_EXTENSIONS, kExtension2).Equals(policy2));
189 } 189 }
190 190
191 TEST(PolicyBundleTest, Equals) {
192 PolicyBundle bundle;
193 AddTestPolicies(&bundle.Get(POLICY_DOMAIN_CHROME, std::string()));
194 AddTestPolicies(&bundle.Get(POLICY_DOMAIN_EXTENSIONS, kExtension0));
195
196 PolicyBundle other;
197 EXPECT_FALSE(bundle.Equals(other));
198 other.CopyFrom(bundle);
199 EXPECT_TRUE(bundle.Equals(other));
200
201 AddTestPolicies(&bundle.Get(POLICY_DOMAIN_EXTENSIONS, kExtension1));
202 EXPECT_FALSE(bundle.Equals(other));
203 other.CopyFrom(bundle);
204 EXPECT_TRUE(bundle.Equals(other));
205 AddTestPolicies(&other.Get(POLICY_DOMAIN_EXTENSIONS, kExtension2));
206 EXPECT_FALSE(bundle.Equals(other));
207
208 other.CopyFrom(bundle);
209 bundle.Get(POLICY_DOMAIN_CHROME, std::string())
210 .Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
211 base::Value::CreateIntegerValue(123));
212 EXPECT_FALSE(bundle.Equals(other));
213 other.CopyFrom(bundle);
214 EXPECT_TRUE(bundle.Equals(other));
215 bundle.Get(POLICY_DOMAIN_CHROME, std::string())
216 .Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
217 base::Value::CreateIntegerValue(123));
218 EXPECT_FALSE(bundle.Equals(other));
219
220 // Test non-const Get().
221 bundle.Clear();
222 other.Clear();
223 PolicyMap& policy_map = bundle.Get(POLICY_DOMAIN_CHROME, "");
224 EXPECT_TRUE(bundle.Equals(other));
225 policy_map.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
226 base::Value::CreateIntegerValue(123));
227 EXPECT_FALSE(bundle.Equals(other));
228 }
229
191 } // namespace policy 230 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_bundle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698