Lakshman Annadorai | 774ba78 | 2020-10-30 10:20:41 -0700 | [diff] [blame] | 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_MOCKIOOVERUSEMONITOR_H_ |
| 18 | #define CPP_WATCHDOG_SERVER_TESTS_MOCKIOOVERUSEMONITOR_H_ |
| 19 | |
| 20 | #include "IoOveruseMonitor.h" |
Lakshman Annadorai | 965ef6d | 2021-02-24 16:37:05 -0800 | [diff] [blame] | 21 | #include "MockDataProcessor.h" |
Lakshman Annadorai | 774ba78 | 2020-10-30 10:20:41 -0700 | [diff] [blame] | 22 | |
| 23 | #include <android-base/result.h> |
| 24 | #include <android/automotive/watchdog/internal/ComponentType.h> |
| 25 | #include <android/automotive/watchdog/internal/IoOveruseConfiguration.h> |
| 26 | #include <gmock/gmock.h> |
| 27 | |
| 28 | namespace android { |
| 29 | namespace automotive { |
| 30 | namespace watchdog { |
| 31 | |
Lakshman Annadorai | 965ef6d | 2021-02-24 16:37:05 -0800 | [diff] [blame] | 32 | class MockIoOveruseMonitor : public MockDataProcessor, public IIoOveruseMonitor { |
Lakshman Annadorai | 774ba78 | 2020-10-30 10:20:41 -0700 | [diff] [blame] | 33 | public: |
Lakshman Annadorai | 965ef6d | 2021-02-24 16:37:05 -0800 | [diff] [blame] | 34 | MockIoOveruseMonitor() { |
| 35 | ON_CALL(*this, name()).WillByDefault(::testing::Return("MockIoOveruseMonitor")); |
| 36 | } |
Lakshman Annadorai | 774ba78 | 2020-10-30 10:20:41 -0700 | [diff] [blame] | 37 | ~MockIoOveruseMonitor() {} |
Lakshman Annadorai | d142650 | 2021-04-06 20:06:58 -0700 | [diff] [blame] | 38 | MOCK_METHOD(android::base::Result<void>, updateResourceOveruseConfigurations, |
| 39 | (const std::vector< |
| 40 | android::automotive::watchdog::internal::ResourceOveruseConfiguration>&), |
Lakshman Annadorai | 774ba78 | 2020-10-30 10:20:41 -0700 | [diff] [blame] | 41 | (override)); |
Lakshman Annadorai | bc0afd0 | 2021-04-06 20:23:39 -0700 | [diff] [blame] | 42 | MOCK_METHOD( |
| 43 | android::base::Result<void>, getResourceOveruseConfigurations, |
| 44 | (std::vector<android::automotive::watchdog::internal::ResourceOveruseConfiguration>*), |
| 45 | (override)); |
Lakshman Annadorai | 9ed4732 | 2021-03-11 16:09:28 -0800 | [diff] [blame] | 46 | MOCK_METHOD(android::base::Result<void>, actionTakenOnIoOveruse, |
| 47 | (const std::vector< |
| 48 | android::automotive::watchdog::internal::PackageResourceOveruseAction>& |
| 49 | actions), |
| 50 | (override)); |
Lakshman Annadorai | 965ef6d | 2021-02-24 16:37:05 -0800 | [diff] [blame] | 51 | MOCK_METHOD(android::base::Result<void>, addIoOveruseListener, |
| 52 | (const sp<IResourceOveruseListener>&), (override)); |
| 53 | MOCK_METHOD(android::base::Result<void>, removeIoOveruseListener, |
| 54 | (const sp<IResourceOveruseListener>&), (override)); |
| 55 | MOCK_METHOD(android::base::Result<void>, getIoOveruseStats, (IoOveruseStats*), (override)); |
Lakshman Annadorai | 774ba78 | 2020-10-30 10:20:41 -0700 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | } // namespace watchdog |
| 59 | } // namespace automotive |
| 60 | } // namespace android |
| 61 | |
| 62 | #endif // CPP_WATCHDOG_SERVER_TESTS_MOCKIOOVERUSEMONITOR_H_ |