#include "net/quic/quic_session_pool_test_base.h"
#include <sys/types.h>
#include <memory>
#include <ostream>
#include <set>
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/test_mock_time_task_runner.h"
#include "base/time/time.h"
#include "net/base/features.h"
#include "net/base/host_port_pair.h"
#include "net/base/http_user_agent_settings.h"
#include "net/base/load_flags.h"
#include "net/base/mock_network_change_notifier.h"
#include "net/base/net_error_details.h"
#include "net/base/net_errors.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/proxy_chain.h"
#include "net/base/proxy_server.h"
#include "net/base/schemeful_site.h"
#include "net/base/session_usage.h"
#include "net/base/test_proxy_delegate.h"
#include "net/cert/mock_cert_verifier.h"
#include "net/dns/mock_host_resolver.h"
#include "net/dns/public/dns_query_type.h"
#include "net/dns/public/host_resolver_source.h"
#include "net/dns/public/secure_dns_policy.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
#include "net/http/http_server_properties.h"
#include "net/http/http_util.h"
#include "net/http/transport_security_state.h"
#include "net/http/transport_security_state_test_util.h"
#include "net/quic/address_utils.h"
#include "net/quic/crypto/proof_verifier_chromium.h"
#include "net/quic/mock_crypto_client_stream_factory.h"
#include "net/quic/mock_quic_context.h"
#include "net/quic/mock_quic_data.h"
#include "net/quic/properties_based_quic_server_info.h"
#include "net/quic/quic_chromium_alarm_factory.h"
#include "net/quic/quic_chromium_client_session.h"
#include "net/quic/quic_chromium_client_session_peer.h"
#include "net/quic/quic_context.h"
#include "net/quic/quic_http_stream.h"
#include "net/quic/quic_http_utils.h"
#include "net/quic/quic_server_info.h"
#include "net/quic/quic_session_key.h"
#include "net/quic/quic_session_pool_peer.h"
#include "net/quic/quic_test_packet_maker.h"
#include "net/quic/quic_test_packet_printer.h"
#include "net/quic/test_task_runner.h"
#include "net/socket/next_proto.h"
#include "net/socket/socket_tag.h"
#include "net/socket/socket_test_util.h"
#include "net/spdy/spdy_session_test_util.h"
#include "net/spdy/spdy_test_util_common.h"
#include "net/ssl/test_ssl_config_service.h"
#include "net/test/cert_test_util.h"
#include "net/test/gtest_util.h"
#include "net/test/test_data_directory.h"
#include "net/test/test_with_task_environment.h"
#include "net/third_party/quiche/src/quiche/common/http/http_header_block.h"
#include "net/third_party/quiche/src/quiche/common/quiche_data_writer.h"
#include "net/third_party/quiche/src/quiche/http2/test_tools/spdy_test_utils.h"
#include "net/third_party/quiche/src/quiche/quic/core/crypto/crypto_handshake.h"
#include "net/third_party/quiche/src/quiche/quic/core/crypto/quic_crypto_client_config.h"
#include "net/third_party/quiche/src/quiche/quic/core/crypto/quic_decrypter.h"
#include "net/third_party/quiche/src/quiche/quic/core/crypto/quic_encrypter.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_constants.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_utils.h"
#include "net/third_party/quiche/src/quiche/quic/platform/api/quic_test.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/mock_clock.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/mock_random.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_config_peer.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_connection_peer.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_path_validator_peer.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_session_peer.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_spdy_session_peer.h"
#include "net/third_party/quiche/src/quiche/quic/test_tools/quic_test_utils.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/static_http_user_agent_settings.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/scheme_host_port.h"
#include "url/url_constants.h"
string;
namespace net::test {
QuicSessionPoolTestBase::RequestBuilder::RequestBuilder(
QuicSessionPoolTestBase* test,
QuicSessionPool* pool)
: … { … }
QuicSessionPoolTestBase::RequestBuilder::RequestBuilder(
QuicSessionPoolTestBase* test)
: … { … }
QuicSessionPoolTestBase::RequestBuilder::~RequestBuilder() = default;
int QuicSessionPoolTestBase::RequestBuilder::CallRequest() { … }
QuicSessionPoolTestBase::QuicSessionPoolTestBase(
quic::ParsedQuicVersion version,
std::vector<base::test::FeatureRef> enabled_features,
std::vector<base::test::FeatureRef> disabled_features)
: … { … }
QuicSessionPoolTestBase::~QuicSessionPoolTestBase() = default;
void QuicSessionPoolTestBase::Initialize() { … }
void QuicSessionPoolTestBase::MaybeMakeNewConnectionIdAvailableToSession(
const quic::QuicConnectionId& new_cid,
quic::QuicSession* session,
uint64_t sequence_number) { … }
std::unique_ptr<HttpStream> QuicSessionPoolTestBase::CreateStream(
QuicSessionRequest* request) { … }
bool QuicSessionPoolTestBase::HasActiveSession(
const url::SchemeHostPort& scheme_host_port,
const NetworkAnonymizationKey& network_anonymization_key,
const ProxyChain& proxy_chain,
SessionUsage session_usage,
bool require_dns_https_alpn) { … }
bool QuicSessionPoolTestBase::HasActiveJob(
const url::SchemeHostPort& scheme_host_port,
const PrivacyMode privacy_mode,
bool require_dns_https_alpn) { … }
QuicChromiumClientSession* QuicSessionPoolTestBase::GetPendingSession(
const url::SchemeHostPort& scheme_host_port) { … }
QuicChromiumClientSession* QuicSessionPoolTestBase::GetActiveSession(
const url::SchemeHostPort& scheme_host_port,
const NetworkAnonymizationKey& network_anonymization_key,
const ProxyChain& proxy_chain,
SessionUsage session_usage,
bool require_dns_https_alpn) { … }
int QuicSessionPoolTestBase::GetSourcePortForNewSessionAndGoAway(
const url::SchemeHostPort& destination) { … }
int QuicSessionPoolTestBase::GetSourcePortForNewSessionInner(
const url::SchemeHostPort& destination,
bool goaway_received) { … }
ProofVerifyDetailsChromium
QuicSessionPoolTestBase::DefaultProofVerifyDetails() { … }
void QuicSessionPoolTestBase::NotifyIPAddressChanged() { … }
std::unique_ptr<quic::QuicEncryptedPacket>
QuicSessionPoolTestBase::ConstructServerConnectionClosePacket(uint64_t num) { … }
std::unique_ptr<quic::QuicEncryptedPacket>
QuicSessionPoolTestBase::ConstructClientRstPacket(
uint64_t packet_number,
quic::QuicRstStreamErrorCode error_code) { … }
std::unique_ptr<quic::QuicEncryptedPacket>
QuicSessionPoolTestBase::ConstructGetRequestPacket(uint64_t packet_number,
quic::QuicStreamId stream_id,
bool fin) { … }
std::unique_ptr<quic::QuicEncryptedPacket>
QuicSessionPoolTestBase::ConstructConnectUdpRequestPacket(
uint64_t packet_number,
quic::QuicStreamId stream_id,
std::string authority,
std::string path,
bool fin) { … }
std::unique_ptr<quic::QuicEncryptedPacket>
QuicSessionPoolTestBase::ConstructConnectUdpRequestPacket(
QuicTestPacketMaker& packet_maker,
uint64_t packet_number,
quic::QuicStreamId stream_id,
std::string authority,
std::string path,
bool fin) { … }
std::string QuicSessionPoolTestBase::ConstructClientH3DatagramFrame(
uint64_t quarter_stream_id,
uint64_t context_id,
std::unique_ptr<quic::QuicEncryptedPacket> inner) { … }
std::unique_ptr<quic::QuicEncryptedPacket>
QuicSessionPoolTestBase::ConstructClientH3DatagramPacket(
uint64_t packet_number,
uint64_t quarter_stream_id,
uint64_t context_id,
std::unique_ptr<quic::QuicEncryptedPacket> inner) { … }
std::unique_ptr<quic::QuicEncryptedPacket>
QuicSessionPoolTestBase::ConstructOkResponsePacket(uint64_t packet_number,
quic::QuicStreamId stream_id,
bool fin) { … }
std::unique_ptr<quic::QuicEncryptedPacket>
QuicSessionPoolTestBase::ConstructOkResponsePacket(
QuicTestPacketMaker& packet_maker,
uint64_t packet_number,
quic::QuicStreamId stream_id,
bool fin) { … }
std::unique_ptr<quic::QuicReceivedPacket>
QuicSessionPoolTestBase::ConstructInitialSettingsPacket() { … }
std::unique_ptr<quic::QuicReceivedPacket>
QuicSessionPoolTestBase::ConstructInitialSettingsPacket(
uint64_t packet_number) { … }
std::unique_ptr<quic::QuicReceivedPacket>
QuicSessionPoolTestBase::ConstructInitialSettingsPacket(
QuicTestPacketMaker& packet_maker,
uint64_t packet_number) { … }
std::unique_ptr<quic::QuicEncryptedPacket>
QuicSessionPoolTestBase::ConstructServerSettingsPacket(uint64_t packet_number) { … }
std::unique_ptr<quic::QuicEncryptedPacket>
QuicSessionPoolTestBase::ConstructAckPacket(
test::QuicTestPacketMaker& packet_maker,
uint64_t packet_number,
uint64_t packet_num_received,
uint64_t smallest_received,
uint64_t largest_received) { … }
std::string QuicSessionPoolTestBase::ConstructDataHeader(size_t body_len) { … }
std::unique_ptr<quic::QuicEncryptedPacket>
QuicSessionPoolTestBase::ConstructServerDataPacket(uint64_t packet_number,
quic::QuicStreamId stream_id,
bool fin,
std::string_view data) { … }
std::string QuicSessionPoolTestBase::ConstructH3Datagram(
uint64_t stream_id,
uint64_t context_id,
std::unique_ptr<quic::QuicEncryptedPacket> packet) { … }
quic::QuicStreamId
QuicSessionPoolTestBase::GetNthClientInitiatedBidirectionalStreamId(
int n) const { … }
quic::QuicStreamId QuicSessionPoolTestBase::GetQpackDecoderStreamId() const { … }
std::string QuicSessionPoolTestBase::StreamCancellationQpackDecoderInstruction(
int n) const { … }
std::string QuicSessionPoolTestBase::StreamCancellationQpackDecoderInstruction(
int n,
bool create_stream) const { … }
quic::QuicStreamId
QuicSessionPoolTestBase::GetNthServerInitiatedUnidirectionalStreamId(int n) { … }
void QuicSessionPoolTestBase::OnFailedOnDefaultNetwork(int rv) { … }
}