#include "net/dns/mock_mdns_socket_factory.h"
#include <algorithm>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/task/single_thread_task_runner.h"
#include "net/base/net_errors.h"
#include "net/dns/public/util.h"
_;
Invoke;
namespace net {
MockMDnsDatagramServerSocket::MockMDnsDatagramServerSocket(
AddressFamily address_family) { … }
MockMDnsDatagramServerSocket::~MockMDnsDatagramServerSocket() = default;
int MockMDnsDatagramServerSocket::SendTo(IOBuffer* buf,
int buf_len,
const IPEndPoint& address,
CompletionOnceCallback callback) { … }
int MockMDnsDatagramServerSocket::GetLocalAddress(IPEndPoint* address) const { … }
void MockMDnsDatagramServerSocket::SetResponsePacket(
const std::string& response_packet) { … }
int MockMDnsDatagramServerSocket::HandleRecvNow(
IOBuffer* buffer,
int size,
IPEndPoint* address,
CompletionOnceCallback callback) { … }
int MockMDnsDatagramServerSocket::HandleRecvLater(
IOBuffer* buffer,
int size,
IPEndPoint* address,
CompletionOnceCallback callback) { … }
MockMDnsSocketFactory::MockMDnsSocketFactory() = default;
MockMDnsSocketFactory::~MockMDnsSocketFactory() = default;
void MockMDnsSocketFactory::CreateSockets(
std::vector<std::unique_ptr<DatagramServerSocket>>* sockets) { … }
void MockMDnsSocketFactory::CreateSocket(
AddressFamily address_family,
std::vector<std::unique_ptr<DatagramServerSocket>>* sockets) { … }
void MockMDnsSocketFactory::SimulateReceive(const uint8_t* packet, int size) { … }
int MockMDnsSocketFactory::RecvFromInternal(IOBuffer* buffer,
int size,
IPEndPoint* address,
CompletionOnceCallback callback) { … }
int MockMDnsSocketFactory::SendToInternal(const std::string& packet,
const std::string& address,
CompletionOnceCallback callback) { … }
}