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

Side by Side Diff: components/policy/core/browser/configuration_policy_pref_store_unittest.cc

Issue 2030833003: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/json_schema/json_schema_validator_unittest_base.cc ('k') | components/policy/core/common/schema_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698