| 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_DEVICE_MANAGEMENT_SERVICE_H_ | |
| 6 #define CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_SERVICE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "chrome/browser/policy/device_management_service.h" | |
| 12 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | |
| 13 #include "testing/gmock/include/gmock/gmock.h" | |
| 14 | |
| 15 namespace policy { | |
| 16 | |
| 17 class MockDeviceManagementJob { | |
| 18 public: | |
| 19 virtual ~MockDeviceManagementJob(); | |
| 20 virtual void SendResponse( | |
| 21 DeviceManagementStatus status, | |
| 22 const enterprise_management::DeviceManagementResponse& response) = 0; | |
| 23 }; | |
| 24 | |
| 25 class MockDeviceManagementService : public DeviceManagementService { | |
| 26 public: | |
| 27 MockDeviceManagementService(); | |
| 28 virtual ~MockDeviceManagementService(); | |
| 29 | |
| 30 typedef DeviceManagementRequestJob* CreateJobFunction( | |
| 31 DeviceManagementRequestJob::JobType); | |
| 32 | |
| 33 MOCK_METHOD1(CreateJob, CreateJobFunction); | |
| 34 MOCK_METHOD7( | |
| 35 StartJob, | |
| 36 void(const std::string& request_type, | |
| 37 const std::string& gaia_token, | |
| 38 const std::string& oauth_token, | |
| 39 const std::string& dm_token, | |
| 40 const std::string& user_affiliation, | |
| 41 const std::string& client_id, | |
| 42 const enterprise_management::DeviceManagementRequest& request)); | |
| 43 | |
| 44 // Creates a gmock action that will make the job succeed. | |
| 45 testing::Action<CreateJobFunction> SucceedJob( | |
| 46 const enterprise_management::DeviceManagementResponse& response); | |
| 47 | |
| 48 // Creates a gmock action which will fail the job with the given error. | |
| 49 testing::Action<CreateJobFunction> FailJob(DeviceManagementStatus status); | |
| 50 | |
| 51 // Creates a gmock action which will capture the job so the test code can | |
| 52 // delay job completion. | |
| 53 testing::Action<CreateJobFunction> CreateAsyncJob( | |
| 54 MockDeviceManagementJob** job); | |
| 55 | |
| 56 private: | |
| 57 DISALLOW_COPY_AND_ASSIGN(MockDeviceManagementService); | |
| 58 }; | |
| 59 | |
| 60 } // namespace policy | |
| 61 | |
| 62 #endif // CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_SERVICE_H_ | |
| OLD | NEW |