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