blob: 8a13b6aa0ce539d37c28accc0af2ac0ce2505031 [file] [log] [blame]
Shawn McCarney906cc3f2024-02-01 13:33:06 -06001/**
2 * Copyright © 2024 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
Shawn McCarney175798c2025-11-20 13:50:03 -060018#include "mock_gpio.hpp"
Shawn McCarney906cc3f2024-02-01 13:33:06 -060019#include "mock_pmbus.hpp"
20#include "services.hpp"
21
22#include <gmock/gmock.h>
23
24namespace phosphor::power::sequencer
25{
26
Shawn McCarney24956592024-02-19 18:58:57 -060027using MockPMBus = phosphor::pmbus::MockPMBus;
28
Shawn McCarney906cc3f2024-02-01 13:33:06 -060029/**
30 * @class MockServices
31 *
32 * Mock implementation of the Services interface.
33 */
34class MockServices : public Services
35{
36 public:
37 // Specify which compiler-generated methods we want
38 MockServices() = default;
39 MockServices(const MockServices&) = delete;
40 MockServices(MockServices&&) = delete;
41 MockServices& operator=(const MockServices&) = delete;
42 MockServices& operator=(MockServices&&) = delete;
43 virtual ~MockServices() = default;
44
45 MOCK_METHOD(sdbusplus::bus_t&, getBus, (), (override));
46 MOCK_METHOD(void, logErrorMsg, (const std::string& message), (override));
47 MOCK_METHOD(void, logInfoMsg, (const std::string& message), (override));
48 MOCK_METHOD(void, logError,
49 (const std::string& message, Entry::Level severity,
Shawn McCarneye4fef0f2024-04-05 17:56:09 -050050 (std::map<std::string, std::string> & additionalData)),
Shawn McCarney906cc3f2024-02-01 13:33:06 -060051 (override));
52 MOCK_METHOD(bool, isPresent, (const std::string& inventoryPath),
53 (override));
Shawn McCarney175798c2025-11-20 13:50:03 -060054
55 virtual std::unique_ptr<GPIO> createGPIO(const std::string&) override
56 {
57 return std::make_unique<MockGPIO>();
58 }
59
Shawn McCarney906cc3f2024-02-01 13:33:06 -060060 MOCK_METHOD(std::vector<int>, getGPIOValues, (const std::string& chipLabel),
61 (override));
62
Patrick Williams92261f82025-02-01 08:22:34 -050063 virtual std::unique_ptr<PMBusBase> createPMBus(
64 uint8_t, uint16_t, const std::string&, size_t) override
Shawn McCarney906cc3f2024-02-01 13:33:06 -060065 {
66 return std::make_unique<MockPMBus>();
67 }
Shawn McCarneye4fef0f2024-04-05 17:56:09 -050068
Shawn McCarney3a11d632024-05-23 10:12:56 -050069 MOCK_METHOD(void, createBMCDump, (), (override));
Shawn McCarneye4fef0f2024-04-05 17:56:09 -050070 MOCK_METHOD(void, clearCache, (), (override));
Shawn McCarney906cc3f2024-02-01 13:33:06 -060071};
72
73} // namespace phosphor::power::sequencer