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_write_unittest.cpp b/bmc/test/firmware_write_unittest.cpp
index b3353c9..481f3ec 100644
--- a/bmc/test/firmware_write_unittest.cpp
+++ b/bmc/test/firmware_write_unittest.cpp
@@ -14,6 +14,9 @@
 
 namespace ipmi_flash
 {
+namespace
+{
+
 using ::testing::Eq;
 using ::testing::Return;
 
@@ -28,14 +31,14 @@
 TEST_F(FirmwareHandlerWriteTestIpmiOnly, DataTypeIpmiWriteSuccess)
 {
     /* Verify if data type ipmi, it calls write with the bytes. */
-    EXPECT_CALL(imageMock, open("asdf")).WillOnce(Return(true));
+    EXPECT_CALL(*imageMock, open("asdf")).WillOnce(Return(true));
 
     EXPECT_TRUE(handler->open(
         0, blobs::OpenFlags::write | FirmwareFlags::UpdateFlags::ipmi, "asdf"));
 
     std::vector<std::uint8_t> bytes = {0xaa, 0x55};
 
-    EXPECT_CALL(imageMock, write(0, Eq(bytes))).WillOnce(Return(true));
+    EXPECT_CALL(*imageMock, write(0, Eq(bytes))).WillOnce(Return(true));
     EXPECT_TRUE(handler->write(0, 0, bytes));
 }
 
@@ -43,7 +46,7 @@
 {
     /* Verify if data type non-ipmi, it calls write with the length. */
     EXPECT_CALL(dataMock, open()).WillOnce(Return(true));
-    EXPECT_CALL(imageMock, open("asdf")).WillOnce(Return(true));
+    EXPECT_CALL(*imageMock, open("asdf")).WillOnce(Return(true));
 
     EXPECT_TRUE(handler->open(
         0, blobs::OpenFlags::write | FirmwareFlags::UpdateFlags::lpc, "asdf"));
@@ -57,7 +60,7 @@
     std::vector<std::uint8_t> bytes = {0x01, 0x02, 0x03, 0x04};
 
     EXPECT_CALL(dataMock, copyFrom(request.length)).WillOnce(Return(bytes));
-    EXPECT_CALL(imageMock, write(0, Eq(bytes))).WillOnce(Return(true));
+    EXPECT_CALL(*imageMock, write(0, Eq(bytes))).WillOnce(Return(true));
     EXPECT_TRUE(handler->write(0, 0, ipmiRequest));
 }
 
@@ -66,7 +69,7 @@
     /* Verify the data type non-ipmi, if the request's structure doesn't match,
      * return failure. */
     EXPECT_CALL(dataMock, open()).WillOnce(Return(true));
-    EXPECT_CALL(imageMock, open("asdf")).WillOnce(Return(true));
+    EXPECT_CALL(*imageMock, open("asdf")).WillOnce(Return(true));
 
     EXPECT_TRUE(handler->open(
         0, blobs::OpenFlags::write | FirmwareFlags::UpdateFlags::lpc, "asdf"));
@@ -83,4 +86,5 @@
     EXPECT_FALSE(handler->write(0, 0, ipmiRequest));
 }
 
+} // namespace
 } // namespace ipmi_flash