1 /*
2  * Copyright (c) 2022, 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 CPP_WATCHDOG_SERVER_TESTS_MOCKVEHICLE_H_
18 #define CPP_WATCHDOG_SERVER_TESTS_MOCKVEHICLE_H_
19 
20 #include <aidl/android/hardware/automotive/vehicle/BnVehicle.h>
21 #include <gmock/gmock.h>
22 
23 namespace android {
24 namespace automotive {
25 namespace watchdog {
26 
27 class MockVehicle final : public aidl::android::hardware::automotive::vehicle::BnVehicle {
28 public:
MockVehicle()29     MockVehicle() {
30         ON_CALL(*this, unsubscribe(::testing::_, ::testing::_)).WillByDefault([]() {
31             return ndk::ScopedAStatus::ok();
32         });
33     }
34 
35     MOCK_METHOD(ndk::ScopedAStatus, getAllPropConfigs,
36                 (aidl::android::hardware::automotive::vehicle::VehiclePropConfigs*), (override));
37     MOCK_METHOD(ndk::ScopedAStatus, getPropConfigs,
38                 (const std::vector<int32_t>&,
39                  aidl::android::hardware::automotive::vehicle::VehiclePropConfigs*),
40                 (override));
41     MOCK_METHOD(
42             ndk::ScopedAStatus, getValues,
43             (const std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>&,
44              const aidl::android::hardware::automotive::vehicle::GetValueRequests&),
45             (override));
46     MOCK_METHOD(
47             ndk::ScopedAStatus, setValues,
48             (const std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>&,
49              const aidl::android::hardware::automotive::vehicle::SetValueRequests&),
50             (override));
51     MOCK_METHOD(
52             ndk::ScopedAStatus, subscribe,
53             (const std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>&,
54              const std::vector<aidl::android::hardware::automotive::vehicle::SubscribeOptions>&,
55              int32_t),
56             (override));
57     MOCK_METHOD(
58             ndk::ScopedAStatus, unsubscribe,
59             (const std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>&,
60              const std::vector<int32_t>&),
61             (override));
62     MOCK_METHOD(
63             ndk::ScopedAStatus, returnSharedMemory,
64             (const std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>&,
65              int64_t),
66             (override));
67 };
68 
69 }  // namespace watchdog
70 }  // namespace automotive
71 }  // namespace android
72 
73 #endif  // CPP_WATCHDOG_SERVER_TESTS_MOCKVEHICLE_H_
74