bmc: enable configuration of all verification
Enable verification configuration beyond the result file check. This
patchset allows a developer to provide their own verification mechanisms
by implementing an interface and adding configuration to enable using
their custom version.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Iba5d4be75bb49d9c4ab84be8578f0306c15b5be9
diff --git a/test/firmware_canhandle_unittest.cpp b/test/firmware_canhandle_unittest.cpp
index f739b9e..380df45 100644
--- a/test/firmware_canhandle_unittest.cpp
+++ b/test/firmware_canhandle_unittest.cpp
@@ -2,8 +2,8 @@
#include "firmware_handler.hpp"
#include "image_mock.hpp"
#include "util.hpp"
+#include "verification_mock.hpp"
-#include <sdbusplus/test/sdbus_mock.hpp>
#include <vector>
#include <gtest/gtest.h>
@@ -32,11 +32,8 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
for (const auto& item : items)
{
diff --git a/test/firmware_close_unittest.cpp b/test/firmware_close_unittest.cpp
index b0d20fb..ff839af 100644
--- a/test/firmware_close_unittest.cpp
+++ b/test/firmware_close_unittest.cpp
@@ -2,8 +2,8 @@
#include "firmware_handler.hpp"
#include "image_mock.hpp"
#include "util.hpp"
+#include "verification_mock.hpp"
-#include <sdbusplus/test/sdbus_mock.hpp>
#include <vector>
#include <gmock/gmock.h>
@@ -32,11 +32,8 @@
{FirmwareBlobHandler::UpdateFlags::lpc, &dataMock},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(dataMock, open()).WillOnce(Return(true));
EXPECT_CALL(imageMock, open(StrEq(hashBlobId))).WillOnce(Return(true));
@@ -78,11 +75,8 @@
{FirmwareBlobHandler::UpdateFlags::lpc, &dataMock},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(imageMock, open(StrEq(hashBlobId))).WillOnce(Return(true));
diff --git a/test/firmware_commit_unittest.cpp b/test/firmware_commit_unittest.cpp
index 009f158..2766fd3 100644
--- a/test/firmware_commit_unittest.cpp
+++ b/test/firmware_commit_unittest.cpp
@@ -2,8 +2,8 @@
#include "firmware_handler.hpp"
#include "image_mock.hpp"
#include "util.hpp"
+#include "verification_mock.hpp"
-#include <sdbusplus/test/sdbus_mock.hpp>
#include <vector>
#include <gtest/gtest.h>
@@ -32,11 +32,12 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
+ /* Verify it doesn't get called by using StrictMock. */
+ std::unique_ptr<VerificationInterface> verifyMock =
+ std::make_unique<StrictMock<VerificationMock>>();
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, std::move(verifyMock));
EXPECT_CALL(imageMock2, open("asdf")).WillOnce(Return(true));
@@ -61,11 +62,12 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
+ /* Verify it doesn't get called by using StrictMock. */
+ std::unique_ptr<VerificationInterface> verifyMock =
+ std::make_unique<StrictMock<VerificationMock>>();
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, std::move(verifyMock));
EXPECT_CALL(imageMock1, open(StrEq(hashBlobId))).WillOnce(Return(true));
@@ -91,14 +93,17 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
+ auto verifyMock = CreateVerifyMock();
+ auto verifyMockPtr = reinterpret_cast<VerificationMock*>(verifyMock.get());
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, std::move(verifyMock));
EXPECT_TRUE(handler->open(0, OpenFlags::write, verifyBlobId));
+ EXPECT_CALL(*verifyMockPtr, triggerVerification())
+ .WillRepeatedly(Return(true));
+
EXPECT_TRUE(handler->commit(0, {}));
}
@@ -117,29 +122,16 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- StrictMock<sdbusplus::SdBusMock> sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
+ auto verifyMock = CreateVerifyMock();
+ auto verifyMockPtr = reinterpret_cast<VerificationMock*>(verifyMock.get());
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, std::move(verifyMock));
EXPECT_TRUE(handler->open(0, OpenFlags::write, verifyBlobId));
- /* Note: I used StrictMock<> here to just catch all the calls. However, the
- * unit-tests pass if we don't use StrictMock and ignore the calls.
- */
- EXPECT_CALL(sdbus_mock,
- sd_bus_message_new_method_call(
- IsNull(), NotNull(), StrEq("org.freedesktop.systemd1"),
- StrEq("/org/freedesktop/systemd1"),
- StrEq("org.freedesktop.systemd1.Manager"),
- StrEq("StartUnit")))
- .WillOnce(Return(0));
- EXPECT_CALL(sdbus_mock,
- sd_bus_message_append_basic(IsNull(), 's', NotNull()))
- .Times(2)
- .WillRepeatedly(Return(0));
- EXPECT_CALL(sdbus_mock, sd_bus_call(_, _, _, _, _)).WillOnce(Return(0));
+ EXPECT_CALL(*verifyMockPtr, triggerVerification())
+ .WillRepeatedly(Return(true));
EXPECT_TRUE(handler->commit(0, {}));
EXPECT_TRUE(handler->commit(0, {}));
diff --git a/test/firmware_createhandler_unittest.cpp b/test/firmware_createhandler_unittest.cpp
index 3bee96e..4821ffa 100644
--- a/test/firmware_createhandler_unittest.cpp
+++ b/test/firmware_createhandler_unittest.cpp
@@ -2,14 +2,10 @@
#include "firmware_handler.hpp"
#include "image_mock.hpp"
#include "util.hpp"
-
-#include <phosphor-logging/test/sdjournal_mock.hpp>
-#include <sdbusplus/test/sdbus_mock.hpp>
+#include "verification_mock.hpp"
#include <gtest/gtest.h>
-using namespace phosphor::logging;
-
namespace blobs
{
using ::testing::Return;
@@ -34,16 +30,8 @@
{FirmwareBlobHandler::UpdateFlags::lpc, &dataMock},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
- // TODO: Once we can test across log<> paths again, re-enable this test
- // as a failure test instead of a success one. EXPECT_CALL(journalMock,
- // journal_send_call(StrEq("PRIORITY=%d")))
- // .WillOnce(Return(0));
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
// EXPECT_EQ(handler, nullptr);
EXPECT_FALSE(handler == nullptr);
diff --git a/test/firmware_delete_unittest.cpp b/test/firmware_delete_unittest.cpp
index 8d21e29..de67a15 100644
--- a/test/firmware_delete_unittest.cpp
+++ b/test/firmware_delete_unittest.cpp
@@ -2,8 +2,8 @@
#include "firmware_handler.hpp"
#include "image_mock.hpp"
#include "util.hpp"
+#include "verification_mock.hpp"
-#include <sdbusplus/test/sdbus_mock.hpp>
#include <vector>
#include <gmock/gmock.h>
@@ -30,11 +30,8 @@
{FirmwareBlobHandler::UpdateFlags::lpc, &dataMock},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(imageMock, open(StrEq(hashBlobId))).WillOnce(Return(true));
diff --git a/test/firmware_handler_unittest.cpp b/test/firmware_handler_unittest.cpp
index 65e73bd..09cbf9e 100644
--- a/test/firmware_handler_unittest.cpp
+++ b/test/firmware_handler_unittest.cpp
@@ -1,9 +1,9 @@
#include "firmware_handler.hpp"
#include "image_mock.hpp"
#include "util.hpp"
+#include "verification_mock.hpp"
#include <algorithm>
-#include <sdbusplus/test/sdbus_mock.hpp>
#include <vector>
#include <gtest/gtest.h>
@@ -17,11 +17,8 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), {}, data, "");
+ {}, data, CreateVerifyMock());
EXPECT_EQ(handler, nullptr);
}
TEST(FirmwareHandlerTest, CreateEmptyDataHandlerListFails)
@@ -33,11 +30,8 @@
{"asdf", &imageMock},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, {}, "");
+ blobs, {}, CreateVerifyMock());
EXPECT_EQ(handler, nullptr);
}
TEST(FirmwareHandlerTest, VerifyHashRequiredForHappiness)
@@ -52,17 +46,14 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_EQ(handler, nullptr);
blobs.push_back({hashBlobId, &imageMock});
handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
auto result = handler->getBlobIds();
EXPECT_EQ(3, result.size());
EXPECT_EQ(3, std::count(result.begin(), result.end(), "asdf") +
diff --git a/test/firmware_open_unittest.cpp b/test/firmware_open_unittest.cpp
index 5b6d690..5148a44 100644
--- a/test/firmware_open_unittest.cpp
+++ b/test/firmware_open_unittest.cpp
@@ -2,8 +2,8 @@
#include "firmware_handler.hpp"
#include "image_mock.hpp"
#include "util.hpp"
+#include "verification_mock.hpp"
-#include <sdbusplus/test/sdbus_mock.hpp>
#include <vector>
#include <gmock/gmock.h>
@@ -30,11 +30,8 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(imageMock, open("asdf")).WillOnce(Return(true));
@@ -61,11 +58,8 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(imageMock, open(StrEq(hashBlobId))).WillOnce(Return(true));
@@ -97,11 +91,8 @@
{FirmwareBlobHandler::UpdateFlags::lpc, &dataMock},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(dataMock, open()).WillOnce(Return(true));
EXPECT_CALL(imageMock, open(StrEq(hashBlobId))).WillOnce(Return(true));
@@ -132,11 +123,8 @@
{FirmwareBlobHandler::UpdateFlags::lpc, &dataMock},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(dataMock, open()).WillOnce(Return(false));
@@ -164,11 +152,8 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(imageMock2, open("asdf")).WillOnce(Return(true));
@@ -212,11 +197,8 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(imageMock, open("asdf")).WillOnce(Return(true));
@@ -254,11 +236,8 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(imageMock, open("asdf")).WillOnce(Return(false));
@@ -284,11 +263,8 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_FALSE(
handler->open(0, FirmwareBlobHandler::UpdateFlags::ipmi, "asdf"));
@@ -308,11 +284,8 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_FALSE(
handler->open(0, FirmwareBlobHandler::UpdateFlags::lpc, "asdf"));
@@ -332,11 +305,8 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_FALSE(handler->open(
0, OpenFlags::write | FirmwareBlobHandler::UpdateFlags::ipmi, "bcdf"));
diff --git a/test/firmware_sessionstat_unittest.cpp b/test/firmware_sessionstat_unittest.cpp
index 891ade2..7882141 100644
--- a/test/firmware_sessionstat_unittest.cpp
+++ b/test/firmware_sessionstat_unittest.cpp
@@ -2,8 +2,8 @@
#include "firmware_handler.hpp"
#include "image_mock.hpp"
#include "util.hpp"
+#include "verification_mock.hpp"
-#include <sdbusplus/test/sdbus_mock.hpp>
#include <vector>
#include <gtest/gtest.h>
@@ -28,11 +28,8 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(imageMock2, open("asdf")).WillOnce(Return(true));
@@ -69,11 +66,8 @@
{FirmwareBlobHandler::UpdateFlags::lpc, &dataMock},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(dataMock, open()).WillOnce(Return(true));
EXPECT_CALL(imageMock2, open("asdf")).WillOnce(Return(true));
diff --git a/test/firmware_stat_unittest.cpp b/test/firmware_stat_unittest.cpp
index 79b8a44..becb3f1 100644
--- a/test/firmware_stat_unittest.cpp
+++ b/test/firmware_stat_unittest.cpp
@@ -1,8 +1,8 @@
#include "firmware_handler.hpp"
#include "image_mock.hpp"
#include "util.hpp"
+#include "verification_mock.hpp"
-#include <sdbusplus/test/sdbus_mock.hpp>
#include <vector>
#include <gtest/gtest.h>
@@ -28,11 +28,8 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
struct BlobMeta meta;
EXPECT_TRUE(handler->stat("asdf", &meta));
diff --git a/test/firmware_write_unittest.cpp b/test/firmware_write_unittest.cpp
index 75eab40..72ffcb3 100644
--- a/test/firmware_write_unittest.cpp
+++ b/test/firmware_write_unittest.cpp
@@ -2,10 +2,10 @@
#include "firmware_handler.hpp"
#include "image_mock.hpp"
#include "util.hpp"
+#include "verification_mock.hpp"
#include <cstdint>
#include <cstring>
-#include <sdbusplus/test/sdbus_mock.hpp>
#include <vector>
#include <gtest/gtest.h>
@@ -29,11 +29,8 @@
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(imageMock2, open("asdf")).WillOnce(Return(true));
@@ -63,11 +60,8 @@
{FirmwareBlobHandler::UpdateFlags::lpc, &dataMock},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(dataMock, open()).WillOnce(Return(true));
EXPECT_CALL(imageMock2, open("asdf")).WillOnce(Return(true));
@@ -106,11 +100,8 @@
{FirmwareBlobHandler::UpdateFlags::lpc, &dataMock},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(dataMock, open()).WillOnce(Return(true));
EXPECT_CALL(imageMock2, open("asdf")).WillOnce(Return(true));
diff --git a/test/firmware_writemeta_unittest.cpp b/test/firmware_writemeta_unittest.cpp
index f70495a..3441a14 100644
--- a/test/firmware_writemeta_unittest.cpp
+++ b/test/firmware_writemeta_unittest.cpp
@@ -2,8 +2,7 @@
#include "firmware_handler.hpp"
#include "image_mock.hpp"
#include "util.hpp"
-
-#include <sdbusplus/test/sdbus_mock.hpp>
+#include "verification_mock.hpp"
#include <gtest/gtest.h>
@@ -27,11 +26,8 @@
{FirmwareBlobHandler::UpdateFlags::lpc, &dataMock},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(imageMock2, open("asdf")).WillOnce(Return(true));
@@ -58,11 +54,8 @@
{FirmwareBlobHandler::UpdateFlags::lpc, &dataMock},
};
- sdbusplus::SdBusMock sdbus_mock;
- auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
-
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- std::move(bus_mock), blobs, data, "");
+ blobs, data, CreateVerifyMock());
EXPECT_CALL(dataMock, open()).WillOnce(Return(true));
EXPECT_CALL(imageMock2, open("asdf")).WillOnce(Return(true));
diff --git a/test/verification_mock.hpp b/test/verification_mock.hpp
new file mode 100644
index 0000000..e1021c8
--- /dev/null
+++ b/test/verification_mock.hpp
@@ -0,0 +1,27 @@
+#pragma once
+
+#include "status.hpp"
+#include "verify.hpp"
+
+#include <memory>
+#include <vector>
+
+#include <gtest/gtest.h>
+
+namespace blobs
+{
+
+class VerificationMock : public VerificationInterface
+{
+ public:
+ MOCK_METHOD0(triggerVerification, bool());
+ MOCK_METHOD0(abortVerification, void());
+ MOCK_METHOD0(checkVerificationState, VerifyCheckResponses());
+};
+
+std::unique_ptr<VerificationInterface> CreateVerifyMock()
+{
+ return std::make_unique<VerificationMock>();
+}
+
+} // namespace blobs