blob: 7d0961b5f8a47791763e04bf36839861aac53c5d [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 Venturea78e39f2018-11-06 18:37:06 -080027 blobs, static_cast<uint16_t>(FirmwareUpdateFlags::bt));
Patrick Venture46637c82018-11-06 15:20:24 -080028 struct BlobMeta meta;
29 EXPECT_TRUE(handler->stat("asdf", &meta));
30 EXPECT_EQ(static_cast<uint16_t>(FirmwareUpdateFlags::bt), meta.blobState);
31}
32
33} // namespace blobs