set up data handler mechanism

Data that comes from outside of the IPMI packet will leverage a data
interface implementation.  Only the IPMI blocktransfer (or really KCS)
will not use this external interface.

Change-Id: I7806da04c070dc3d6a79070ea563aeec63221dca
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/data_mock.hpp b/test/data_mock.hpp
new file mode 100644
index 0000000..1fd1fae
--- /dev/null
+++ b/test/data_mock.hpp
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "data_handler.hpp"
+
+#include <gmock/gmock.h>
+
+namespace blobs
+{
+
+class DataHandlerMock : public DataInterface
+{
+  public:
+    virtual ~DataHandlerMock() = default;
+
+    MOCK_METHOD1(copyFrom, std::vector<std::uint8_t>(std::uint32_t));
+};
+
+} // namespace blobs
diff --git a/test/firmware_canhandle_unittest.cpp b/test/firmware_canhandle_unittest.cpp
index 028d472..4f00d50 100644
--- a/test/firmware_canhandle_unittest.cpp
+++ b/test/firmware_canhandle_unittest.cpp
@@ -1,3 +1,4 @@
+#include "data_mock.hpp"
 #include "firmware_handler.hpp"
 #include "image_mock.hpp"
 
@@ -25,9 +26,11 @@
         {"asdf", &imageMock},
         {"bcdf", &imageMock},
     };
+    std::vector<DataHandlerPack> data = {
+        {FirmwareBlobHandler::FirmwareUpdateFlags::bt, nullptr},
+    };
 
-    auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
-        blobs, FirmwareBlobHandler::FirmwareUpdateFlags::bt);
+    auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(blobs, data);
 
     for (const auto& item : items)
     {
diff --git a/test/firmware_handler_unittest.cpp b/test/firmware_handler_unittest.cpp
index 16395df..bae6cab 100644
--- a/test/firmware_handler_unittest.cpp
+++ b/test/firmware_handler_unittest.cpp
@@ -12,7 +12,22 @@
 
 TEST(FirmwareHandlerTest, CreateEmptyListVerifyFails)
 {
-    auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler({}, 0);
+    std::vector<DataHandlerPack> data = {
+        {FirmwareBlobHandler::FirmwareUpdateFlags::bt, nullptr},
+    };
+
+    auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler({}, data);
+    EXPECT_EQ(handler, nullptr);
+}
+TEST(FirmwareHandlerTest, CreateEmptyDataHandlerListFails)
+{
+    ImageHandlerMock imageMock;
+
+    std::vector<HandlerPack> blobs = {
+        {"asdf", &imageMock},
+    };
+
+    auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(blobs, {});
     EXPECT_EQ(handler, nullptr);
 }
 TEST(FirmwareHandlerTest, CreateEmptyListVerifyHasHash)
@@ -22,8 +37,11 @@
     std::vector<HandlerPack> blobs = {
         {"asdf", &imageMock},
     };
+    std::vector<DataHandlerPack> data = {
+        {FirmwareBlobHandler::FirmwareUpdateFlags::bt, nullptr},
+    };
 
-    auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(blobs, 0);
+    auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(blobs, data);
     auto result = handler->getBlobIds();
     EXPECT_EQ(2, result.size());
     EXPECT_EQ(2, std::count(result.begin(), result.end(), "asdf") +
diff --git a/test/firmware_stat_unittest.cpp b/test/firmware_stat_unittest.cpp
index a00adf5..e52ce86 100644
--- a/test/firmware_stat_unittest.cpp
+++ b/test/firmware_stat_unittest.cpp
@@ -22,9 +22,11 @@
     std::vector<HandlerPack> blobs = {
         {"asdf", &imageMock},
     };
+    std::vector<DataHandlerPack> data = {
+        {FirmwareBlobHandler::FirmwareUpdateFlags::bt, nullptr},
+    };
 
-    auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
-        blobs, FirmwareBlobHandler::FirmwareUpdateFlags::bt);
+    auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(blobs, data);
     struct BlobMeta meta;
     EXPECT_TRUE(handler->stat("asdf", &meta));
     EXPECT_EQ(FirmwareBlobHandler::FirmwareUpdateFlags::bt, meta.blobState);