#include "services/network/test/udp_socket_test_util.h"
#include <utility>
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/test_future.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
NetErrorFuture;
NetErrorWithOptionalIPEndPointFuture;
}
namespace network::test {
UDPSocketTestHelper::UDPSocketTestHelper(mojo::Remote<mojom::UDPSocket>* socket)
: … { … }
UDPSocketTestHelper::~UDPSocketTestHelper() = default;
int UDPSocketTestHelper::ConnectSync(const net::IPEndPoint& remote_addr,
mojom::UDPSocketOptionsPtr options,
net::IPEndPoint* local_addr_out) { … }
int UDPSocketTestHelper::BindSync(const net::IPEndPoint& local_addr,
mojom::UDPSocketOptionsPtr options,
net::IPEndPoint* local_addr_out) { … }
int UDPSocketTestHelper::SendToSync(const net::IPEndPoint& remote_addr,
base::span<const uint8_t> data) { … }
int UDPSocketTestHelper::SendSync(base::span<const uint8_t> data) { … }
int UDPSocketTestHelper::SetBroadcastSync(bool broadcast) { … }
int UDPSocketTestHelper::SetSendBufferSizeSync(int send_buffer_size) { … }
int UDPSocketTestHelper::SetReceiveBufferSizeSync(int receive_buffer_size) { … }
int UDPSocketTestHelper::JoinGroupSync(const net::IPAddress& group_address) { … }
int UDPSocketTestHelper::LeaveGroupSync(const net::IPAddress& group_address) { … }
UDPSocketListenerImpl::ReceivedResult::ReceivedResult(
int net_error_arg,
const std::optional<net::IPEndPoint>& src_addr_arg,
std::optional<std::vector<uint8_t>> data_arg)
: … { … }
UDPSocketListenerImpl::ReceivedResult::ReceivedResult(
const ReceivedResult& other) = default;
UDPSocketListenerImpl::ReceivedResult::~ReceivedResult() { … }
UDPSocketListenerImpl::UDPSocketListenerImpl()
: … { … }
UDPSocketListenerImpl::~UDPSocketListenerImpl() { … }
void UDPSocketListenerImpl::WaitForReceivedResults(size_t count) { … }
void UDPSocketListenerImpl::OnReceived(
int32_t result,
const std::optional<net::IPEndPoint>& src_addr,
std::optional<base::span<const uint8_t>> data) { … }
}