bmc: move from data section objs to owned
Move from objects created ahead of purpose to owned objects. This is a
step towards integrating with the json support.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I738a5edd40724f17245911af1080c350f029fef1
diff --git a/bmc/test/firmware_stat_unittest.cpp b/bmc/test/firmware_stat_unittest.cpp
index b71d5c7..6e97cc8 100644
--- a/bmc/test/firmware_stat_unittest.cpp
+++ b/bmc/test/firmware_stat_unittest.cpp
@@ -4,12 +4,16 @@
#include "triggerable_mock.hpp"
#include "util.hpp"
+#include <memory>
#include <vector>
#include <gtest/gtest.h>
namespace ipmi_flash
{
+namespace
+{
+
TEST(FirmwareHandlerStatTest, StatOnInactiveBlobIDReturnsTransport)
{
/* Test that the metadata information returned matches expectations for this
@@ -19,22 +23,23 @@
* the input for this function.
*/
- ImageHandlerMock imageMock;
+ std::vector<HandlerPack> blobs;
+ blobs.push_back(std::move(
+ HandlerPack(hashBlobId, std::make_unique<ImageHandlerMock>())));
+ blobs.push_back(
+ std::move(HandlerPack("asdf", std::make_unique<ImageHandlerMock>())));
- std::vector<HandlerPack> blobs = {
- {hashBlobId, &imageMock},
- {"asdf", &imageMock},
- };
std::vector<DataHandlerPack> data = {
{FirmwareFlags::UpdateFlags::ipmi, nullptr},
};
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
- blobs, data, std::move(CreateActionMap("asdf")));
+ std::move(blobs), data, std::move(CreateActionMap("asdf")));
blobs::BlobMeta meta;
EXPECT_TRUE(handler->stat("asdf", &meta));
EXPECT_EQ(FirmwareFlags::UpdateFlags::ipmi, meta.blobState);
}
+} // namespace
} // namespace ipmi_flash