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_MOCK_CLOUD_POLICY_CLIENT_H_ | |
6 #define CHROME_BROWSER_POLICY_MOCK_CLOUD_POLICY_CLIENT_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "chrome/browser/policy/cloud_policy_client.h" | |
12 #include "chrome/browser/policy/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_METHOD4(Register, void( | |
24 enterprise_management::DeviceRegisterRequest::Type type, | |
25 const std::string&, | |
26 const std::string&, | |
27 bool)); | |
28 MOCK_METHOD0(FetchPolicy, void(void)); | |
29 MOCK_METHOD0(Unregister, void(void)); | |
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 | |
54 private: | |
55 DISALLOW_COPY_AND_ASSIGN(MockCloudPolicyClient); | |
56 }; | |
57 | |
58 class MockCloudPolicyClientObserver : public CloudPolicyClient::Observer { | |
59 public: | |
60 MockCloudPolicyClientObserver(); | |
61 virtual ~MockCloudPolicyClientObserver(); | |
62 | |
63 MOCK_METHOD1(OnPolicyFetched, void(CloudPolicyClient*)); | |
64 MOCK_METHOD1(OnRegistrationStateChanged, void(CloudPolicyClient*)); | |
65 MOCK_METHOD1(OnClientError, void(CloudPolicyClient*)); | |
66 | |
67 private: | |
68 DISALLOW_COPY_AND_ASSIGN(MockCloudPolicyClientObserver); | |
69 }; | |
70 | |
71 } // namespace policy | |
72 | |
73 #endif // CHROME_BROWSER_POLICY_MOCK_CLOUD_POLICY_CLIENT_H_ | |
OLD | NEW |