blob: 1d4f726a6988e5ad05e0b4d29609b32f0b7bcc67 [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;
Jason Ling56a22732020-10-23 19:53:17 -070016 MOCK_METHOD2(open, bool(const std::string&, std::ios_base::openmode));
Patrick Venture68bb1432018-11-09 20:08:48 -080017 MOCK_METHOD0(close, void());
Patrick Venture400c6362018-11-06 20:06:11 -080018 MOCK_METHOD2(write, bool(std::uint32_t, const std::vector<std::uint8_t>&));
Jason Ling56a22732020-10-23 19:53:17 -070019 MOCK_METHOD2(read, std::optional<std::vector<std::uint8_t>>(std::uint32_t,
20 std::uint32_t));
Patrick Venturecc7d1602018-11-15 13:58:33 -080021 MOCK_METHOD0(getSize, int());
Patrick Venturea78e39f2018-11-06 18:37:06 -080022};
23
Jason Lingc78bfc82020-11-05 18:58:16 -080024std::unique_ptr<ImageHandlerMock> CreateImageMock()
25{
26 return std::make_unique<ImageHandlerMock>();
27}
28
Patrick Venture1d5a31c2019-05-20 11:38:22 -070029} // namespace ipmi_flash