Patrick Venture | 1361a12 | 2019-05-20 07:36:05 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | 27ac582 | 2019-05-20 17:39:31 -0700 | [diff] [blame] | 3 | #include "bmc_update_mock.hpp" |
Patrick Venture | 1361a12 | 2019-05-20 07:36:05 -0700 | [diff] [blame] | 4 | #include "data_mock.hpp" |
| 5 | #include "firmware_handler.hpp" |
| 6 | #include "image_mock.hpp" |
| 7 | #include "verification_mock.hpp" |
| 8 | |
| 9 | #include <memory> |
| 10 | #include <vector> |
| 11 | |
| 12 | #include <gmock/gmock.h> |
| 13 | #include <gtest/gtest.h> |
| 14 | |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 15 | namespace ipmi_flash |
Patrick Venture | 1361a12 | 2019-05-20 07:36:05 -0700 | [diff] [blame] | 16 | { |
| 17 | |
Patrick Venture | 8a4f2aa | 2019-05-23 08:40:21 -0700 | [diff] [blame^] | 18 | class IpmiOnlyFirmwareStaticTest : public ::testing::Test |
| 19 | { |
| 20 | protected: |
| 21 | ImageHandlerMock imageMock; |
| 22 | std::vector<HandlerPack> blobs; |
| 23 | std::vector<DataHandlerPack> data = { |
| 24 | {FirmwareBlobHandler::UpdateFlags::ipmi, nullptr}}; |
| 25 | std::unique_ptr<blobs::GenericBlobInterface> handler; |
| 26 | |
| 27 | void SetUp() override |
| 28 | { |
| 29 | blobs = { |
| 30 | {hashBlobId, &imageMock}, |
| 31 | {staticLayoutBlobId, &imageMock}, |
| 32 | }; |
| 33 | handler = FirmwareBlobHandler::CreateFirmwareBlobHandler( |
| 34 | blobs, data, CreateVerifyMock(), CreateUpdateMock()); |
| 35 | } |
| 36 | }; |
| 37 | |
Patrick Venture | 1361a12 | 2019-05-20 07:36:05 -0700 | [diff] [blame] | 38 | class IpmiOnlyFirmwareTest : public ::testing::Test |
| 39 | { |
| 40 | protected: |
| 41 | ImageHandlerMock imageMock; |
| 42 | std::vector<HandlerPack> blobs; |
| 43 | std::vector<DataHandlerPack> data = { |
| 44 | {FirmwareBlobHandler::UpdateFlags::ipmi, nullptr}}; |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 45 | std::unique_ptr<blobs::GenericBlobInterface> handler; |
Patrick Venture | 1361a12 | 2019-05-20 07:36:05 -0700 | [diff] [blame] | 46 | |
| 47 | void SetUp() override |
| 48 | { |
| 49 | blobs = { |
| 50 | {hashBlobId, &imageMock}, |
| 51 | {"asdf", &imageMock}, |
| 52 | }; |
| 53 | handler = FirmwareBlobHandler::CreateFirmwareBlobHandler( |
Patrick Venture | 27ac582 | 2019-05-20 17:39:31 -0700 | [diff] [blame] | 54 | blobs, data, CreateVerifyMock(), CreateUpdateMock()); |
Patrick Venture | 1361a12 | 2019-05-20 07:36:05 -0700 | [diff] [blame] | 55 | } |
| 56 | }; |
| 57 | |
| 58 | class FakeLpcFirmwareTest : public ::testing::Test |
| 59 | { |
| 60 | protected: |
| 61 | DataHandlerMock dataMock; |
| 62 | ImageHandlerMock imageMock; |
| 63 | std::vector<HandlerPack> blobs; |
| 64 | std::vector<DataHandlerPack> data; |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 65 | std::unique_ptr<blobs::GenericBlobInterface> handler; |
Patrick Venture | 1361a12 | 2019-05-20 07:36:05 -0700 | [diff] [blame] | 66 | |
| 67 | void SetUp() override |
| 68 | { |
| 69 | blobs = { |
| 70 | {hashBlobId, &imageMock}, |
| 71 | {"asdf", &imageMock}, |
| 72 | }; |
| 73 | data = { |
| 74 | {FirmwareBlobHandler::UpdateFlags::ipmi, nullptr}, |
| 75 | {FirmwareBlobHandler::UpdateFlags::lpc, &dataMock}, |
| 76 | }; |
| 77 | handler = FirmwareBlobHandler::CreateFirmwareBlobHandler( |
Patrick Venture | 27ac582 | 2019-05-20 17:39:31 -0700 | [diff] [blame] | 78 | blobs, data, CreateVerifyMock(), CreateUpdateMock()); |
Patrick Venture | 1361a12 | 2019-05-20 07:36:05 -0700 | [diff] [blame] | 79 | } |
| 80 | }; |
| 81 | |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 82 | } // namespace ipmi_flash |