• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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 #ifndef ANDROID_HARDWARE_VIBRATOR_TEST_MOCKS_H
17 #define ANDROID_HARDWARE_VIBRATOR_TEST_MOCKS_H
18 
19 #include "Vibrator.h"
20 
21 class MockApi : public ::aidl::android::hardware::vibrator::Vibrator::HwApi {
22   public:
23     MOCK_METHOD0(destructor, void());
24     MOCK_METHOD1(setAutocal, bool(std::string value));
25     MOCK_METHOD1(setOlLraPeriod, bool(uint32_t value));
26     MOCK_METHOD1(setActivate, bool(bool value));
27     MOCK_METHOD1(setDuration, bool(uint32_t value));
28     MOCK_METHOD1(setState, bool(bool value));
29     MOCK_METHOD0(hasRtpInput, bool());
30     MOCK_METHOD1(setRtpInput, bool(int8_t value));
31     MOCK_METHOD1(setMode, bool(std::string value));
32     MOCK_METHOD1(setSequencer, bool(std::string value));
33     MOCK_METHOD1(setScale, bool(uint8_t value));
34     MOCK_METHOD1(setCtrlLoop, bool(bool value));
35     MOCK_METHOD1(setLpTriggerEffect, bool(uint32_t value));
36     MOCK_METHOD1(setLraWaveShape, bool(uint32_t value));
37     MOCK_METHOD1(setOdClamp, bool(uint32_t value));
38     MOCK_METHOD1(getPATemp, bool(int32_t *value));
39     MOCK_METHOD1(debug, void(int fd));
40 
~MockApi()41     ~MockApi() override { destructor(); };
42 };
43 
44 class MockCal : public ::aidl::android::hardware::vibrator::Vibrator::HwCal {
45   public:
46     MOCK_METHOD0(destructor, void());
47     MOCK_METHOD1(getAutocal, bool(std::string &value));  // NOLINT
48     MOCK_METHOD1(getLraPeriod, bool(uint32_t *value));
49     MOCK_METHOD1(getEffectCoeffs, bool(std::array<float, 4> *value));
50     MOCK_METHOD1(getSteadyAmpMax, bool(float *value));
51     MOCK_METHOD1(getSteadyCoeffs, bool(std::array<float, 4> *value));
52     MOCK_METHOD1(getCloseLoopThreshold, bool(uint32_t *value));
53     MOCK_METHOD1(getDynamicConfig, bool(bool *value));
54     MOCK_METHOD1(getLongFrequencyShift, bool(uint32_t *value));
55     MOCK_METHOD1(getShortVoltageMax, bool(uint32_t *value));
56     MOCK_METHOD1(getLongVoltageMax, bool(uint32_t *value));
57     MOCK_METHOD1(getClickDuration, bool(uint32_t *value));
58     MOCK_METHOD1(getTickDuration, bool(uint32_t *value));
59     MOCK_METHOD1(getDoubleClickDuration, bool(uint32_t *value));
60     MOCK_METHOD1(getHeavyClickDuration, bool(uint32_t *value));
61     MOCK_METHOD1(getEffectShape, bool(uint32_t *value));
62     MOCK_METHOD1(getSteadyShape, bool(uint32_t *value));
63     MOCK_METHOD1(getTriggerEffectSupport, bool(uint32_t *value));
64     MOCK_METHOD1(getDevHwVer, bool(std::string &value));
65     MOCK_METHOD1(debug, void(int fd));
66 
~MockCal()67     ~MockCal() override { destructor(); };
68     // b/132668253: Workaround gMock Compilation Issue
getAutocal(std::string * value)69     bool getAutocal(std::string *value) { return getAutocal(*value); }
70 };
71 
72 #endif  // ANDROID_HARDWARE_VIBRATOR_TEST_MOCKS_H
73