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