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 #pragma once
18 
19 #include <aidl/android/hardware/automotive/vehicle/BnVehicle.h>
20 #include <gmock/gmock.h>
21 
22 namespace android {
23 namespace automotive {
24 namespace watchdog {
25 
26 class MockVehicle final : public aidl::android::hardware::automotive::vehicle::BnVehicle {
27 public:
MockVehicle()28     MockVehicle() {
29         ON_CALL(*this, unsubscribe(::testing::_, ::testing::_)).WillByDefault([]() {
30             return ndk::ScopedAStatus::ok();
31         });
32     }
33 
34     MOCK_METHOD(ndk::ScopedAStatus, getAllPropConfigs,
35                 (aidl::android::hardware::automotive::vehicle::VehiclePropConfigs*), (override));
36     MOCK_METHOD(ndk::ScopedAStatus, getPropConfigs,
37                 (const std::vector<int32_t>&,
38                  aidl::android::hardware::automotive::vehicle::VehiclePropConfigs*),
39                 (override));
40     MOCK_METHOD(
41             ndk::ScopedAStatus, getValues,
42             (const std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>&,
43              const aidl::android::hardware::automotive::vehicle::GetValueRequests&),
44             (override));
45     MOCK_METHOD(
46             ndk::ScopedAStatus, setValues,
47             (const std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>&,
48              const aidl::android::hardware::automotive::vehicle::SetValueRequests&),
49             (override));
50     MOCK_METHOD(
51             ndk::ScopedAStatus, subscribe,
52             (const std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>&,
53              const std::vector<aidl::android::hardware::automotive::vehicle::SubscribeOptions>&,
54              int32_t),
55             (override));
56     MOCK_METHOD(
57             ndk::ScopedAStatus, unsubscribe,
58             (const std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>&,
59              const std::vector<int32_t>&),
60             (override));
61     MOCK_METHOD(
62             ndk::ScopedAStatus, returnSharedMemory,
63             (const std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>&,
64              int64_t),
65             (override));
66     MOCK_METHOD(ndk::ScopedAStatus, getSupportedValuesLists,
67                 (const std::vector<aidl::android::hardware::automotive::vehicle::PropIdAreaId>&,
68                  aidl::android::hardware::automotive::vehicle::SupportedValuesListResults*),
69                 (override));
70     MOCK_METHOD(ndk::ScopedAStatus, getMinMaxSupportedValue,
71                 (const std::vector<aidl::android::hardware::automotive::vehicle::PropIdAreaId>&,
72                  aidl::android::hardware::automotive::vehicle::MinMaxSupportedValueResults*),
73                 (override));
74     MOCK_METHOD(
75             ndk::ScopedAStatus, registerSupportedValueChangeCallback,
76             (const std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>&,
77              const std::vector<aidl::android::hardware::automotive::vehicle::PropIdAreaId>&),
78             (override));
79     MOCK_METHOD(
80             ndk::ScopedAStatus, unregisterSupportedValueChangeCallback,
81             (const std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>&,
82              const std::vector<aidl::android::hardware::automotive::vehicle::PropIdAreaId>&),
83             (override));
84 };
85 
86 }  // namespace watchdog
87 }  // namespace automotive
88 }  // namespace android
89