OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/configuration_policy_pref_store.h" | 5 #include "components/policy/core/browser/configuration_policy_pref_store.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 kTestPolicy, kTestPref, base::Value::TYPE_LIST))); | 50 kTestPolicy, kTestPref, base::Value::TYPE_LIST))); |
51 } | 51 } |
52 }; | 52 }; |
53 | 53 |
54 TEST_F(ConfigurationPolicyPrefStoreListTest, GetDefault) { | 54 TEST_F(ConfigurationPolicyPrefStoreListTest, GetDefault) { |
55 EXPECT_FALSE(store_->GetValue(kTestPref, NULL)); | 55 EXPECT_FALSE(store_->GetValue(kTestPref, NULL)); |
56 } | 56 } |
57 | 57 |
58 TEST_F(ConfigurationPolicyPrefStoreListTest, SetValue) { | 58 TEST_F(ConfigurationPolicyPrefStoreListTest, SetValue) { |
59 std::unique_ptr<base::ListValue> in_value(new base::ListValue()); | 59 std::unique_ptr<base::ListValue> in_value(new base::ListValue()); |
60 in_value->Append(new base::StringValue("test1")); | 60 in_value->AppendString("test1"); |
61 in_value->Append(new base::StringValue("test2,")); | 61 in_value->AppendString("test2,"); |
62 PolicyMap policy; | 62 PolicyMap policy; |
63 policy.Set(kTestPolicy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 63 policy.Set(kTestPolicy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
64 POLICY_SOURCE_CLOUD, in_value->CreateDeepCopy(), nullptr); | 64 POLICY_SOURCE_CLOUD, in_value->CreateDeepCopy(), nullptr); |
65 UpdateProviderPolicy(policy); | 65 UpdateProviderPolicy(policy); |
66 const base::Value* value = NULL; | 66 const base::Value* value = NULL; |
67 EXPECT_TRUE(store_->GetValue(kTestPref, &value)); | 67 EXPECT_TRUE(store_->GetValue(kTestPref, &value)); |
68 ASSERT_TRUE(value); | 68 ASSERT_TRUE(value); |
69 EXPECT_TRUE(in_value->Equals(value)); | 69 EXPECT_TRUE(in_value->Equals(value)); |
70 } | 70 } |
71 | 71 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 .WillRepeatedly(Return(true)); | 210 .WillRepeatedly(Return(true)); |
211 PolicyMap policy; | 211 PolicyMap policy; |
212 UpdateProviderPolicy(policy); | 212 UpdateProviderPolicy(policy); |
213 EXPECT_TRUE(observer_.initialized); | 213 EXPECT_TRUE(observer_.initialized); |
214 EXPECT_TRUE(observer_.initialization_success); | 214 EXPECT_TRUE(observer_.initialization_success); |
215 Mock::VerifyAndClearExpectations(&observer_); | 215 Mock::VerifyAndClearExpectations(&observer_); |
216 EXPECT_TRUE(store_->IsInitializationComplete()); | 216 EXPECT_TRUE(store_->IsInitializationComplete()); |
217 } | 217 } |
218 | 218 |
219 } // namespace policy | 219 } // namespace policy |
OLD | NEW |