Brandon Wyman | 3f1242f | 2020-01-28 13:11:25 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "pmbus.hpp" |
| 4 | #include "util_base.hpp" |
| 5 | |
B. J. Wyman | 681b2a3 | 2021-04-20 22:31:22 +0000 | [diff] [blame] | 6 | #include <gpiod.hpp> |
| 7 | |
| 8 | #include <bitset> |
| 9 | |
Brandon Wyman | 3f1242f | 2020-01-28 13:11:25 -0600 | [diff] [blame] | 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)); |
Brandon Wyman | 1d7a7df | 2020-03-26 10:14:05 -0500 | [diff] [blame] | 24 | MOCK_METHOD(std::string, readString, (const std::string& name, Type type), |
| 25 | (override)); |
Brandon Wyman | 59a3579 | 2020-06-04 12:37:40 -0500 | [diff] [blame] | 26 | MOCK_METHOD(void, writeBinary, |
| 27 | (const std::string& name, std::vector<uint8_t> data, Type type), |
| 28 | (override)); |
Brandon Wyman | 9564e94 | 2020-11-10 14:01:42 -0600 | [diff] [blame] | 29 | MOCK_METHOD(void, findHwmonDir, (), (override)); |
Brandon Wyman | 4176d6b | 2020-10-07 17:41:06 -0500 | [diff] [blame] | 30 | MOCK_METHOD(const fs::path&, path, (), (const, override)); |
Brandon Wyman | 3f1242f | 2020-01-28 13:11:25 -0600 | [diff] [blame] | 31 | }; |
| 32 | } // namespace pmbus |
| 33 | |
| 34 | namespace power |
| 35 | { |
| 36 | namespace psu |
| 37 | { |
Brandon Wyman | a1830a8 | 2021-03-12 16:03:55 -0600 | [diff] [blame] | 38 | |
Brandon Wyman | 3f1242f | 2020-01-28 13:11:25 -0600 | [diff] [blame] | 39 | class MockedUtil : public UtilBase |
| 40 | { |
| 41 | public: |
| 42 | virtual ~MockedUtil() = default; |
| 43 | |
| 44 | MOCK_METHOD(bool, getPresence, |
| 45 | (sdbusplus::bus::bus & bus, const std::string& invpath), |
| 46 | (const, override)); |
B. J. Wyman | 681b2a3 | 2021-04-20 22:31:22 +0000 | [diff] [blame] | 47 | MOCK_METHOD(void, setPresence, |
| 48 | (sdbusplus::bus::bus & bus, const std::string& invpath, |
| 49 | bool present, const std::string& name), |
| 50 | (const, override)); |
| 51 | }; |
| 52 | |
Adriana Kobylak | 3ca062a | 2021-10-20 15:27:23 +0000 | [diff] [blame] | 53 | class MockedGPIOInterface : public GPIOInterfaceBase |
B. J. Wyman | 681b2a3 | 2021-04-20 22:31:22 +0000 | [diff] [blame] | 54 | { |
| 55 | public: |
| 56 | MOCK_METHOD(int, read, (), (override)); |
Adriana Kobylak | 52245b6 | 2021-09-13 15:46:21 +0000 | [diff] [blame^] | 57 | MOCK_METHOD(void, write, (int value, std::bitset<32> flags), (override)); |
B. J. Wyman | d8b8cb1 | 2021-07-15 22:03:34 +0000 | [diff] [blame] | 58 | MOCK_METHOD(std::string, getName, (), (const, override)); |
Brandon Wyman | 3f1242f | 2020-01-28 13:11:25 -0600 | [diff] [blame] | 59 | }; |
| 60 | |
Brandon Wyman | a1830a8 | 2021-03-12 16:03:55 -0600 | [diff] [blame] | 61 | const UtilBase& getUtils(); |
Brandon Wyman | 3f1242f | 2020-01-28 13:11:25 -0600 | [diff] [blame] | 62 | |
Brandon Wyman | a1830a8 | 2021-03-12 16:03:55 -0600 | [diff] [blame] | 63 | void freeUtils(); |
Brandon Wyman | 3f1242f | 2020-01-28 13:11:25 -0600 | [diff] [blame] | 64 | |
| 65 | } // namespace psu |
| 66 | } // namespace power |
| 67 | |
| 68 | } // namespace phosphor |