• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_MOCKWATCHDOGSERVICEHELPER_H_
18 #define CPP_WATCHDOG_SERVER_TESTS_MOCKWATCHDOGSERVICEHELPER_H_
19 
20 #include "WatchdogProcessService.h"
21 #include "WatchdogServiceHelper.h"
22 
23 #include <android-base/result.h>
24 #include <android/automotive/watchdog/TimeoutLength.h>
25 #include <android/automotive/watchdog/internal/ICarWatchdogServiceForSystem.h>
26 #include <android/automotive/watchdog/internal/PackageIoOveruseStats.h>
27 #include <binder/Status.h>
28 #include <gmock/gmock.h>
29 #include <utils/StrongPointer.h>
30 
31 namespace android {
32 namespace automotive {
33 namespace watchdog {
34 
35 class MockWatchdogServiceHelper : public IWatchdogServiceHelper {
36 public:
MockWatchdogServiceHelper()37     MockWatchdogServiceHelper() {}
~MockWatchdogServiceHelper()38     ~MockWatchdogServiceHelper() {}
39 
40     MOCK_METHOD(android::base::Result<void>, init, (const android::sp<WatchdogProcessService>&),
41                 (override));
42     MOCK_METHOD(android::binder::Status, registerService,
43                 (const sp<android::automotive::watchdog::internal::ICarWatchdogServiceForSystem>&),
44                 (override));
45     MOCK_METHOD(android::binder::Status, unregisterService,
46                 (const sp<android::automotive::watchdog::internal::ICarWatchdogServiceForSystem>&),
47                 (override));
48     MOCK_METHOD(void, binderDied, (const android::wp<android::IBinder>&), (override));
49 
50     MOCK_METHOD(android::binder::Status, checkIfAlive,
51                 (const android::wp<android::IBinder>&, int32_t, TimeoutLength), (const, override));
52     MOCK_METHOD(android::binder::Status, prepareProcessTermination,
53                 (const android::wp<android::IBinder>&), (override));
54     MOCK_METHOD(android::binder::Status, getPackageInfosForUids,
55                 (const std::vector<int32_t>&, const std::vector<std::string>&,
56                  std::vector<android::automotive::watchdog::internal::PackageInfo>*),
57                 (override));
58     MOCK_METHOD(
59             android::binder::Status, latestIoOveruseStats,
60             (const std::vector<android::automotive::watchdog::internal::PackageIoOveruseStats>&),
61             (override));
62     MOCK_METHOD(android::binder::Status, resetResourceOveruseStats,
63                 (const std::vector<std::string>&), (override));
64     MOCK_METHOD(void, terminate, (), (override));
65 };
66 
67 }  // namespace watchdog
68 }  // namespace automotive
69 }  // namespace android
70 
71 #endif  //  CPP_WATCHDOG_SERVER_TESTS_MOCKWATCHDOGSERVICEHELPER_H_
72