| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_MOCK_CLOUD_POLICY_CLIENT_H_ | |
| 6 #define CHROME_BROWSER_POLICY_CLOUD_MOCK_CLOUD_POLICY_CLIENT_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "chrome/browser/policy/cloud/cloud_policy_client.h" | |
| 12 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" | |
| 13 #include "testing/gmock/include/gmock/gmock.h" | |
| 14 | |
| 15 namespace policy { | |
| 16 | |
| 17 class MockCloudPolicyClient : public CloudPolicyClient { | |
| 18 public: | |
| 19 MockCloudPolicyClient(); | |
| 20 virtual ~MockCloudPolicyClient(); | |
| 21 | |
| 22 MOCK_METHOD2(SetupRegistration, void(const std::string&, const std::string&)); | |
| 23 MOCK_METHOD5(Register, void( | |
| 24 enterprise_management::DeviceRegisterRequest::Type type, | |
| 25 const std::string&, const std::string&, bool, const std::string&)); | |
| 26 MOCK_METHOD0(FetchPolicy, void(void)); | |
| 27 MOCK_METHOD0(Unregister, void(void)); | |
| 28 MOCK_METHOD2(UploadCertificate, | |
| 29 void(const std::string&, const StatusCallback&)); | |
| 30 | |
| 31 // Sets the DMToken. | |
| 32 void SetDMToken(const std::string& token); | |
| 33 | |
| 34 // Injects policy. | |
| 35 void SetPolicy(const PolicyNamespaceKey& policy_ns_key, | |
| 36 const enterprise_management::PolicyFetchResponse& policy); | |
| 37 | |
| 38 // Sets the status field. | |
| 39 void SetStatus(DeviceManagementStatus status); | |
| 40 | |
| 41 // Make the notification helpers public. | |
| 42 using CloudPolicyClient::NotifyPolicyFetched; | |
| 43 using CloudPolicyClient::NotifyRegistrationStateChanged; | |
| 44 using CloudPolicyClient::NotifyClientError; | |
| 45 | |
| 46 using CloudPolicyClient::dm_token_; | |
| 47 using CloudPolicyClient::client_id_; | |
| 48 using CloudPolicyClient::submit_machine_id_; | |
| 49 using CloudPolicyClient::last_policy_timestamp_; | |
| 50 using CloudPolicyClient::public_key_version_; | |
| 51 using CloudPolicyClient::public_key_version_valid_; | |
| 52 using CloudPolicyClient::namespaces_to_fetch_; | |
| 53 using CloudPolicyClient::invalidation_version_; | |
| 54 using CloudPolicyClient::invalidation_payload_; | |
| 55 using CloudPolicyClient::fetched_invalidation_version_; | |
| 56 | |
| 57 private: | |
| 58 DISALLOW_COPY_AND_ASSIGN(MockCloudPolicyClient); | |
| 59 }; | |
| 60 | |
| 61 class MockCloudPolicyClientObserver : public CloudPolicyClient::Observer { | |
| 62 public: | |
| 63 MockCloudPolicyClientObserver(); | |
| 64 virtual ~MockCloudPolicyClientObserver(); | |
| 65 | |
| 66 MOCK_METHOD1(OnPolicyFetched, void(CloudPolicyClient*)); | |
| 67 MOCK_METHOD1(OnRegistrationStateChanged, void(CloudPolicyClient*)); | |
| 68 MOCK_METHOD1(OnRobotAuthCodesFetched, void(CloudPolicyClient*)); | |
| 69 MOCK_METHOD1(OnClientError, void(CloudPolicyClient*)); | |
| 70 | |
| 71 private: | |
| 72 DISALLOW_COPY_AND_ASSIGN(MockCloudPolicyClientObserver); | |
| 73 }; | |
| 74 | |
| 75 } // namespace policy | |
| 76 | |
| 77 #endif // CHROME_BROWSER_POLICY_CLOUD_MOCK_CLOUD_POLICY_CLIENT_H_ | |
| OLD | NEW |