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 "WatchdogInternalHandler.h"
20 
21 #include <android-base/result.h>
22 #include <gmock/gmock.h>
23 #include <utils/String16.h>
24 #include <utils/Vector.h>
25 
26 namespace android {
27 namespace automotive {
28 namespace watchdog {
29 
30 class MockWatchdogInternalHandler : public WatchdogInternalHandlerInterface {
31 public:
32     MOCK_METHOD(binder_status_t, dump, (int, const char**, uint32_t), (override));
33     MOCK_METHOD(
34             ndk::ScopedAStatus, registerCarWatchdogService,
35             (const std::shared_ptr<
36                     aidl::android::automotive::watchdog::internal::ICarWatchdogServiceForSystem>&),
37             (override));
38     MOCK_METHOD(
39             ndk::ScopedAStatus, unregisterCarWatchdogService,
40             (const std::shared_ptr<
41                     aidl::android::automotive::watchdog::internal::ICarWatchdogServiceForSystem>&),
42             (override));
43     MOCK_METHOD(ndk::ScopedAStatus, registerMonitor,
44                 (const std::shared_ptr<
45                         aidl::android::automotive::watchdog::internal::ICarWatchdogMonitor>&),
46                 (override));
47     MOCK_METHOD(ndk::ScopedAStatus, unregisterMonitor,
48                 (const std::shared_ptr<
49                         aidl::android::automotive::watchdog::internal::ICarWatchdogMonitor>&),
50                 (override));
51     MOCK_METHOD(
52             ndk::ScopedAStatus, tellCarWatchdogServiceAlive,
53             (const std::shared_ptr<
54                      aidl::android::automotive::watchdog::internal::ICarWatchdogServiceForSystem>&,
55              const std::vector<aidl::android::automotive::watchdog::internal::ProcessIdentifier>&,
56              int32_t),
57             (override));
58     MOCK_METHOD(ndk::ScopedAStatus, tellDumpFinished,
59                 (const std::shared_ptr<
60                          aidl::android::automotive::watchdog::internal::ICarWatchdogMonitor>&,
61                  const aidl::android::automotive::watchdog::internal::ProcessIdentifier&),
62                 (override));
63     MOCK_METHOD(ndk::ScopedAStatus, notifySystemStateChange,
64                 (aidl::android::automotive::watchdog::internal::StateType, int32_t, int32_t),
65                 (override));
66     MOCK_METHOD(
67             ndk::ScopedAStatus, updateResourceOveruseConfigurations,
68             (const std::vector<
69                     aidl::android::automotive::watchdog::internal::ResourceOveruseConfiguration>&),
70             (override));
71     MOCK_METHOD(
72             ndk::ScopedAStatus, getResourceOveruseConfigurations,
73             (std::vector<
74                     aidl::android::automotive::watchdog::internal::ResourceOveruseConfiguration>*),
75             (override));
76     MOCK_METHOD(ndk::ScopedAStatus, controlProcessHealthCheck, (bool), (override));
77     MOCK_METHOD(ndk::ScopedAStatus, setThreadPriority, (int, int, int, int, int), (override));
78     MOCK_METHOD(ndk::ScopedAStatus, getThreadPriority,
79                 (int, int, int,
80                  aidl::android::automotive::watchdog::internal::ThreadPolicyWithPriority*),
81                 (override));
82     MOCK_METHOD(ndk::ScopedAStatus, onAidlVhalPidFetched, (int32_t), (override));
83     MOCK_METHOD(ndk::ScopedAStatus, onTodayIoUsageStatsFetched,
84                 (const std::vector<
85                         aidl::android::automotive::watchdog::internal::UserPackageIoUsageStats>&),
86                 (override));
87     MOCK_METHOD(void, terminate, (), (override));
88 };
89 
90 }  // namespace watchdog
91 }  // namespace automotive
92 }  // namespace android
93