1 /** 2 * Copyright (c) 2020, 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_MOCKWATCHDOGPROCESSSERVICE_H_ 18 #define CPP_WATCHDOG_SERVER_TESTS_MOCKWATCHDOGPROCESSSERVICE_H_ 19 20 #include "WatchdogProcessService.h" 21 #include "WatchdogServiceHelper.h" 22 23 #include <android-base/result.h> 24 #include <android/automotive/watchdog/ICarWatchdogClient.h> 25 #include <android/automotive/watchdog/internal/ICarWatchdogMonitor.h> 26 #include <android/automotive/watchdog/internal/ICarWatchdogServiceForSystem.h> 27 #include <android/automotive/watchdog/internal/PowerCycle.h> 28 #include <android/automotive/watchdog/internal/UserState.h> 29 #include <binder/Status.h> 30 #include <gmock/gmock.h> 31 #include <utils/String16.h> 32 #include <utils/Vector.h> 33 34 #include <vector> 35 36 namespace android { 37 namespace automotive { 38 namespace watchdog { 39 40 class MockWatchdogProcessService : public WatchdogProcessService { 41 public: MockWatchdogProcessService()42 MockWatchdogProcessService() : WatchdogProcessService(nullptr) {} 43 MOCK_METHOD(android::base::Result<void>, dump, (int fd, const Vector<android::String16>&), 44 (override)); 45 MOCK_METHOD(android::base::Result<void>, registerWatchdogServiceHelper, 46 (const android::sp<IWatchdogServiceHelper>&), (override)); 47 48 MOCK_METHOD(android::binder::Status, registerClient, 49 (const sp<ICarWatchdogClient>&, TimeoutLength), (override)); 50 MOCK_METHOD(android::binder::Status, unregisterClient, (const sp<ICarWatchdogClient>&), 51 (override)); 52 MOCK_METHOD(android::binder::Status, registerCarWatchdogService, (const android::sp<IBinder>&), 53 (override)); 54 MOCK_METHOD(void, unregisterCarWatchdogService, (const android::sp<IBinder>&), (override)); 55 MOCK_METHOD(android::binder::Status, registerMonitor, 56 (const sp<android::automotive::watchdog::internal::ICarWatchdogMonitor>&), 57 (override)); 58 MOCK_METHOD(android::binder::Status, unregisterMonitor, 59 (const sp<android::automotive::watchdog::internal::ICarWatchdogMonitor>&), 60 (override)); 61 MOCK_METHOD(android::binder::Status, tellClientAlive, (const sp<ICarWatchdogClient>&, int32_t), 62 (override)); 63 MOCK_METHOD(android::binder::Status, tellCarWatchdogServiceAlive, 64 (const android::sp< 65 android::automotive::watchdog::internal::ICarWatchdogServiceForSystem>&, 66 const std::vector<int32_t>&, int32_t), 67 (override)); 68 MOCK_METHOD(android::binder::Status, tellDumpFinished, 69 (const android::sp<android::automotive::watchdog::internal::ICarWatchdogMonitor>&, 70 int32_t), 71 (override)); 72 MOCK_METHOD(void, setEnabled, (bool), (override)); 73 MOCK_METHOD(void, notifyUserStateChange, (userid_t, bool), (override)); 74 }; 75 76 } // namespace watchdog 77 } // namespace automotive 78 } // namespace android 79 80 #endif // CPP_WATCHDOG_SERVER_TESTS_MOCKWATCHDOGPROCESSSERVICE_H_ 81