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, (const std::string& name, Type type), 23 (override)); 24 MOCK_METHOD(std::string, readString, (const std::string& name, Type type), 25 (override)); 26 MOCK_METHOD(void, writeBinary, 27 (const std::string& name, std::vector<uint8_t> data, Type type), 28 (override)); 29 MOCK_METHOD(void, findHwmonDir, (), (override)); 30 MOCK_METHOD(const fs::path&, path, (), (const, override)); 31 MOCK_METHOD(std::string, insertPageNum, 32 (const std::string& templateName, size_t page), (override)); 33 }; 34 } // namespace pmbus 35 36 namespace power 37 { 38 namespace psu 39 { 40 41 class MockedUtil : public UtilBase 42 { 43 public: 44 virtual ~MockedUtil() = default; 45 46 MOCK_METHOD(bool, getPresence, 47 (sdbusplus::bus::bus & bus, const std::string& invpath), 48 (const, override)); 49 MOCK_METHOD(void, setPresence, 50 (sdbusplus::bus::bus & bus, const std::string& invpath, 51 bool present, const std::string& name), 52 (const, override)); 53 }; 54 55 class MockedGPIOInterface : public GPIOInterfaceBase 56 { 57 public: 58 MOCK_METHOD(int, read, (), (override)); 59 MOCK_METHOD(void, write, (int value, std::bitset<32> flags), (override)); 60 MOCK_METHOD(std::string, getName, (), (const, override)); 61 }; 62 63 const UtilBase& getUtils(); 64 65 void freeUtils(); 66 67 } // namespace psu 68 } // namespace power 69 70 } // namespace phosphor 71