firmware: implement stat command
Implement the BmcBlobStat command for the generic blob_ids, versus the
active ones.
Also, reduce the size of our transport bits to match the use-case state.
Change-Id: I9e2b28134026e8abfa18952dc80c526f0325308f
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/firmware_stat_unittest.cpp b/test/firmware_stat_unittest.cpp
new file mode 100644
index 0000000..b872b16
--- /dev/null
+++ b/test/firmware_stat_unittest.cpp
@@ -0,0 +1,25 @@
+#include "firmware_handler.hpp"
+
+#include <memory>
+
+#include <gtest/gtest.h>
+
+namespace blobs
+{
+TEST(FirmwareHandlerStatTest, StatOnInactiveBlobIDReturnsTransport)
+{
+ /* Test that the metadata information returned matches expectations for this
+ * case.
+ *
+ * canHandle has already been called at this point, so we don't need to test
+ * the input for this function.
+ */
+
+ auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
+ {"asdf"}, static_cast<uint16_t>(FirmwareUpdateFlags::bt));
+ struct BlobMeta meta;
+ EXPECT_TRUE(handler->stat("asdf", &meta));
+ EXPECT_EQ(static_cast<uint16_t>(FirmwareUpdateFlags::bt), meta.blobState);
+}
+
+} // namespace blobs