blob: a91f95c6add54698c588dc03521cba6e5fe49bc2 [file] [log] [blame]
Tim Kilbourn4f3145d2015-05-04 17:26:30 -07001/*
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 "gmock/gmock.h"
21
22#include "InputHost.h"
23
24namespace android {
25namespace tests {
26
27class MockInputReport : public InputReport {
28public:
29 MockInputReport() : InputReport(nullptr, {}, nullptr) {}
30 MOCK_METHOD4(setIntUsage, void(InputCollectionId id, InputUsage usage, int32_t value,
31 int32_t arityIndex));
32 MOCK_METHOD4(setBoolUsage, void(InputCollectionId id, InputUsage usage, bool value,
33 int32_t arityIndex));
34 MOCK_METHOD1(reportEvent, void(InputDeviceHandle* d));
35};
36
37class MockInputReportDefinition : public InputReportDefinition {
38public:
39 MockInputReportDefinition() : InputReportDefinition(nullptr, {}, nullptr) {}
40 MOCK_METHOD2(addCollection, void(InputCollectionId id, int32_t arity));
41 MOCK_METHOD5(declareUsage, void(InputCollectionId id, InputUsage usage, int32_t min,
42 int32_t max, float resolution));
43 MOCK_METHOD3(declareUsages, void(InputCollectionId id, InputUsage* usage, size_t usageCount));
44 MOCK_METHOD0(allocateReport, InputReport*());
45};
46
47class MockInputDeviceDefinition : public InputDeviceDefinition {
48public:
49 MockInputDeviceDefinition() : InputDeviceDefinition(nullptr, {}, nullptr) {}
50 MOCK_METHOD1(addReport, void(InputReportDefinition* r));
51};
52
53class MockInputProperty : public InputProperty {
54public:
55 MockInputProperty() : InputProperty(nullptr, {}, nullptr) {}
56 virtual ~MockInputProperty() {}
57 MOCK_CONST_METHOD0(getKey, const char*());
58 MOCK_CONST_METHOD0(getValue, const char*());
59};
60
61class MockInputPropertyMap : public InputPropertyMap {
62public:
63 MockInputPropertyMap() : InputPropertyMap(nullptr, {}, nullptr) {}
64 virtual ~MockInputPropertyMap() {}
65 MOCK_CONST_METHOD1(getDeviceProperty, InputProperty*(const char* key));
66 MOCK_CONST_METHOD1(freeDeviceProperty, void(InputProperty* property));
67};
68
69class MockInputHost : public InputHostInterface {
70public:
71 MOCK_METHOD5(createDeviceIdentifier, InputDeviceIdentifier*(
72 const char* name, int32_t productId, int32_t vendorId, InputBus bus,
73 const char* uniqueId));
74 MOCK_METHOD0(createDeviceDefinition, InputDeviceDefinition*());
75 MOCK_METHOD0(createInputReportDefinition, InputReportDefinition*());
76 MOCK_METHOD0(createOutputReportDefinition, InputReportDefinition*());
77 MOCK_METHOD1(freeReportDefinition, void(InputReportDefinition* reportDef));
78 MOCK_METHOD2(registerDevice, InputDeviceHandle*(InputDeviceIdentifier* id,
79 InputDeviceDefinition* d));
80 MOCK_METHOD1(unregisterDevice, void(InputDeviceHandle* handle));
81 MOCK_METHOD1(getDevicePropertyMap, InputPropertyMap*(InputDeviceIdentifier* id));
82 MOCK_METHOD1(freeDevicePropertyMap, void(InputPropertyMap* propertyMap));
83};
84
85} // namespace tests
86} // namespace android
87
88#endif // ANDROID_MOCK_INPUT_HOST_H_