OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_ |
6 #define CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_ | 6 #define CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/policy/device_management_backend.h" | 13 #include "chrome/browser/policy/device_management_backend.h" |
14 #include "chrome/browser/policy/proto/device_management_constants.h" | 14 #include "chrome/browser/policy/proto/device_management_constants.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace policy { | 18 namespace policy { |
19 | 19 |
20 namespace em = enterprise_management; | 20 namespace em = enterprise_management; |
21 | 21 |
22 // Useful for unit testing when a server-based backend isn't | 22 // Useful for unit testing when a server-based backend isn't |
23 // available. Simulates both successful and failed requests to the device | 23 // available. Simulates both successful and failed requests to the device |
24 // management server. | 24 // management server. |
25 class MockDeviceManagementBackend | 25 class MockDeviceManagementBackend : public DeviceManagementBackend { |
26 : public DeviceManagementBackend { | |
27 public: | 26 public: |
28 MockDeviceManagementBackend() {} | 27 MockDeviceManagementBackend(); |
29 virtual ~MockDeviceManagementBackend() {} | 28 virtual ~MockDeviceManagementBackend(); |
30 | 29 |
31 // DeviceManagementBackend method overrides: | 30 // DeviceManagementBackend method overrides: |
32 MOCK_METHOD4(ProcessRegisterRequest, void( | 31 MOCK_METHOD4(ProcessRegisterRequest, void( |
33 const std::string& auth_token, | 32 const std::string& auth_token, |
34 const std::string& device_id, | 33 const std::string& device_id, |
35 const em::DeviceRegisterRequest& request, | 34 const em::DeviceRegisterRequest& request, |
36 DeviceRegisterResponseDelegate* delegate)); | 35 DeviceRegisterResponseDelegate* delegate)); |
37 | 36 |
38 MOCK_METHOD4(ProcessUnregisterRequest, void( | 37 MOCK_METHOD4(ProcessUnregisterRequest, void( |
39 const std::string& device_management_token, | 38 const std::string& device_management_token, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 arg3->OnError(error); | 77 arg3->OnError(error); |
79 } | 78 } |
80 | 79 |
81 ACTION_P(MockDeviceManagementBackendFailPolicy, error) { | 80 ACTION_P(MockDeviceManagementBackendFailPolicy, error) { |
82 arg3->OnError(error); | 81 arg3->OnError(error); |
83 } | 82 } |
84 | 83 |
85 } // namespace policy | 84 } // namespace policy |
86 | 85 |
87 #endif // CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_ | 86 #endif // CHROME_BROWSER_POLICY_MOCK_DEVICE_MANAGEMENT_BACKEND_H_ |
OLD | NEW |