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