1/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_MOCK_INPUT_HOST_H_
18#define ANDROID_MOCK_INPUT_HOST_H_
19
20#include "InputHost.h"
21
22#include "gmock/gmock.h"
23
24
25namespace android {
26namespace tests {
27
28class MockInputReport : public InputReport {
29public:
30    MockInputReport() : InputReport(nullptr, {}, nullptr) {}
31    MOCK_METHOD4(setIntUsage, void(InputCollectionId id, InputUsage usage, int32_t value,
32                int32_t arityIndex));
33    MOCK_METHOD4(setBoolUsage, void(InputCollectionId id, InputUsage usage, bool value,
34                int32_t arityIndex));
35    MOCK_METHOD1(reportEvent, void(InputDeviceHandle* d));
36};
37
38class MockInputReportDefinition : public InputReportDefinition {
39public:
40    MockInputReportDefinition() : InputReportDefinition(nullptr, {}, nullptr) {}
41    MOCK_METHOD2(addCollection, void(InputCollectionId id, int32_t arity));
42    MOCK_METHOD5(declareUsage, void(InputCollectionId id, InputUsage usage, int32_t min,
43                int32_t max, float resolution));
44    MOCK_METHOD3(declareUsages, void(InputCollectionId id, InputUsage* usage, size_t usageCount));
45    MOCK_METHOD0(allocateReport, InputReport*());
46};
47
48class MockInputDeviceDefinition : public InputDeviceDefinition {
49public:
50    MockInputDeviceDefinition() : InputDeviceDefinition(nullptr, {}, nullptr) {}
51    MOCK_METHOD1(addReport, void(InputReportDefinition* r));
52};
53
54class MockInputProperty : public InputProperty {
55public:
56    MockInputProperty() : InputProperty(nullptr, {}, nullptr) {}
57    virtual ~MockInputProperty() {}
58    MOCK_CONST_METHOD0(getKey, const char*());
59    MOCK_CONST_METHOD0(getValue, const char*());
60};
61
62class MockInputPropertyMap : public InputPropertyMap {
63public:
64    MockInputPropertyMap() : InputPropertyMap(nullptr, {}, nullptr) {}
65    virtual ~MockInputPropertyMap() {}
66    MOCK_CONST_METHOD1(getDeviceProperty, InputProperty*(const char* key));
67    MOCK_CONST_METHOD1(freeDeviceProperty, void(InputProperty* property));
68};
69
70class MockInputHost : public InputHostInterface {
71public:
72    MOCK_METHOD5(createDeviceIdentifier, InputDeviceIdentifier*(
73                const char* name, int32_t productId, int32_t vendorId, InputBus bus,
74                const char* uniqueId));
75    MOCK_METHOD0(createDeviceDefinition, InputDeviceDefinition*());
76    MOCK_METHOD0(createInputReportDefinition, InputReportDefinition*());
77    MOCK_METHOD0(createOutputReportDefinition, InputReportDefinition*());
78    MOCK_METHOD1(freeReportDefinition, void(InputReportDefinition* reportDef));
79    MOCK_METHOD2(registerDevice, InputDeviceHandle*(InputDeviceIdentifier* id,
80                InputDeviceDefinition* d));
81    MOCK_METHOD1(unregisterDevice, void(InputDeviceHandle* handle));
82    MOCK_METHOD1(getDevicePropertyMap, InputPropertyMap*(InputDeviceIdentifier* id));
83    MOCK_METHOD1(freeDevicePropertyMap, void(InputPropertyMap* propertyMap));
84};
85
86}  // namespace tests
87}  // namespace android
88
89#endif  // ANDROID_MOCK_INPUT_HOST_H_
90