#include "net/http/http_stream_pool_attempt_manager.h"
#include <list>
#include <memory>
#include <set>
#include <string>
#include <string_view>
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/notreached.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "net/base/completion_once_callback.h"
#include "net/base/features.h"
#include "net/base/host_port_pair.h"
#include "net/base/load_states.h"
#include "net/base/load_timing_info.h"
#include "net/base/net_error_details.h"
#include "net/base/net_errors.h"
#include "net/base/privacy_mode.h"
#include "net/base/request_priority.h"
#include "net/dns/host_resolver.h"
#include "net/dns/public/resolve_error_info.h"
#include "net/http/alternative_service.h"
#include "net/http/http_network_session.h"
#include "net/http/http_request_info.h"
#include "net/http/http_server_properties.h"
#include "net/http/http_stream_factory_test_util.h"
#include "net/http/http_stream_pool.h"
#include "net/http/http_stream_pool_group.h"
#include "net/http/http_stream_pool_handle.h"
#include "net/http/http_stream_pool_test_util.h"
#include "net/log/test_net_log.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/quic_test_packet_maker.h"
#include "net/socket/next_proto.h"
#include "net/socket/socket_test_util.h"
#include "net/socket/stream_socket_handle.h"
#include "net/socket/tcp_stream_attempt.h"
#include "net/spdy/spdy_http_stream.h"
#include "net/spdy/spdy_test_util_common.h"
#include "net/ssl/ssl_cert_request_info.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/quic/core/quic_error_codes.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_versions.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "url/scheme_host_port.h"
_;
Optional;
namespace net {
IsError;
IsOk;
MockQuicData;
QuicTestPacketMaker;
Group;
AttemptManager;
namespace {
IPEndPoint MakeIPEndPoint(std::string_view addr, uint16_t port = 80) { … }
void ValidateConnectTiming(LoadTimingInfo::ConnectTiming& connect_timing) { … }
class StreamKeyBuilder { … };
class Preconnector { … };
class StreamRequester : public HttpStreamRequest::Delegate { … };
constexpr std::string_view kDefaultServerName = …;
constexpr std::string_view kDefaultDestination = …;
}
class HttpStreamPoolAttemptManagerTest : public TestWithTaskEnvironment { … };
TEST_F(HttpStreamPoolAttemptManagerTest, ResolveEndpointFailedSync) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
ResolveEndpointFailedMultipleRequests) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, LoadState) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, ResolveErrorInfo) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, DnsAliases) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, ConnectTiming) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
ConnectTimingDnsResolutionNotFinished) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, SetPriority) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, TcpFailSync) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, TcpFailAsync) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, TlsOk) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, TlsCryptoReadyDelayed) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, CertificateError) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, NeedsClientAuth) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, TcpFailAfterNeedsClientAuth) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, RequestCancelledBeforeAttemptSuccess) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, OneIPEndPointFailed) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, IPEndPointTimedout) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, IPEndPointsSlow) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
PauseSlowTimerAfterTcpHandshakeForTls) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, ReachedGroupLimit) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, ReachedPoolLimit) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
ReachedPoolLimitHighPriorityGroupFirst) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, RequestStreamIdleStreamSocket) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, UseIdleStreamSocketAfterRelease) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
CloseIdleStreamAttemptConnectionReachedPoolLimit) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
ProcessPendingRequestDnsResolutionOngoing) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
CancelAttemptAndRequestsOnIPAddressChange) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, IPAddressChangeAfterNeedsClientAuth) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, SSLConfigChangedCloseIdleStream) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
SSLConfigChangedReleasedStreamGenerationOutdated) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, SSLConfigForServersChanged) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, SpdyAvailableSession) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, ChangePriorityForPooledStreamRequest) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, SpdyOk) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, SpdyCreateSessionFail) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, RequireHttp11AfterSpdySessionCreated) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
RequireHttp11AfterSpdySessionCreatedRequestDestroyed) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, DoNotUseSpdySessionForHttpRequest) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, CloseIdleSpdySessionWhenPoolStalled) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
PreconnectRequireHttp11AfterSpdySessionCreated) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, SpdyReachedPoolLimit) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, SpdyMatchingIpSessionOk) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, SpdyPreconnectMatchingIpSession) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
SpdyMatchingIpSessionAlreadyHaveSession) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
SpdyMatchingIpSessionDnsResolutionFinishSynchronously) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, SpdyMatchingIpSessionDisabled) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, SpdyMatchingIpSessionKeyMismatch) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
SpdyMatchingIpSessionVerifyDomainFailed) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
ThrottleAttemptForSpdyBlockSecondAttempt) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
ThrottleAttemptForSpdyDelayPassedHttp2) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
ThrottleAttemptForSpdyDelayPassedHttp1) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, PreconnectSpdySessionAvailable) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, PreconnectActiveStreamsAvailable) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, PreconnectFail) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, PreconnectMultipleStreamsHttp1) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, PreconnectMultipleStreamsHttp2) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, PreconnectRequireHttp1) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, PreconnectMultipleStreamsOkAndFail) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, PreconnectMultipleStreamsFailAndOk) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, PreconnectMultipleRequests) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, PreconnectReachedGroupLimit) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, PreconnectReachedPoolLimit) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
RequestStreamAndPreconnectWhileFailing) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, PreconnectPriority) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, FailingIsNotStalled) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, HavingSpdySessionIsNotStalled) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, HavingQuicSessionIsNotStalled) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, ReuseTypeUnused) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, ReuseTypeUnusedIdle) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, ReuseTypeReusedIdle) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, QuicOk) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, QuicOkDnsAlpn) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, QuicCanUseExistingSession) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, AlternativeSerivcesDisabled) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, QuicEndpointNotFoundNoDnsAlpn) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, QuicPreconnect) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, QuicMatchingIpSession) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
QuicMatchingIpSessionOnEndpointsUpdated) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, QuicPreconnectMatchingIpSession) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, QuicMatchingIpSessionDisabled) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, DelayStreamAttemptQuicOk) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, DelayStreamAttemptQuicFail) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, DelayStreamAttemptDelayPassed) { … }
TEST_F(HttpStreamPoolAttemptManagerTest,
DelayStreamAttemptDisableAlternativeServicesLater) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, OriginsToForceQuicOnOk) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, OriginsToForceQuicOnFail) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, OriginsToForceQuicOnPreconnectOk) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, OriginsToForceQuicOnPreconnectFail) { … }
TEST_F(HttpStreamPoolAttemptManagerTest, GetInfoAsValue) { … }
}