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 <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 em::DeviceManagementResponse upload_certificate_response_; | 197 em::DeviceManagementResponse upload_certificate_response_; |
198 | 198 |
199 base::MessageLoop loop_; | 199 base::MessageLoop loop_; |
200 std::string client_id_; | 200 std::string client_id_; |
201 PolicyNamespaceKey policy_ns_key_; | 201 PolicyNamespaceKey policy_ns_key_; |
202 MockDeviceManagementService service_; | 202 MockDeviceManagementService service_; |
203 StrictMock<MockStatusProvider> status_provider_; | 203 StrictMock<MockStatusProvider> status_provider_; |
204 StrictMock<MockCloudPolicyClientObserver> observer_; | 204 StrictMock<MockCloudPolicyClientObserver> observer_; |
205 StrictMock<MockUploadCertificateObserver> upload_certificate_observer_; | 205 StrictMock<MockUploadCertificateObserver> upload_certificate_observer_; |
206 scoped_ptr<CloudPolicyClient> client_; | 206 scoped_ptr<CloudPolicyClient> client_; |
207 // Cached weak pointer to the client's request context. | 207 // Pointer to the client's request context. |
208 net::URLRequestContextGetter* request_context_; | 208 scoped_refptr<net::URLRequestContextGetter> request_context_; |
bartfab (slow)
2014/08/29 09:42:38
Nit: #include "base/memory/ref_counted.h"
dcheng
2014/08/29 09:56:37
Done.
| |
209 }; | 209 }; |
210 | 210 |
211 TEST_F(CloudPolicyClientTest, Init) { | 211 TEST_F(CloudPolicyClientTest, Init) { |
212 EXPECT_CALL(service_, CreateJob(_, _)).Times(0); | 212 EXPECT_CALL(service_, CreateJob(_, _)).Times(0); |
213 EXPECT_FALSE(client_->is_registered()); | 213 EXPECT_FALSE(client_->is_registered()); |
214 EXPECT_FALSE(client_->GetPolicyFor(policy_ns_key_)); | 214 EXPECT_FALSE(client_->GetPolicyFor(policy_ns_key_)); |
215 EXPECT_EQ(0, client_->fetched_invalidation_version()); | 215 EXPECT_EQ(0, client_->fetched_invalidation_version()); |
216 } | 216 } |
217 | 217 |
218 TEST_F(CloudPolicyClientTest, SetupRegistrationAndPolicyFetch) { | 218 TEST_F(CloudPolicyClientTest, SetupRegistrationAndPolicyFetch) { |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
581 EXPECT_CALL(service_, StartJob(_, _, _, _, _, _, _)); | 581 EXPECT_CALL(service_, StartJob(_, _, _, _, _, _, _)); |
582 EXPECT_CALL(observer_, OnClientError(_)); | 582 EXPECT_CALL(observer_, OnClientError(_)); |
583 CloudPolicyClient::StatusCallback callback = base::Bind( | 583 CloudPolicyClient::StatusCallback callback = base::Bind( |
584 &MockUploadCertificateObserver::OnUploadComplete, | 584 &MockUploadCertificateObserver::OnUploadComplete, |
585 base::Unretained(&upload_certificate_observer_)); | 585 base::Unretained(&upload_certificate_observer_)); |
586 client_->UploadCertificate(kDeviceCertificate, callback); | 586 client_->UploadCertificate(kDeviceCertificate, callback); |
587 EXPECT_EQ(DM_STATUS_REQUEST_FAILED, client_->status()); | 587 EXPECT_EQ(DM_STATUS_REQUEST_FAILED, client_->status()); |
588 } | 588 } |
589 | 589 |
590 } // namespace policy | 590 } // namespace policy |
OLD | NEW |