1 /* 2 * Copyright (C) 2023 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 #include <aidl/android/hardware/thermal/IThermal.h> 18 #include <gmock/gmock.h> 19 #include <log/log.h> 20 21 #include <unordered_map> 22 23 #include "thermal-helper.h" 24 25 namespace aidl::android::hardware::thermal::implementation { 26 27 class MockThermalHelper : public ThermalHelper { 28 public: 29 MockThermalHelper(); 30 ~MockThermalHelper() override; 31 MOCK_METHOD(bool, fillCurrentTemperatures, 32 (bool, bool, TemperatureType, std::vector<Temperature> *), (override)); 33 MOCK_METHOD(bool, fillTemperatureThresholds, 34 (bool, TemperatureType, std::vector<TemperatureThreshold> *), (const, override)); 35 MOCK_METHOD(bool, fillCurrentCoolingDevices, (bool, CoolingType, std::vector<CoolingDevice> *), 36 (const, override)); 37 MOCK_METHOD(bool, emulTemp, (std::string_view, const float, const bool), (override)); 38 MOCK_METHOD(bool, emulSeverity, (std::string_view, const int, const bool), (override)); 39 MOCK_METHOD(bool, emulClear, (std::string_view), (override)); 40 MOCK_METHOD(bool, isInitializedOk, (), (const, override)); 41 MOCK_METHOD(bool, readTemperature, 42 (std::string_view, Temperature *out, 43 (std::pair<ThrottlingSeverity, ThrottlingSeverity> *), const bool), 44 (override)); 45 MOCK_METHOD(bool, readTemperatureThreshold, (std::string_view, TemperatureThreshold *), 46 (const, override)); 47 MOCK_METHOD(bool, readCoolingDevice, (std::string_view, CoolingDevice *), (const, override)); 48 MOCK_METHOD(void, dumpVtEstimatorStatus, (std::string_view, std::ostringstream *), 49 (const, override)); 50 MOCK_METHOD((const std::unordered_map<std::string, SensorInfo> &), GetSensorInfoMap, (), 51 (const, override)); 52 MOCK_METHOD((const std::unordered_map<std::string, CdevInfo> &), GetCdevInfoMap, (), 53 (const, override)); 54 MOCK_METHOD((const std::unordered_map<std::string, SensorStatus> &), GetSensorStatusMap, (), 55 (const, override)); 56 MOCK_METHOD((const std::unordered_map<std::string, ThermalThrottlingStatus> &), 57 GetThermalThrottlingStatusMap, (), (const, override)); 58 MOCK_METHOD((const std::unordered_map<std::string, PowerRailInfo> &), GetPowerRailInfoMap, (), 59 (const, override)); 60 MOCK_METHOD((const std::unordered_map<std::string, PowerStatus> &), GetPowerStatusMap, (), 61 (const, override)); 62 MOCK_METHOD((const std::unordered_map<std::string, SensorTempStats>), 63 GetSensorTempStatsSnapshot, (), (override)); 64 MOCK_METHOD((const std::unordered_map<std::string, 65 std::unordered_map<std::string, ThermalStats<int>>>), 66 GetSensorCoolingDeviceRequestStatsSnapshot, (), (override)); 67 MOCK_METHOD(bool, isAidlPowerHalExist, (), (override)); 68 MOCK_METHOD(bool, isPowerHalConnected, (), (override)); 69 MOCK_METHOD(bool, isPowerHalExtConnected, (), (override)); 70 MOCK_METHOD(void, dumpTraces, (std::string_view), (override)); 71 }; 72 73 } // namespace aidl::android::hardware::thermal::implementation 74