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