blob: 2731692ba93a7deb8bf2bf784a8fd86f7db1a27f [file] [log] [blame]
Brandon Wyman3f1242f2020-01-28 13:11:25 -06001#pragma once
2
3#include "pmbus.hpp"
4#include "util_base.hpp"
5
B. J. Wyman681b2a32021-04-20 22:31:22 +00006#include <gpiod.hpp>
7
8#include <bitset>
9
Brandon Wyman3f1242f2020-01-28 13:11:25 -060010#include <gmock/gmock.h>
11
12namespace phosphor
13{
14namespace pmbus
15{
16class 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 Wyman1d7a7df2020-03-26 10:14:05 -050024 MOCK_METHOD(std::string, readString, (const std::string& name, Type type),
25 (override));
Brandon Wyman59a35792020-06-04 12:37:40 -050026 MOCK_METHOD(void, writeBinary,
27 (const std::string& name, std::vector<uint8_t> data, Type type),
28 (override));
Brandon Wyman9564e942020-11-10 14:01:42 -060029 MOCK_METHOD(void, findHwmonDir, (), (override));
Brandon Wyman4176d6b2020-10-07 17:41:06 -050030 MOCK_METHOD(const fs::path&, path, (), (const, override));
Brandon Wyman3f1242f2020-01-28 13:11:25 -060031};
32} // namespace pmbus
33
34namespace power
35{
36namespace psu
37{
Brandon Wymana1830a82021-03-12 16:03:55 -060038
Brandon Wyman3f1242f2020-01-28 13:11:25 -060039class 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. Wyman681b2a32021-04-20 22:31:22 +000047 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
53class MockedGPIOReader : public GPIOInterface
54{
55 public:
56 MOCK_METHOD(int, read, (), (override));
Brandon Wyman3f1242f2020-01-28 13:11:25 -060057};
58
Brandon Wymana1830a82021-03-12 16:03:55 -060059const UtilBase& getUtils();
Brandon Wyman3f1242f2020-01-28 13:11:25 -060060
Brandon Wymana1830a82021-03-12 16:03:55 -060061void freeUtils();
Brandon Wyman3f1242f2020-01-28 13:11:25 -060062
63} // namespace psu
64} // namespace power
65
66} // namespace phosphor