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 #pragma once
18 
19 #include "IoOveruseMonitor.h"
20 #include "MockDataProcessor.h"
21 
22 #include <android-base/result.h>
23 #include <gmock/gmock.h>
24 
25 namespace android {
26 namespace automotive {
27 namespace watchdog {
28 
29 class MockIoOveruseMonitor : public MockDataProcessor, public IoOveruseMonitorInterface {
30 public:
MockIoOveruseMonitor()31     MockIoOveruseMonitor() {
32         ON_CALL(*this, name()).WillByDefault(::testing::Return("MockIoOveruseMonitor"));
33     }
~MockIoOveruseMonitor()34     ~MockIoOveruseMonitor() {}
35     MOCK_METHOD(bool, isInitialized, (), (const, override));
36     MOCK_METHOD(bool, dumpHelpText, (int), (const, override));
37     MOCK_METHOD(void, onCarWatchdogServiceRegistered, (), (override));
38     MOCK_METHOD(
39             android::base::Result<void>, updateResourceOveruseConfigurations,
40             (const std::vector<
41                     aidl::android::automotive::watchdog::internal::ResourceOveruseConfiguration>&),
42             (override));
43     MOCK_METHOD(
44             android::base::Result<void>, getResourceOveruseConfigurations,
45             (std::vector<
46                     aidl::android::automotive::watchdog::internal::ResourceOveruseConfiguration>*),
47             (const, override));
48     MOCK_METHOD(android::base::Result<void>, onTodayIoUsageStatsFetched,
49                 (const std::vector<
50                         aidl::android::automotive::watchdog::internal::UserPackageIoUsageStats>&),
51                 (override));
52     MOCK_METHOD(
53             android::base::Result<void>, addIoOveruseListener,
54             (const std::shared_ptr<aidl::android::automotive::watchdog::IResourceOveruseListener>&),
55             (override));
56     MOCK_METHOD(
57             android::base::Result<void>, removeIoOveruseListener,
58             (const std::shared_ptr<aidl::android::automotive::watchdog::IResourceOveruseListener>&),
59             (override));
60     MOCK_METHOD(void, handleBinderDeath, (void*), (override));
61     MOCK_METHOD(android::base::Result<void>, getIoOveruseStats,
62                 (aidl::android::automotive::watchdog::IoOveruseStats*), (const, override));
63     MOCK_METHOD(android::base::Result<void>, resetIoOveruseStats, (const std::vector<std::string>&),
64                 (override));
65     MOCK_METHOD(void, removeStatsForUser, (userid_t), (override));
66 };
67 
68 }  // namespace watchdog
69 }  // namespace automotive
70 }  // namespace android
71