Patrick Venture | a78e39f | 2018-11-06 18:37:06 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "image_handler.hpp" |
| 4 | |
Jason Ling | c78bfc8 | 2020-11-05 18:58:16 -0800 | [diff] [blame] | 5 | #include <memory> |
| 6 | |
Patrick Venture | a78e39f | 2018-11-06 18:37:06 -0800 | [diff] [blame] | 7 | #include <gmock/gmock.h> |
| 8 | |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 9 | namespace ipmi_flash |
Patrick Venture | a78e39f | 2018-11-06 18:37:06 -0800 | [diff] [blame] | 10 | { |
| 11 | |
| 12 | class ImageHandlerMock : public ImageHandlerInterface |
| 13 | { |
| 14 | public: |
| 15 | virtual ~ImageHandlerMock() = default; |
Willy Tu | f450486 | 2021-04-24 23:22:19 -0700 | [diff] [blame^] | 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)); |
Patrick Venture | a78e39f | 2018-11-06 18:37:06 -0800 | [diff] [blame] | 24 | }; |
| 25 | |
Jason Ling | c78bfc8 | 2020-11-05 18:58:16 -0800 | [diff] [blame] | 26 | std::unique_ptr<ImageHandlerMock> CreateImageMock() |
| 27 | { |
| 28 | return std::make_unique<ImageHandlerMock>(); |
| 29 | } |
| 30 | |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 31 | } // namespace ipmi_flash |