blob: 1f1ae86a2a6263582feba8c1792dedab52be7221 [file] [log] [blame]
Patrick Venture1361a122019-05-20 07:36:05 -07001#pragma once
2
Patrick Venture27ac5822019-05-20 17:39:31 -07003#include "bmc_update_mock.hpp"
Patrick Venture1361a122019-05-20 07:36:05 -07004#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 Venture1d5a31c2019-05-20 11:38:22 -070015namespace ipmi_flash
Patrick Venture1361a122019-05-20 07:36:05 -070016{
17
Patrick Venture8a4f2aa2019-05-23 08:40:21 -070018class 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 Venture1361a122019-05-20 07:36:05 -070038class 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 Venture1d5a31c2019-05-20 11:38:22 -070045 std::unique_ptr<blobs::GenericBlobInterface> handler;
Patrick Venture1361a122019-05-20 07:36:05 -070046
47 void SetUp() override
48 {
49 blobs = {
50 {hashBlobId, &imageMock},
51 {"asdf", &imageMock},
52 };
53 handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
Patrick Venture27ac5822019-05-20 17:39:31 -070054 blobs, data, CreateVerifyMock(), CreateUpdateMock());
Patrick Venture1361a122019-05-20 07:36:05 -070055 }
56};
57
58class FakeLpcFirmwareTest : public ::testing::Test
59{
60 protected:
61 DataHandlerMock dataMock;
62 ImageHandlerMock imageMock;
63 std::vector<HandlerPack> blobs;
64 std::vector<DataHandlerPack> data;
Patrick Venture1d5a31c2019-05-20 11:38:22 -070065 std::unique_ptr<blobs::GenericBlobInterface> handler;
Patrick Venture1361a122019-05-20 07:36:05 -070066
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 Venture27ac5822019-05-20 17:39:31 -070078 blobs, data, CreateVerifyMock(), CreateUpdateMock());
Patrick Venture1361a122019-05-20 07:36:05 -070079 }
80};
81
Patrick Venture1d5a31c2019-05-20 11:38:22 -070082} // namespace ipmi_flash