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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // Fake policy values which are alternated to cause the store to report a | 204 // Fake policy values which are alternated to cause the store to report a |
205 // changed policy. | 205 // changed policy. |
206 const char* policy_value_a_; | 206 const char* policy_value_a_; |
207 const char* policy_value_b_; | 207 const char* policy_value_b_; |
208 | 208 |
209 // The currently used policy value. | 209 // The currently used policy value. |
210 const char* policy_value_cur_; | 210 const char* policy_value_cur_; |
211 }; | 211 }; |
212 | 212 |
213 CloudPolicyInvalidatorTest::CloudPolicyInvalidatorTest() | 213 CloudPolicyInvalidatorTest::CloudPolicyInvalidatorTest() |
214 : core_(PolicyNamespaceKey(dm_protocol::kChromeUserPolicyType, | 214 : core_(dm_protocol::kChromeUserPolicyType, |
215 std::string()), | 215 std::string(), |
216 &store_, | 216 &store_, |
217 loop_.message_loop_proxy()), | 217 loop_.message_loop_proxy()), |
218 client_(NULL), | 218 client_(nullptr), |
219 task_runner_(new base::TestSimpleTaskRunner()), | 219 task_runner_(new base::TestSimpleTaskRunner()), |
220 clock_(new base::SimpleTestClock()), | 220 clock_(new base::SimpleTestClock()), |
221 object_id_a_(135, "asdf"), | 221 object_id_a_(135, "asdf"), |
222 object_id_b_(246, "zxcv"), | 222 object_id_b_(246, "zxcv"), |
223 policy_value_a_("asdf"), | 223 policy_value_a_("asdf"), |
224 policy_value_b_("zxcv"), | 224 policy_value_b_("zxcv"), |
225 policy_value_cur_(policy_value_a_) { | 225 policy_value_cur_(policy_value_a_) { |
226 clock_->SetNow( | 226 clock_->SetNow( |
227 base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(987654321)); | 227 base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(987654321)); |
228 } | 228 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 client_ = new MockCloudPolicyClient(); | 267 client_ = new MockCloudPolicyClient(); |
268 client_->SetDMToken("dm"); | 268 client_->SetDMToken("dm"); |
269 core_.Connect(scoped_ptr<CloudPolicyClient>(client_)); | 269 core_.Connect(scoped_ptr<CloudPolicyClient>(client_)); |
270 } | 270 } |
271 | 271 |
272 void CloudPolicyInvalidatorTest::StartRefreshScheduler() { | 272 void CloudPolicyInvalidatorTest::StartRefreshScheduler() { |
273 core_.StartRefreshScheduler(); | 273 core_.StartRefreshScheduler(); |
274 } | 274 } |
275 | 275 |
276 void CloudPolicyInvalidatorTest::DisconnectCore() { | 276 void CloudPolicyInvalidatorTest::DisconnectCore() { |
277 client_ = NULL; | 277 client_ = nullptr; |
278 core_.Disconnect(); | 278 core_.Disconnect(); |
279 } | 279 } |
280 | 280 |
281 void CloudPolicyInvalidatorTest::StorePolicy( | 281 void CloudPolicyInvalidatorTest::StorePolicy( |
282 PolicyObject object, | 282 PolicyObject object, |
283 int64 invalidation_version, | 283 int64 invalidation_version, |
284 bool policy_changed, | 284 bool policy_changed, |
285 const base::Time& time) { | 285 const base::Time& time) { |
286 em::PolicyData* data = new em::PolicyData(); | 286 em::PolicyData* data = new em::PolicyData(); |
287 if (object != POLICY_OBJECT_NONE) { | 287 if (object != POLICY_OBJECT_NONE) { |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 CloudPolicyInvalidatorUserTypedTest, | 1101 CloudPolicyInvalidatorUserTypedTest, |
1102 testing::Values(em::DeviceRegisterRequest::IOS_BROWSER)); | 1102 testing::Values(em::DeviceRegisterRequest::IOS_BROWSER)); |
1103 #else | 1103 #else |
1104 INSTANTIATE_TEST_CASE_P( | 1104 INSTANTIATE_TEST_CASE_P( |
1105 CloudPolicyInvalidatorUserTypedTestInstance, | 1105 CloudPolicyInvalidatorUserTypedTestInstance, |
1106 CloudPolicyInvalidatorUserTypedTest, | 1106 CloudPolicyInvalidatorUserTypedTest, |
1107 testing::Values(em::DeviceRegisterRequest::BROWSER)); | 1107 testing::Values(em::DeviceRegisterRequest::BROWSER)); |
1108 #endif | 1108 #endif |
1109 | 1109 |
1110 } // namespace policy | 1110 } // namespace policy |
OLD | NEW |