summaryrefslogtreecommitdiffstats
path: root/chrome/browser/policy/device_management_backend_mock.h
blob: 01ac14d4da7a7cc416f801a9265f91d2814bd838 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_MOCK_H_
#define CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_MOCK_H_

#include "chrome/browser/policy/device_management_backend.h"
#include "testing/gmock/include/gmock/gmock.h"

namespace policy {

// Mock classes for the various DeviceManagementBackend delegates that allow to
// capture callbacks using gmock.
class DeviceRegisterResponseDelegateMock
    : public DeviceManagementBackend::DeviceRegisterResponseDelegate {
 public:
  DeviceRegisterResponseDelegateMock();
  virtual ~DeviceRegisterResponseDelegateMock();

  MOCK_METHOD1(HandleRegisterResponse, void(const em::DeviceRegisterResponse&));
  MOCK_METHOD1(OnError, void(DeviceManagementBackend::ErrorCode error));
};

class DeviceUnregisterResponseDelegateMock
    : public DeviceManagementBackend::DeviceUnregisterResponseDelegate {
 public:
  DeviceUnregisterResponseDelegateMock();
  virtual ~DeviceUnregisterResponseDelegateMock();

  MOCK_METHOD1(HandleUnregisterResponse,
               void(const em::DeviceUnregisterResponse&));
  MOCK_METHOD1(OnError, void(DeviceManagementBackend::ErrorCode error));
};

class DevicePolicyResponseDelegateMock
    : public DeviceManagementBackend::DevicePolicyResponseDelegate {
 public:
  DevicePolicyResponseDelegateMock();
  virtual ~DevicePolicyResponseDelegateMock();

  MOCK_METHOD1(HandlePolicyResponse, void(const em::DevicePolicyResponse&));
  MOCK_METHOD1(HandleCloudPolicyResponse, void(const em::CloudPolicyResponse&));
  MOCK_METHOD1(OnError, void(DeviceManagementBackend::ErrorCode error));
};

}  // namespace policy

#endif  // CHROME_BROWSER_POLICY_DEVICE_MANAGEMENT_BACKEND_MOCK_H_