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_commit_unittest.cpp b/bmc/test/firmware_commit_unittest.cpp
index 16d9881..51592a9 100644
--- a/bmc/test/firmware_commit_unittest.cpp
+++ b/bmc/test/firmware_commit_unittest.cpp
@@ -24,16 +24,20 @@
 class FirmwareHandlerCommitTest : public ::testing::Test
 {
   protected:
-    ImageHandlerMock imageMock1, imageMock2;
+    ImageHandlerMock *imageMock1, *imageMock2;
     std::vector<HandlerPack> blobs;
     std::vector<DataHandlerPack> data;
 
     void SetUp() override
     {
-        blobs = {
-            {hashBlobId, &imageMock1},
-            {"asdf", &imageMock2},
-        };
+        std::unique_ptr<ImageHandlerInterface> image =
+            std::make_unique<ImageHandlerMock>();
+        imageMock1 = reinterpret_cast<ImageHandlerMock*>(image.get());
+        blobs.push_back(std::move(HandlerPack(hashBlobId, std::move(image))));
+
+        image = std::make_unique<ImageHandlerMock>();
+        imageMock2 = reinterpret_cast<ImageHandlerMock*>(image.get());
+        blobs.push_back(std::move(HandlerPack("asdf", std::move(image))));
 
         data = {
             {FirmwareFlags::UpdateFlags::ipmi, nullptr},
@@ -52,9 +56,9 @@
         std::make_unique<StrictMock<TriggerMock>>();
 
     auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
-        blobs, data, std::move(CreateActionMap("asdf")));
+        std::move(blobs), data, std::move(CreateActionMap("asdf")));
 
-    EXPECT_CALL(imageMock2, open("asdf")).WillOnce(Return(true));
+    EXPECT_CALL(*imageMock2, open("asdf")).WillOnce(Return(true));
 
     EXPECT_TRUE(handler->open(
         0, blobs::OpenFlags::write | FirmwareFlags::UpdateFlags::ipmi, "asdf"));
@@ -73,9 +77,9 @@
         std::make_unique<StrictMock<TriggerMock>>();
 
     auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
-        blobs, data, std::move(CreateActionMap("asdf")));
+        std::move(blobs), data, std::move(CreateActionMap("asdf")));
 
-    EXPECT_CALL(imageMock1, open(StrEq(hashBlobId))).WillOnce(Return(true));
+    EXPECT_CALL(*imageMock1, open(StrEq(hashBlobId))).WillOnce(Return(true));
 
     EXPECT_TRUE(handler->open(
         0, blobs::OpenFlags::write | FirmwareFlags::UpdateFlags::ipmi,