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

Side by Side Diff: chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc

Issue 2830033003: Use {To/From}JavaTime for policy timestamps (Closed)
Patch Set: Rebase Created 3 years, 8 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 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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/cloud_policy_invalidator.cc ('k') | components/policy/core/common/cloud/cloud_policy_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698