| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/cloud/cloud_policy_client.h" | 5 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 client_->FetchPolicy(); | 524 client_->FetchPolicy(); |
| 525 EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); | 525 EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); |
| 526 CheckPolicyResponse(); | 526 CheckPolicyResponse(); |
| 527 } | 527 } |
| 528 | 528 |
| 529 TEST_F(CloudPolicyClientTest, PolicyFetchWithMetaData) { | 529 TEST_F(CloudPolicyClientTest, PolicyFetchWithMetaData) { |
| 530 Register(); | 530 Register(); |
| 531 | 531 |
| 532 const base::Time timestamp( | 532 const base::Time timestamp( |
| 533 base::Time::UnixEpoch() + base::TimeDelta::FromDays(20)); | 533 base::Time::UnixEpoch() + base::TimeDelta::FromDays(20)); |
| 534 client_->set_submit_machine_id(true); | |
| 535 client_->set_last_policy_timestamp(timestamp); | 534 client_->set_last_policy_timestamp(timestamp); |
| 536 client_->set_public_key_version(42); | 535 client_->set_public_key_version(42); |
| 537 em::PolicyFetchRequest* policy_fetch_request = | 536 em::PolicyFetchRequest* policy_fetch_request = |
| 538 policy_request_.mutable_policy_request()->mutable_request(0); | 537 policy_request_.mutable_policy_request()->mutable_request(0); |
| 539 policy_fetch_request->set_machine_id(kMachineID); | |
| 540 policy_fetch_request->set_timestamp(timestamp.ToJavaTime()); | 538 policy_fetch_request->set_timestamp(timestamp.ToJavaTime()); |
| 541 policy_fetch_request->set_public_key_version(42); | 539 policy_fetch_request->set_public_key_version(42); |
| 542 | 540 |
| 543 ExpectPolicyFetch(kDMToken); | 541 ExpectPolicyFetch(kDMToken); |
| 544 EXPECT_CALL(observer_, OnPolicyFetched(_)); | 542 EXPECT_CALL(observer_, OnPolicyFetched(_)); |
| 545 client_->FetchPolicy(); | 543 client_->FetchPolicy(); |
| 546 CheckPolicyResponse(); | 544 CheckPolicyResponse(); |
| 547 } | 545 } |
| 548 | 546 |
| 549 TEST_F(CloudPolicyClientTest, PolicyFetchWithInvalidation) { | 547 TEST_F(CloudPolicyClientTest, PolicyFetchWithInvalidation) { |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 EXPECT_CALL(callback_observer_, OnCallbackComplete(true)).Times(1); | 946 EXPECT_CALL(callback_observer_, OnCallbackComplete(true)).Times(1); |
| 949 | 947 |
| 950 CloudPolicyClient::StatusCallback callback = | 948 CloudPolicyClient::StatusCallback callback = |
| 951 base::Bind(&MockStatusCallbackObserver::OnCallbackComplete, | 949 base::Bind(&MockStatusCallbackObserver::OnCallbackComplete, |
| 952 base::Unretained(&callback_observer_)); | 950 base::Unretained(&callback_observer_)); |
| 953 client_->UpdateGcmId(kGcmID, callback); | 951 client_->UpdateGcmId(kGcmID, callback); |
| 954 EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); | 952 EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); |
| 955 } | 953 } |
| 956 | 954 |
| 957 } // namespace policy | 955 } // namespace policy |
| OLD | NEW |