tests: Add unit-tests for canHandleBlob

Add unit-tests for canHandleBlob interface method.

Change-Id: I975d6f41f2a010fd3473c4f18b7018e5036a37e1
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/Makefile.am b/test/Makefile.am
index 589e56d..ecd0ad8 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -11,7 +11,8 @@
 # Run all 'check' test programs
 check_PROGRAMS = \
 	firmware_handler_unittest \
-	firmware_stat_unittest
+	firmware_stat_unittest \
+	firmware_canhandle_unittest
 
 TESTS = $(check_PROGRAMS)
 
@@ -21,3 +22,5 @@
 firmware_stat_unittest_SOURCES = firmware_stat_unittest.cpp
 firmware_stat_unittest_LDADD = $(top_builddir)/firmware_handler.o
 
+firmware_canhandle_unittest_SOURCES = firmware_canhandle_unittest.cpp
+firmware_canhandle_unittest_LDADD = $(top_builddir)/firmware_handler.o
diff --git a/test/firmware_canhandle_unittest.cpp b/test/firmware_canhandle_unittest.cpp
new file mode 100644
index 0000000..2350828
--- /dev/null
+++ b/test/firmware_canhandle_unittest.cpp
@@ -0,0 +1,30 @@
+#include "firmware_handler.hpp"
+
+#include <memory>
+#include <vector>
+
+#include <gtest/gtest.h>
+
+namespace blobs
+{
+TEST(FirmwareHandlerCanHandleTest, VerifyItemsInListAreOk)
+{
+
+    struct ListItem
+    {
+        std::string name;
+        bool expected;
+    };
+
+    std::vector<ListItem> items = {
+        {"asdf", true}, {"nope", false}, {"123123", false}, {"bcdf", true}};
+
+    auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
+        {"asdf", "bcdf"}, static_cast<uint16_t>(FirmwareUpdateFlags::bt));
+
+    for (const auto& item : items)
+    {
+        EXPECT_EQ(item.expected, handler->canHandleBlob(item.name));
+    }
+}
+} // namespace blobs