• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 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_DEVICE_MANAGEMENT_BACKEND_MOCK_H_
6 #define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_MOCK_H_
7 
8 #include "chrome/browser/policy/device_management_backend.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10 
11 namespace policy {
12 
13 // Mock classes for the various DeviceManagementBackend delegates that allow to
14 // capture callbacks using gmock.
15 class DeviceRegisterResponseDelegateMock
16     : public DeviceManagementBackend::DeviceRegisterResponseDelegate {
17  public:
18   DeviceRegisterResponseDelegateMock();
19   virtual ~DeviceRegisterResponseDelegateMock();
20 
21   MOCK_METHOD1(HandleRegisterResponse, void(const em::DeviceRegisterResponse&));
22   MOCK_METHOD1(OnError, void(DeviceManagementBackend::ErrorCode error));
23 };
24 
25 class DeviceUnregisterResponseDelegateMock
26     : public DeviceManagementBackend::DeviceUnregisterResponseDelegate {
27  public:
28   DeviceUnregisterResponseDelegateMock();
29   virtual ~DeviceUnregisterResponseDelegateMock();
30 
31   MOCK_METHOD1(HandleUnregisterResponse,
32                void(const em::DeviceUnregisterResponse&));
33   MOCK_METHOD1(OnError, void(DeviceManagementBackend::ErrorCode error));
34 };
35 
36 class DevicePolicyResponseDelegateMock
37     : public DeviceManagementBackend::DevicePolicyResponseDelegate {
38  public:
39   DevicePolicyResponseDelegateMock();
40   virtual ~DevicePolicyResponseDelegateMock();
41 
42   MOCK_METHOD1(HandlePolicyResponse, void(const em::DevicePolicyResponse&));
43   MOCK_METHOD1(OnError, void(DeviceManagementBackend::ErrorCode error));
44 };
45 
46 }  // namespace policy
47 
48 #endif  // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_MOCK_H_
49