blob: c4c2c9db1a64ea51729200d1d664badc4709c4c9 [file] [log] [blame]
Brandon Wyman3f1242f2020-01-28 13:11:25 -06001#pragma once
2
3#include "pmbus.hpp"
4#include "util_base.hpp"
5
6#include <gmock/gmock.h>
7
8namespace phosphor
9{
10namespace pmbus
11{
12class MockedPMBus : public PMBusBase
13{
14
15 public:
16 virtual ~MockedPMBus() = default;
17
18 MOCK_METHOD(uint64_t, read, (const std::string& name, Type type),
19 (override));
Brandon Wyman59a35792020-06-04 12:37:40 -050020 MOCK_METHOD(void, writeBinary,
21 (const std::string& name, std::vector<uint8_t> data, Type type),
22 (override));
Brandon Wyman3f1242f2020-01-28 13:11:25 -060023};
24} // namespace pmbus
25
26namespace power
27{
28namespace psu
29{
30class MockedUtil : public UtilBase
31{
32 public:
33 virtual ~MockedUtil() = default;
34
35 MOCK_METHOD(bool, getPresence,
36 (sdbusplus::bus::bus & bus, const std::string& invpath),
37 (const, override));
38};
39
40static std::unique_ptr<MockedUtil> util;
41inline const UtilBase& getUtils()
42{
43 if (!util)
44 {
45 util = std::make_unique<MockedUtil>();
46 }
47 return *util;
48}
49
50inline void freeUtils()
51{
52 util.reset();
53}
54
55} // namespace psu
56} // namespace power
57
58} // namespace phosphor