Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 1 | #include "data_mock.hpp" |
| 2 | #include "firmware_handler.hpp" |
Patrick Venture | 84778b8 | 2019-06-26 20:11:09 -0700 | [diff] [blame] | 3 | #include "flags.hpp" |
Patrick Venture | 1cc8895 | 2019-01-04 10:56:32 -0800 | [diff] [blame] | 4 | #include "image_mock.hpp" |
Patrick Venture | 1d66fe6 | 2019-06-03 14:57:27 -0700 | [diff] [blame] | 5 | #include "triggerable_mock.hpp" |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 6 | #include "util.hpp" |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 7 | |
Patrick Venture | d4e20de | 2019-07-18 12:48:05 -0700 | [diff] [blame] | 8 | #include <memory> |
| 9 | |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 10 | #include <gtest/gtest.h> |
| 11 | |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 12 | namespace ipmi_flash |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 13 | { |
Patrick Venture | fa06a5f | 2019-07-01 09:22:38 -0700 | [diff] [blame] | 14 | namespace |
| 15 | { |
| 16 | |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 17 | using ::testing::Return; |
| 18 | using ::testing::StrEq; |
| 19 | using ::testing::StrictMock; |
| 20 | |
Patrick Venture | 301e525 | 2019-01-10 09:38:12 -0800 | [diff] [blame] | 21 | TEST(FirmwareHandlerBlobTest, VerifyFirmwareCounts) |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 22 | { |
| 23 | /* Verify the firmware count must be greater than zero. */ |
| 24 | |
| 25 | DataHandlerMock dataMock; |
Patrick Venture | 1cc8895 | 2019-01-04 10:56:32 -0800 | [diff] [blame] | 26 | ImageHandlerMock imageMock; |
| 27 | // StrictMock<SdJournalMock> journalMock; |
| 28 | // SwapJouralHandler(&journalMock); |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 29 | |
Patrick Venture | d4e20de | 2019-07-18 12:48:05 -0700 | [diff] [blame] | 30 | std::vector<HandlerPack> blobs; |
| 31 | blobs.push_back(std::move( |
| 32 | HandlerPack(hashBlobId, std::make_unique<ImageHandlerMock>()))); |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 33 | |
| 34 | std::vector<DataHandlerPack> data = { |
Patrick Venture | 84778b8 | 2019-06-26 20:11:09 -0700 | [diff] [blame] | 35 | {FirmwareFlags::UpdateFlags::ipmi, nullptr}, |
| 36 | {FirmwareFlags::UpdateFlags::lpc, &dataMock}, |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 37 | }; |
| 38 | |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 39 | auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler( |
Patrick Venture | d4e20de | 2019-07-18 12:48:05 -0700 | [diff] [blame] | 40 | std::move(blobs), data, std::move(CreateActionMap("abcd"))); |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 41 | |
Patrick Venture | 1cc8895 | 2019-01-04 10:56:32 -0800 | [diff] [blame] | 42 | // EXPECT_EQ(handler, nullptr); |
| 43 | EXPECT_FALSE(handler == nullptr); |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 44 | } |
| 45 | |
Patrick Venture | fa06a5f | 2019-07-01 09:22:38 -0700 | [diff] [blame] | 46 | } // namespace |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 47 | } // namespace ipmi_flash |