OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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_BACKEND_H_ |
| 6 #define CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "chrome/browser/policy/device_management_backend.h" |
| 12 |
| 13 namespace policy { |
| 14 |
| 15 namespace em = enterprise_management; |
| 16 |
| 17 // Useful for unit testing when a server-based backend isn't |
| 18 // available. Simulates both successful and failed requests to the device |
| 19 // management server. |
| 20 class MockDeviceManagementBackend |
| 21 : public DeviceManagementBackend { |
| 22 public: |
| 23 MockDeviceManagementBackend(); |
| 24 virtual ~MockDeviceManagementBackend() {} |
| 25 |
| 26 void SetFailure(bool failure) { failure_ = failure; } |
| 27 |
| 28 // DeviceManagementBackend method overrides: |
| 29 virtual void ProcessRegisterRequest( |
| 30 const std::string& auth_token, |
| 31 const std::string& device_id, |
| 32 const em::DeviceRegisterRequest& request, |
| 33 DeviceRegisterResponseDelegate* delegate); |
| 34 |
| 35 virtual void ProcessUnregisterRequest( |
| 36 const std::string& device_management_token, |
| 37 const em::DeviceUnregisterRequest& request, |
| 38 DeviceUnregisterResponseDelegate* delegate); |
| 39 |
| 40 virtual void ProcessPolicyRequest( |
| 41 const std::string& device_management_token, |
| 42 const em::DevicePolicyRequest& request, |
| 43 DevicePolicyResponseDelegate* delegate); |
| 44 |
| 45 private: |
| 46 bool failure_; |
| 47 DISALLOW_COPY_AND_ASSIGN(MockDeviceManagementBackend); |
| 48 }; |
| 49 |
| 50 } // namespace policy |
| 51 |
| 52 #endif // CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_ |
OLD | NEW |