blob: a00adf597a787f5c7a88363b621c0cff48989316 [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 };
25
Patrick Venture46637c82018-11-06 15:20:24 -080026 auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
Patrick Venturefc3857b2018-11-07 08:14:55 -080027 blobs, FirmwareBlobHandler::FirmwareUpdateFlags::bt);
Patrick Venture46637c82018-11-06 15:20:24 -080028 struct BlobMeta meta;
29 EXPECT_TRUE(handler->stat("asdf", &meta));
Patrick Venturefc3857b2018-11-07 08:14:55 -080030 EXPECT_EQ(FirmwareBlobHandler::FirmwareUpdateFlags::bt, meta.blobState);
Patrick Venture46637c82018-11-06 15:20:24 -080031}
32
33} // namespace blobs