1 #pragma once 2 3 #include "image_handler.hpp" 4 5 #include <memory> 6 7 #include <gmock/gmock.h> 8 9 namespace ipmi_flash 10 { 11 12 class ImageHandlerMock : public ImageHandlerInterface 13 { 14 public: 15 virtual ~ImageHandlerMock() = default; 16 MOCK_METHOD(bool, open, (const std::string&, std::ios_base::openmode), 17 (override)); 18 MOCK_METHOD(void, close, (), (override)); 19 MOCK_METHOD(bool, write, (std::uint32_t, const std::vector<std::uint8_t>&), 20 (override)); 21 MOCK_METHOD(std::optional<std::vector<std::uint8_t>>, read, 22 (std::uint32_t, std::uint32_t), (override)); 23 MOCK_METHOD(int, getSize, (), (override)); 24 }; 25 26 std::unique_ptr<ImageHandlerMock> CreateImageMock() 27 { 28 return std::make_unique<ImageHandlerMock>(); 29 } 30 31 } // namespace ipmi_flash 32