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

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

Issue 383263005: Remove more CreateIntegerValue calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/SetBoolean/SetInteger Created 6 years, 5 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 | Annotate | Revision Log
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 <string> 5 #include <string>
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/prefs/pref_store_observer_mock.h" 9 #include "base/prefs/pref_store_observer_mock.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 kTestPolicy, kTestPref, base::Value::TYPE_INTEGER))); 137 kTestPolicy, kTestPref, base::Value::TYPE_INTEGER)));
138 } 138 }
139 }; 139 };
140 140
141 TEST_F(ConfigurationPolicyPrefStoreIntegerTest, GetDefault) { 141 TEST_F(ConfigurationPolicyPrefStoreIntegerTest, GetDefault) {
142 EXPECT_FALSE(store_->GetValue(kTestPref, NULL)); 142 EXPECT_FALSE(store_->GetValue(kTestPref, NULL));
143 } 143 }
144 144
145 TEST_F(ConfigurationPolicyPrefStoreIntegerTest, SetValue) { 145 TEST_F(ConfigurationPolicyPrefStoreIntegerTest, SetValue) {
146 PolicyMap policy; 146 PolicyMap policy;
147 policy.Set(kTestPolicy, POLICY_LEVEL_MANDATORY, 147 policy.Set(kTestPolicy,
148 POLICY_SCOPE_USER, base::Value::CreateIntegerValue(2), NULL); 148 POLICY_LEVEL_MANDATORY,
149 POLICY_SCOPE_USER,
150 new base::FundamentalValue(2),
151 NULL);
149 UpdateProviderPolicy(policy); 152 UpdateProviderPolicy(policy);
150 const base::Value* value = NULL; 153 const base::Value* value = NULL;
151 EXPECT_TRUE(store_->GetValue(kTestPref, &value)); 154 EXPECT_TRUE(store_->GetValue(kTestPref, &value));
152 EXPECT_TRUE(base::FundamentalValue(2).Equals(value)); 155 EXPECT_TRUE(base::FundamentalValue(2).Equals(value));
153 } 156 }
154 157
155 // Exercises the policy refresh mechanism. 158 // Exercises the policy refresh mechanism.
156 class ConfigurationPolicyPrefStoreRefreshTest 159 class ConfigurationPolicyPrefStoreRefreshTest
157 : public ConfigurationPolicyPrefStoreTest { 160 : public ConfigurationPolicyPrefStoreTest {
158 protected: 161 protected:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 .WillRepeatedly(Return(true)); 205 .WillRepeatedly(Return(true));
203 PolicyMap policy; 206 PolicyMap policy;
204 UpdateProviderPolicy(policy); 207 UpdateProviderPolicy(policy);
205 EXPECT_TRUE(observer_.initialized); 208 EXPECT_TRUE(observer_.initialized);
206 EXPECT_TRUE(observer_.initialization_success); 209 EXPECT_TRUE(observer_.initialization_success);
207 Mock::VerifyAndClearExpectations(&observer_); 210 Mock::VerifyAndClearExpectations(&observer_);
208 EXPECT_TRUE(store_->IsInitializationComplete()); 211 EXPECT_TRUE(store_->IsInitializationComplete());
209 } 212 }
210 213
211 } // namespace policy 214 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698