| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 const char kExtension0[] = "extension-0"; | 27 const char kExtension0[] = "extension-0"; |
| 28 const char kExtension1[] = "extension-1"; | 28 const char kExtension1[] = "extension-1"; |
| 29 const char kExtension2[] = "extension-2"; | 29 const char kExtension2[] = "extension-2"; |
| 30 const char kExtension3[] = "extension-3"; | 30 const char kExtension3[] = "extension-3"; |
| 31 | 31 |
| 32 // Adds test policies to |policy|. | 32 // Adds test policies to |policy|. |
| 33 void AddTestPolicies(PolicyMap* policy) { | 33 void AddTestPolicies(PolicyMap* policy) { |
| 34 policy->Set("mandatory-user", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 34 policy->Set("mandatory-user", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 35 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(123), nullptr); | 35 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(123), nullptr); |
| 36 policy->Set("mandatory-machine", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, | 36 policy->Set("mandatory-machine", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, |
| 37 POLICY_SOURCE_CLOUD, base::MakeUnique<base::StringValue>("omg"), | 37 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("omg"), |
| 38 nullptr); | 38 nullptr); |
| 39 policy->Set("recommended-user", POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, | 39 policy->Set("recommended-user", POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, |
| 40 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), | 40 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), |
| 41 nullptr); | 41 nullptr); |
| 42 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 42 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 43 dict->SetBoolean("false", false); | 43 dict->SetBoolean("false", false); |
| 44 dict->SetInteger("int", 456); | 44 dict->SetInteger("int", 456); |
| 45 dict->SetString("str", "bbq"); | 45 dict->SetString("str", "bbq"); |
| 46 policy->Set("recommended-machine", POLICY_LEVEL_RECOMMENDED, | 46 policy->Set("recommended-machine", POLICY_LEVEL_RECOMMENDED, |
| 47 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, std::move(dict), | 47 POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, std::move(dict), |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 PolicyMap& policy_map = | 255 PolicyMap& policy_map = |
| 256 bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); | 256 bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); |
| 257 EXPECT_TRUE(bundle.Equals(other)); | 257 EXPECT_TRUE(bundle.Equals(other)); |
| 258 policy_map.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 258 policy_map.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 259 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(123), | 259 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(123), |
| 260 nullptr); | 260 nullptr); |
| 261 EXPECT_FALSE(bundle.Equals(other)); | 261 EXPECT_FALSE(bundle.Equals(other)); |
| 262 } | 262 } |
| 263 | 263 |
| 264 } // namespace policy | 264 } // namespace policy |
| OLD | NEW |