#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/mirroring/service/fake_network_service.h"
#include <memory>
#include "base/ranges/algorithm.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "net/base/ip_address.h"
#include "net/base/net_errors.h"
#include "net/log/net_log_source.h"
#include "net/socket/udp_server_socket.h"
#include "services/network/public/mojom/clear_data_filter.mojom.h"
#include "services/network/test/test_url_loader_factory.h"
namespace mirroring {
net::IPEndPoint GetFreeLocalPort() { … }
MockUdpSocket::MockUdpSocket(
mojo::PendingReceiver<network::mojom::UDPSocket> receiver,
mojo::PendingRemote<network::mojom::UDPSocketListener> listener)
: … { … }
MockUdpSocket::~MockUdpSocket() { … }
void MockUdpSocket::Bind(const net::IPEndPoint& local_addr,
network::mojom::UDPSocketOptionsPtr options,
BindCallback callback) { … }
void MockUdpSocket::Connect(const net::IPEndPoint& remote_addr,
network::mojom::UDPSocketOptionsPtr options,
ConnectCallback callback) { … }
void MockUdpSocket::ReceiveMore(uint32_t num_additional_datagrams) { … }
void MockUdpSocket::SendTo(
const net::IPEndPoint& dest_addr,
base::span<const uint8_t> data,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
SendToCallback callback) { … }
void MockUdpSocket::Send(
base::span<const uint8_t> data,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
SendCallback callback) { … }
void MockUdpSocket::OnReceivedPacket(const media::cast::Packet& packet) { … }
void MockUdpSocket::VerifySendingPacket(const media::cast::Packet& packet) { … }
MockNetworkContext::MockNetworkContext(
mojo::PendingReceiver<network::mojom::NetworkContext> receiver)
: … { … }
MockNetworkContext::~MockNetworkContext() { … }
void MockNetworkContext::CreateUDPSocket(
mojo::PendingReceiver<network::mojom::UDPSocket> receiver,
mojo::PendingRemote<network::mojom::UDPSocketListener> listener) { … }
void MockNetworkContext::CreateURLLoaderFactory(
mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver,
network::mojom::URLLoaderFactoryParamsPtr params) { … }
}