class MockTcp
Defined at line 33 of file ../../src/firmware/gigaboot/src/tcp_test.h
Wraps EFI TCP protocols in mocks for testing.
Configures mocks such that tcp6_*() functions will succeed by default.
Tests can use EXPECT_CALL() to override default behavior if needed.
Additionally tracks event create/close calls to make sure every created
event is also closed.
To use, pass the MockTcp's boot_services protocol table to tcp6_open():
MockTcp mock_tcp;
tcp6_socket socket;
tcp6_open(
&socket
, mock_tcp.boot_services().services(), NULL,
&addr
, port);
Public Members
static const efi_handle kTcpBindingHandle
static const efi_handle kTcpServerHandle
static const efi_handle kTcpClientHandle
Public Methods
void MockTcp ()
Defined at line 38 of file ../../src/firmware/gigaboot/src/tcp_test.cc
efi::MockBootServices & boot_services ()
Accessors for underlying mock objects.
Defined at line 45 of file ../../src/firmware/gigaboot/src/tcp_test.h
efi::MockServiceBindingProtocol & binding_protocol ()
Defined at line 46 of file ../../src/firmware/gigaboot/src/tcp_test.h
efi::MockTcp6Protocol & server_protocol ()
Defined at line 47 of file ../../src/firmware/gigaboot/src/tcp_test.h
efi::MockTcp6Protocol & client_protocol ()
Defined at line 48 of file ../../src/firmware/gigaboot/src/tcp_test.h
void ~MockTcp ()
Defined at line 98 of file ../../src/firmware/gigaboot/src/tcp_test.cc
void ExpectServerClose ()
Adds expectations that the socket server and binding protocols are closed.
This isn't necessary for proper functionality, it only adds checks that all
the members are closed out if a test wants to specifically look for that.
Defined at line 104 of file ../../src/firmware/gigaboot/src/tcp_test.cc
void ExpectDisconnect ()
Adds expectations that the socket client is disconnected.
This isn't necessary for proper functionality, it only adds checks that all
the members are closed out if a test wants to specifically look for that.
Defined at line 124 of file ../../src/firmware/gigaboot/src/tcp_test.cc
efi_status AllocateHandleBuffer (size_t *num_handles,efi_handle **buf,std::vector<efi_handle>handles)
Allocates a handle buffer and sets it to the given contents.
Useful for mocking LocateHandleBuffer().
Defined at line 137 of file ../../src/firmware/gigaboot/src/tcp_test.cc