blob: 5b7ddb13340434a73de1ec6fd7ae0b931cb2aeda [file] [log] [blame]
Patrick Venture8e1b2332019-01-17 15:22:45 -08001#include "blob_interface_mock.hpp"
2#include "internal_sys_mock.hpp"
3#include "lpc.hpp"
4
5#include <cstring>
6
7#include <gtest/gtest.h>
8
9namespace host_tool
10{
11
12using ::testing::ContainerEq;
13
14TEST(LpcHandleTest, verifySendsFileContents)
15{
16 BlobInterfaceMock blobMock;
17
18 LpcDataHandler handler(&blobMock);
19 std::uint16_t session = 0xbeef;
20 std::string filePath = "/asdf";
21
22 LpcRegion host_lpc_buf;
23 host_lpc_buf.address = 0xfedc1000;
24 host_lpc_buf.length = 0x1000;
25
26 std::vector<std::uint8_t> bytes(sizeof(host_lpc_buf));
27 std::memcpy(bytes.data(), &host_lpc_buf, sizeof(host_lpc_buf));
28
29 EXPECT_CALL(blobMock, writeMeta(session, 0, ContainerEq(bytes)));
30
31 EXPECT_FALSE(handler.sendContents(filePath, session));
32}
33
34} // namespace host_tool