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 | |
| 8 | #include <gtest/gtest.h> |
| 9 | |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 10 | namespace ipmi_flash |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 11 | { |
| 12 | using ::testing::Return; |
| 13 | using ::testing::StrEq; |
| 14 | using ::testing::StrictMock; |
| 15 | |
Patrick Venture | 301e525 | 2019-01-10 09:38:12 -0800 | [diff] [blame] | 16 | TEST(FirmwareHandlerBlobTest, VerifyFirmwareCounts) |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 17 | { |
| 18 | /* Verify the firmware count must be greater than zero. */ |
| 19 | |
| 20 | DataHandlerMock dataMock; |
Patrick Venture | 1cc8895 | 2019-01-04 10:56:32 -0800 | [diff] [blame] | 21 | ImageHandlerMock imageMock; |
| 22 | // StrictMock<SdJournalMock> journalMock; |
| 23 | // SwapJouralHandler(&journalMock); |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 24 | |
Patrick Venture | 1cc8895 | 2019-01-04 10:56:32 -0800 | [diff] [blame] | 25 | std::vector<HandlerPack> blobs = { |
Patrick Venture | 7dad86f | 2019-05-17 08:52:20 -0700 | [diff] [blame] | 26 | {hashBlobId, &imageMock}, |
Patrick Venture | 1cc8895 | 2019-01-04 10:56:32 -0800 | [diff] [blame] | 27 | }; |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 28 | |
| 29 | std::vector<DataHandlerPack> data = { |
Patrick Venture | 84778b8 | 2019-06-26 20:11:09 -0700 | [diff] [blame] | 30 | {FirmwareFlags::UpdateFlags::ipmi, nullptr}, |
| 31 | {FirmwareFlags::UpdateFlags::lpc, &dataMock}, |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 32 | }; |
| 33 | |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 34 | auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler( |
Patrick Venture | 6d7735d | 2019-06-21 10:03:19 -0700 | [diff] [blame] | 35 | blobs, data, CreateTriggerMock(), CreateTriggerMock(), |
| 36 | CreateTriggerMock()); |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 37 | |
Patrick Venture | 1cc8895 | 2019-01-04 10:56:32 -0800 | [diff] [blame] | 38 | // EXPECT_EQ(handler, nullptr); |
| 39 | EXPECT_FALSE(handler == nullptr); |
Patrick Venture | d333a87 | 2018-12-03 16:24:26 -0800 | [diff] [blame] | 40 | } |
| 41 | |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 42 | } // namespace ipmi_flash |