blob: 9999f58a7626eed476a1432c454f87ee0328daa3 [file] [log] [blame]
Patrick Venturea78e39f2018-11-06 18:37:06 -08001#pragma once
2
3#include "image_handler.hpp"
4
Jason Lingc78bfc82020-11-05 18:58:16 -08005#include <memory>
6
Patrick Venturea78e39f2018-11-06 18:37:06 -08007#include <gmock/gmock.h>
8
Patrick Venture1d5a31c2019-05-20 11:38:22 -07009namespace ipmi_flash
Patrick Venturea78e39f2018-11-06 18:37:06 -080010{
11
12class ImageHandlerMock : public ImageHandlerInterface
13{
14 public:
15 virtual ~ImageHandlerMock() = default;
Willy Tuf4504862021-04-24 23:22:19 -070016 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));
Patrick Venturea78e39f2018-11-06 18:37:06 -080024};
25
Jason Lingc78bfc82020-11-05 18:58:16 -080026std::unique_ptr<ImageHandlerMock> CreateImageMock()
27{
28 return std::make_unique<ImageHandlerMock>();
29}
30
Patrick Venture1d5a31c2019-05-20 11:38:22 -070031} // namespace ipmi_flash