class TestTransport

Defined at line 30 of file ../../src/firmware/lib/fastboot/include/lib/fastboot/test/test-transport.h

This class implements a test packet transport to facilitate unit test of

application code that implements FastbootBase. Test create an instance

of this test transport and add test input data to it via the AddInPacket()

interface. The instance can then be passed to FastbootBase::ProcessPacket().

i.e.

class Fastboot : public FastbootBase { ... };

Fastboot fastboot;

std::string command = "continue";

fastboot::TestTransport transport;

transport.AddInPacket(command);

zx::result

<

> ret = fastboot.ProcessPacket(

&transport

);

Public Methods

void AddInPacket (const void * data, size_t size)

Add a packet to the input stream.

Defined at line 13 of file ../../src/firmware/lib/fastboot/test/test-transport.cc

zx::result<size_t> ReceivePacket (void * dst, size_t capacity)

Implementation of the transport interfaces.

Defined at line 18 of file ../../src/firmware/lib/fastboot/test/test-transport.cc

zx::result<> Send (std::string_view packet)

Send a packet over the transport.

Defined at line 35 of file ../../src/firmware/lib/fastboot/test/test-transport.cc

template <typename T>
void AddInPacket (const T & container)

Add a packet from a container object to the input stream.

Defined at line 37 of file ../../src/firmware/lib/fastboot/include/lib/fastboot/test/test-transport.h

const Packets & GetOutPackets ()

Get the packets written to the output.

Defined at line 42 of file ../../src/firmware/lib/fastboot/include/lib/fastboot/test/test-transport.h

void ClearOutPackets ()

Defined at line 43 of file ../../src/firmware/lib/fastboot/include/lib/fastboot/test/test-transport.h

Packets TakeOutPackets ()

Defined at line 44 of file ../../src/firmware/lib/fastboot/include/lib/fastboot/test/test-transport.h

size_t PeekPacketSize ()

Defined at line 48 of file ../../src/firmware/lib/fastboot/include/lib/fastboot/test/test-transport.h