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_handler_unittest.cpp b/bmc/test/firmware_handler_unittest.cpp
index 29df507..700a75a 100644
--- a/bmc/test/firmware_handler_unittest.cpp
+++ b/bmc/test/firmware_handler_unittest.cpp
@@ -5,6 +5,7 @@
 #include "util.hpp"
 
 #include <algorithm>
+#include <memory>
 #include <vector>
 
 #include <gtest/gtest.h>
@@ -30,35 +31,39 @@
 {
     ImageHandlerMock imageMock;
 
-    std::vector<HandlerPack> blobs = {
-        {hashBlobId, &imageMock},
-        {"asdf", &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>())));
 
     auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
-        blobs, {}, std::move(CreateActionMap("asdf")));
+        std::move(blobs), {}, std::move(CreateActionMap("asdf")));
     EXPECT_EQ(handler, nullptr);
 }
 TEST(FirmwareHandlerTest, VerifyHashRequiredForHappiness)
 {
-    /* This works fine only if you also pass in the hash handler. */
-    ImageHandlerMock imageMock;
-
-    std::vector<HandlerPack> blobs = {
-        {"asdf", &imageMock},
-    };
     std::vector<DataHandlerPack> data = {
         {FirmwareFlags::UpdateFlags::ipmi, nullptr},
     };
 
+    /* This works fine only if you also pass in the hash handler. */
+    std::vector<HandlerPack> blobs;
+    blobs.push_back(
+        std::move(HandlerPack("asdf", std::make_unique<ImageHandlerMock>())));
+
     auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
-        blobs, data, std::move(CreateActionMap("asdf")));
+        std::move(blobs), data, std::move(CreateActionMap("asdf")));
     EXPECT_EQ(handler, nullptr);
 
-    blobs.push_back({hashBlobId, &imageMock});
+    std::vector<HandlerPack> blobs2;
+    blobs2.push_back(
+        std::move(HandlerPack("asdf", std::make_unique<ImageHandlerMock>())));
+    blobs2.push_back(std::move(
+        HandlerPack(hashBlobId, std::make_unique<ImageHandlerMock>())));
 
     handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
-        blobs, data, std::move(CreateActionMap("asdf")));
+        std::move(blobs2), data, std::move(CreateActionMap("asdf")));
 
     auto result = handler->getBlobIds();
     std::vector<std::string> expectedBlobs = {"asdf", hashBlobId};