1 #pragma once 2 3 #include "pmbus.hpp" 4 #include "util_base.hpp" 5 6 #include <gpiod.hpp> 7 8 #include <bitset> 9 10 #include <gmock/gmock.h> 11 12 namespace phosphor 13 { 14 namespace pmbus 15 { 16 class MockedPMBus : public PMBusBase 17 { 18 19 public: 20 virtual ~MockedPMBus() = default; 21 22 MOCK_METHOD(uint64_t, read, 23 (const std::string& name, Type type, bool errTrace), 24 (override)); 25 MOCK_METHOD(std::string, readString, (const std::string& name, Type type), 26 (override)); 27 MOCK_METHOD(void, writeBinary, 28 (const std::string& name, std::vector<uint8_t> data, Type type), 29 (override)); 30 MOCK_METHOD(void, findHwmonDir, (), (override)); 31 MOCK_METHOD(const fs::path&, path, (), (const, override)); 32 MOCK_METHOD(std::string, insertPageNum, 33 (const std::string& templateName, size_t page), (override)); 34 }; 35 } // namespace pmbus 36 37 namespace power 38 { 39 namespace psu 40 { 41 42 class MockedUtil : public UtilBase 43 { 44 public: 45 virtual ~MockedUtil() = default; 46 47 MOCK_METHOD(bool, getPresence, 48 (sdbusplus::bus::bus & bus, const std::string& invpath), 49 (const, override)); 50 MOCK_METHOD(void, setPresence, 51 (sdbusplus::bus::bus & bus, const std::string& invpath, 52 bool present, const std::string& name), 53 (const, override)); 54 MOCK_METHOD(void, setAvailable, 55 (sdbusplus::bus::bus & bus, const std::string& invpath, 56 bool available), 57 (const, override)); 58 MOCK_METHOD(void, handleChassisHealthRollup, 59 (sdbusplus::bus::bus & bus, const std::string& invpath, 60 bool addRollup), 61 (const, override)); 62 }; 63 64 class MockedGPIOInterface : public GPIOInterfaceBase 65 { 66 public: 67 MOCK_METHOD(int, read, (), (override)); 68 MOCK_METHOD(void, write, (int value, std::bitset<32> flags), (override)); 69 MOCK_METHOD(std::string, getName, (), (const, override)); 70 }; 71 72 const UtilBase& getUtils(); 73 74 void freeUtils(); 75 76 } // namespace psu 77 } // namespace power 78 79 } // namespace phosphor 80