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 "chrome/browser/policy/cloud/cloud_policy_invalidator.h" | 5 #include "chrome/browser/policy/cloud/cloud_policy_invalidator.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 278 |
279 void CloudPolicyInvalidatorTest::StorePolicy(PolicyObject object, | 279 void CloudPolicyInvalidatorTest::StorePolicy(PolicyObject object, |
280 int64_t invalidation_version, | 280 int64_t invalidation_version, |
281 bool policy_changed, | 281 bool policy_changed, |
282 const base::Time& time) { | 282 const base::Time& time) { |
283 em::PolicyData* data = new em::PolicyData(); | 283 em::PolicyData* data = new em::PolicyData(); |
284 if (object != POLICY_OBJECT_NONE) { | 284 if (object != POLICY_OBJECT_NONE) { |
285 data->set_invalidation_source(GetPolicyObjectId(object).source()); | 285 data->set_invalidation_source(GetPolicyObjectId(object).source()); |
286 data->set_invalidation_name(GetPolicyObjectId(object).name()); | 286 data->set_invalidation_name(GetPolicyObjectId(object).name()); |
287 } | 287 } |
288 data->set_timestamp((time - base::Time::UnixEpoch()).InMilliseconds()); | 288 data->set_timestamp(time.ToJavaTime()); |
289 // Swap the policy value if a policy change is desired. | 289 // Swap the policy value if a policy change is desired. |
290 if (policy_changed) | 290 if (policy_changed) |
291 policy_value_cur_ = policy_value_cur_ == policy_value_a_ ? | 291 policy_value_cur_ = policy_value_cur_ == policy_value_a_ ? |
292 policy_value_b_ : policy_value_a_; | 292 policy_value_b_ : policy_value_a_; |
293 data->set_policy_value(policy_value_cur_); | 293 data->set_policy_value(policy_value_cur_); |
294 store_.invalidation_version_ = invalidation_version; | 294 store_.invalidation_version_ = invalidation_version; |
295 store_.policy_.reset(data); | 295 store_.policy_.reset(data); |
296 base::DictionaryValue policies; | 296 base::DictionaryValue policies; |
297 policies.SetInteger( | 297 policies.SetInteger( |
298 key::kMaxInvalidationFetchDelay, | 298 key::kMaxInvalidationFetchDelay, |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 CloudPolicyInvalidatorUserTypedTest, | 1095 CloudPolicyInvalidatorUserTypedTest, |
1096 testing::Values(em::DeviceRegisterRequest::ANDROID_BROWSER)); | 1096 testing::Values(em::DeviceRegisterRequest::ANDROID_BROWSER)); |
1097 #else | 1097 #else |
1098 INSTANTIATE_TEST_CASE_P( | 1098 INSTANTIATE_TEST_CASE_P( |
1099 CloudPolicyInvalidatorUserTypedTestInstance, | 1099 CloudPolicyInvalidatorUserTypedTestInstance, |
1100 CloudPolicyInvalidatorUserTypedTest, | 1100 CloudPolicyInvalidatorUserTypedTest, |
1101 testing::Values(em::DeviceRegisterRequest::BROWSER)); | 1101 testing::Values(em::DeviceRegisterRequest::BROWSER)); |
1102 #endif | 1102 #endif |
1103 | 1103 |
1104 } // namespace policy | 1104 } // namespace policy |
OLD | NEW |