blob: e52ce86ae14b4b6c655b73437fcad6148c7f308f [file] [log] [blame]
Patrick Venture46637c82018-11-06 15:20:24 -08001#include "firmware_handler.hpp"
Patrick Venturea78e39f2018-11-06 18:37:06 -08002#include "image_mock.hpp"
Patrick Venture46637c82018-11-06 15:20:24 -08003
4#include <memory>
Patrick Venturea78e39f2018-11-06 18:37:06 -08005#include <vector>
Patrick Venture46637c82018-11-06 15:20:24 -08006
7#include <gtest/gtest.h>
8
9namespace blobs
10{
11TEST(FirmwareHandlerStatTest, StatOnInactiveBlobIDReturnsTransport)
12{
13 /* Test that the metadata information returned matches expectations for this
14 * case.
15 *
16 * canHandle has already been called at this point, so we don't need to test
17 * the input for this function.
18 */
19
Patrick Venturea78e39f2018-11-06 18:37:06 -080020 ImageHandlerMock imageMock;
21
22 std::vector<HandlerPack> blobs = {
23 {"asdf", &imageMock},
24 };
Patrick Venture1cde5f92018-11-07 08:26:47 -080025 std::vector<DataHandlerPack> data = {
26 {FirmwareBlobHandler::FirmwareUpdateFlags::bt, nullptr},
27 };
Patrick Venturea78e39f2018-11-06 18:37:06 -080028
Patrick Venture1cde5f92018-11-07 08:26:47 -080029 auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(blobs, data);
Patrick Venture46637c82018-11-06 15:20:24 -080030 struct BlobMeta meta;
31 EXPECT_TRUE(handler->stat("asdf", &meta));
Patrick Venturefc3857b2018-11-07 08:14:55 -080032 EXPECT_EQ(FirmwareBlobHandler::FirmwareUpdateFlags::bt, meta.blobState);
Patrick Venture46637c82018-11-06 15:20:24 -080033}
34
35} // namespace blobs