1 // Copyright 2022 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 #include "handler.hpp" 18 19 #include <ipmid/message.hpp> 20 21 #include <cstddef> 22 #include <cstdint> 23 #include <optional> 24 #include <string> 25 #include <string_view> 26 #include <tuple> 27 28 #include <gmock/gmock.h> 29 30 namespace google 31 { 32 namespace ipmi 33 { 34 35 class HandlerMock : public HandlerInterface 36 { 37 public: 38 ~HandlerMock() = default; 39 40 MOCK_METHOD((std::tuple<std::uint8_t, std::string>), getEthDetails, 41 (std::string), (const, override)); 42 MOCK_METHOD(std::int64_t, getRxPackets, (const std::string&), 43 (const, override)); 44 MOCK_METHOD( 45 (std::tuple<std::uint8_t, std::uint8_t, std::uint8_t, std::uint8_t>), 46 getCpldVersion, (unsigned int), (const, override)); 47 48 MOCK_METHOD(void, psuResetDelay, (std::uint32_t), (const, override)); 49 MOCK_METHOD(void, psuResetOnShutdown, (), (const, override)); 50 MOCK_METHOD(std::uint32_t, getFlashSize, (), (override)); 51 MOCK_METHOD(std::string, getEntityName, (std::uint8_t, std::uint8_t), 52 (override)); 53 MOCK_METHOD(std::string, getMachineName, (), (override)); 54 MOCK_METHOD(void, buildI2cPcieMapping, (), (override)); 55 MOCK_METHOD(size_t, getI2cPcieMappingSize, (), (const, override)); 56 MOCK_METHOD((std::tuple<std::uint32_t, std::string>), getI2cEntry, 57 (unsigned int), (const, override)); 58 MOCK_METHOD(void, hostPowerOffDelay, (std::uint32_t), (const, override)); 59 60 MOCK_METHOD(uint32_t, accelOobDeviceCount, (), (const, override)); 61 MOCK_METHOD(std::string, accelOobDeviceName, (size_t), (const, override)); 62 MOCK_METHOD(uint64_t, accelOobRead, (std::string_view, uint64_t, uint8_t), 63 (const, override)); 64 MOCK_METHOD(void, accelOobWrite, 65 (std::string_view, uint64_t, uint8_t, uint64_t), 66 (const, override)); 67 MOCK_METHOD(std::vector<uint8_t>, pcieBifurcation, (uint8_t), (override)); 68 MOCK_METHOD(uint8_t, getBmcMode, (), (override)); 69 MOCK_METHOD(void, linuxBootDone, (), (const, override)); 70 MOCK_METHOD(void, accelSetVrSettings, 71 (::ipmi::Context::ptr, uint8_t, uint8_t, uint16_t), 72 (const, override)); 73 MOCK_METHOD(uint16_t, accelGetVrSettings, 74 (::ipmi::Context::ptr, uint8_t, uint8_t), (const, override)); 75 MOCK_METHOD(std::string, getBMInstanceProperty, (uint8_t), 76 (const, override)); 77 MOCK_METHOD(std::optional<uint16_t>, getCoreCount, 78 (const std::string& filePath), (const, override)); 79 }; 80 81 } // namespace ipmi 82 } // namespace google 83