#include "net/socket/transport_client_socket_pool_test_util.h"
#include <stdint.h>
#include <string>
#include <utility>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/weak_ptr.h"
#include "base/notreached.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/load_timing_info.h"
#include "net/base/load_timing_info_test_util.h"
#include "net/log/net_log_source.h"
#include "net/log/net_log_source_type.h"
#include "net/log/net_log_with_source.h"
#include "net/socket/client_socket_handle.h"
#include "net/socket/datagram_client_socket.h"
#include "net/socket/ssl_client_socket.h"
#include "net/socket/transport_client_socket.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
namespace {
IPAddress ParseIP(const std::string& ip) { … }
class MockConnectClientSocket : public TransportClientSocket { … };
class MockFailingClientSocket : public TransportClientSocket { … };
class MockTriggerableClientSocket : public TransportClientSocket { … };
}
void TestLoadTimingInfoConnectedReused(const ClientSocketHandle& handle) { … }
void TestLoadTimingInfoConnectedNotReused(const ClientSocketHandle& handle) { … }
void SetIPv4Address(IPEndPoint* address) { … }
void SetIPv6Address(IPEndPoint* address) { … }
MockTransportClientSocketFactory::Rule::Rule(
Type type,
std::optional<std::vector<IPEndPoint>> expected_addresses,
Error connect_error)
: … { … }
MockTransportClientSocketFactory::Rule::~Rule() = default;
MockTransportClientSocketFactory::Rule::Rule(const Rule&) = default;
MockTransportClientSocketFactory::Rule&
MockTransportClientSocketFactory::Rule::operator=(const Rule&) = default;
MockTransportClientSocketFactory::MockTransportClientSocketFactory(
NetLog* net_log)
: … { … }
MockTransportClientSocketFactory::~MockTransportClientSocketFactory() = default;
std::unique_ptr<DatagramClientSocket>
MockTransportClientSocketFactory::CreateDatagramClientSocket(
DatagramSocket::BindType bind_type,
NetLog* net_log,
const NetLogSource& source) { … }
std::unique_ptr<TransportClientSocket>
MockTransportClientSocketFactory::CreateTransportClientSocket(
const AddressList& addresses,
std::unique_ptr<SocketPerformanceWatcher> ,
NetworkQualityEstimator* ,
NetLog* ,
const NetLogSource& ) { … }
std::unique_ptr<SSLClientSocket>
MockTransportClientSocketFactory::CreateSSLClientSocket(
SSLClientContext* context,
std::unique_ptr<StreamSocket> stream_socket,
const HostPortPair& host_and_port,
const SSLConfig& ssl_config) { … }
void MockTransportClientSocketFactory::SetRules(base::span<const Rule> rules) { … }
base::OnceClosure
MockTransportClientSocketFactory::WaitForTriggerableSocketCreation() { … }
}