OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/policy/core/common/policy_bundle.h" | 5 #include "components/policy/core/common/policy_bundle.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "components/policy/core/common/external_data_fetcher.h" | 10 #include "components/policy/core/common/external_data_fetcher.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 const char kExtension1[] = "extension-1"; | 24 const char kExtension1[] = "extension-1"; |
25 const char kExtension2[] = "extension-2"; | 25 const char kExtension2[] = "extension-2"; |
26 const char kExtension3[] = "extension-3"; | 26 const char kExtension3[] = "extension-3"; |
27 | 27 |
28 // Adds test policies to |policy|. | 28 // Adds test policies to |policy|. |
29 void AddTestPolicies(PolicyMap* policy) { | 29 void AddTestPolicies(PolicyMap* policy) { |
30 policy->Set("mandatory-user", POLICY_LEVEL_MANDATORY, | 30 policy->Set("mandatory-user", POLICY_LEVEL_MANDATORY, |
31 POLICY_SCOPE_USER, base::Value::CreateIntegerValue(123), NULL); | 31 POLICY_SCOPE_USER, base::Value::CreateIntegerValue(123), NULL); |
32 policy->Set("mandatory-machine", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, | 32 policy->Set("mandatory-machine", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
33 base::Value::CreateStringValue("omg"), NULL); | 33 base::Value::CreateStringValue("omg"), NULL); |
34 policy->Set("recommended-user", POLICY_LEVEL_RECOMMENDED, | 34 policy->Set("recommended-user", |
35 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL); | 35 POLICY_LEVEL_RECOMMENDED, |
| 36 POLICY_SCOPE_USER, |
| 37 new base::FundamentalValue(true), |
| 38 NULL); |
36 base::DictionaryValue* dict = new base::DictionaryValue(); | 39 base::DictionaryValue* dict = new base::DictionaryValue(); |
37 dict->SetBoolean("false", false); | 40 dict->SetBoolean("false", false); |
38 dict->SetInteger("int", 456); | 41 dict->SetInteger("int", 456); |
39 dict->SetString("str", "bbq"); | 42 dict->SetString("str", "bbq"); |
40 policy->Set("recommended-machine", POLICY_LEVEL_RECOMMENDED, | 43 policy->Set("recommended-machine", POLICY_LEVEL_RECOMMENDED, |
41 POLICY_SCOPE_MACHINE, dict, NULL); | 44 POLICY_SCOPE_MACHINE, dict, NULL); |
42 } | 45 } |
43 | 46 |
44 // Adds test policies to |policy| based on the parameters: | 47 // Adds test policies to |policy| based on the parameters: |
45 // - kPolicyClashing0 mapped to |value|, user mandatory | 48 // - kPolicyClashing0 mapped to |value|, user mandatory |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 other.Clear(); | 254 other.Clear(); |
252 PolicyMap& policy_map = | 255 PolicyMap& policy_map = |
253 bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); | 256 bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); |
254 EXPECT_TRUE(bundle.Equals(other)); | 257 EXPECT_TRUE(bundle.Equals(other)); |
255 policy_map.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 258 policy_map.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
256 base::Value::CreateIntegerValue(123), NULL); | 259 base::Value::CreateIntegerValue(123), NULL); |
257 EXPECT_FALSE(bundle.Equals(other)); | 260 EXPECT_FALSE(bundle.Equals(other)); |
258 } | 261 } |
259 | 262 |
260 } // namespace policy | 263 } // namespace policy |
OLD | NEW |