chromium/net/http/http_network_transaction_unittest.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "net/http/http_network_transaction.h"

#include <math.h>  // ceil
#include <stdarg.h>
#include <stdint.h>

#include <algorithm>
#include <limits>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

#include "base/compiler_specific.h"
#include "base/containers/span.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_clock.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/task_environment.h"
#include "base/test/test_file_util.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "net/base/auth.h"
#include "net/base/chunked_upload_data_stream.h"
#include "net/base/completion_once_callback.h"
#include "net/base/elements_upload_data_stream.h"
#include "net/base/features.h"
#include "net/base/host_port_pair.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/base/net_errors.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/network_isolation_key.h"
#include "net/base/privacy_mode.h"
#include "net/base/proxy_chain.h"
#include "net/base/proxy_delegate.h"
#include "net/base/proxy_server.h"
#include "net/base/proxy_string_util.h"
#include "net/base/request_priority.h"
#include "net/base/schemeful_site.h"
#include "net/base/session_usage.h"
#include "net/base/test_completion_callback.h"
#include "net/base/test_proxy_delegate.h"
#include "net/base/upload_bytes_element_reader.h"
#include "net/base/upload_file_element_reader.h"
#include "net/cert/cert_status_flags.h"
#include "net/cert/mock_cert_verifier.h"
#include "net/dns/mock_host_resolver.h"
#include "net/dns/public/secure_dns_policy.h"
#include "net/http/http_auth_challenge_tokenizer.h"
#include "net/http/http_auth_handler_digest.h"
#include "net/http/http_auth_handler_mock.h"
#include "net/http/http_auth_handler_ntlm.h"
#include "net/http/http_auth_ntlm_mechanism.h"
#include "net/http/http_auth_scheme.h"
#include "net/http/http_basic_stream.h"
#include "net/http/http_network_session.h"
#include "net/http/http_network_session_peer.h"
#include "net/http/http_proxy_connect_job.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_info.h"
#include "net/http/http_server_properties.h"
#include "net/http/http_stream.h"
#include "net/http/http_stream_factory.h"
#include "net/http/http_stream_pool.h"
#include "net/http/http_stream_pool_group.h"
#include "net/http/http_stream_pool_test_util.h"
#include "net/http/http_transaction_test_util.h"
#include "net/log/net_log.h"
#include "net/log/net_log_event_type.h"
#include "net/log/net_log_source.h"
#include "net/log/test_net_log.h"
#include "net/log/test_net_log_util.h"
#include "net/proxy_resolution/configured_proxy_resolution_service.h"
#include "net/proxy_resolution/mock_proxy_resolver.h"
#include "net/proxy_resolution/proxy_config_service_fixed.h"
#include "net/proxy_resolution/proxy_info.h"
#include "net/proxy_resolution/proxy_resolver.h"
#include "net/proxy_resolution/proxy_resolver_factory.h"
#include "net/reporting/reporting_target_type.h"
#include "net/socket/client_socket_factory.h"
#include "net/socket/client_socket_pool.h"
#include "net/socket/client_socket_pool_manager.h"
#include "net/socket/connect_job.h"
#include "net/socket/connection_attempts.h"
#include "net/socket/mock_client_socket_pool_manager.h"
#include "net/socket/next_proto.h"
#include "net/socket/socket_tag.h"
#include "net/socket/socket_test_util.h"
#include "net/socket/socks_connect_job.h"
#include "net/socket/ssl_client_socket.h"
#include "net/spdy/spdy_session.h"
#include "net/spdy/spdy_session_pool.h"
#include "net/spdy/spdy_test_util_common.h"
#include "net/ssl/client_cert_identity_test_util.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_config.h"
#include "net/ssl/ssl_config_service.h"
#include "net/ssl/ssl_info.h"
#include "net/ssl/ssl_private_key.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/spdy/core/spdy_framer.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/static_http_user_agent_settings.h"
#include "net/websockets/websocket_handshake_stream_base.h"
#include "net/websockets/websocket_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#include "url/gurl.h"
#include "url/scheme_host_port.h"
#include "url/url_constants.h"

#if defined(NTLM_PORTABLE)
#include "base/base64.h"
#include "net/ntlm/ntlm_test_data.h"
#endif

#if BUILDFLAG(ENABLE_REPORTING)
#include "net/network_error_logging/network_error_logging_service.h"
#include "net/network_error_logging/network_error_logging_test_util.h"
#include "net/reporting/reporting_cache.h"
#include "net/reporting/reporting_endpoint.h"
#include "net/reporting/reporting_header_parser.h"
#include "net/reporting/reporting_service.h"
#include "net/reporting/reporting_test_util.h"
#endif  // BUILDFLAG(ENABLE_REPORTING)

IsError;
IsOk;

ASCIIToUTF16;

AnyOf;
ElementsAre;
IsEmpty;

//-----------------------------------------------------------------------------

namespace net {

namespace {

const std::u16string kBar(u"bar");
const std::u16string kBar2(u"bar2");
const std::u16string kBar3(u"bar3");
const std::u16string kBaz(u"baz");
const std::u16string kFirst(u"first");
const std::u16string kFoo(u"foo");
const std::u16string kFoo2(u"foo2");
const std::u16string kFoo3(u"foo3");
const std::u16string kFou(u"fou");
const std::u16string kSecond(u"second");
const std::u16string kWrongPassword(u"wrongpassword");

const char kAlternativeServiceHttpHeader[] =;

int GetIdleSocketCountInTransportSocketPool(HttpNetworkSession* session) {}

bool IsTransportSocketPoolStalled(HttpNetworkSession* session) {}

// Takes in a Value created from a NetLogHttpResponseParameter, and returns
// a JSONified list of headers as a single string.  Uses single quotes instead
// of double quotes for easier comparison.
std::string GetHeaders(const base::Value::Dict& params) {}

// Tests LoadTimingInfo in the case a socket is reused and no PAC script is
// used.
void TestLoadTimingReused(const LoadTimingInfo& load_timing_info) {}

// Tests LoadTimingInfo in the case a new socket is used and no PAC script is
// used.
void TestLoadTimingNotReused(const LoadTimingInfo& load_timing_info,
                             int connect_timing_flags) {}

// Tests LoadTimingInfo in the case a socket is reused and a PAC script is
// used.
void TestLoadTimingReusedWithPac(const LoadTimingInfo& load_timing_info) {}

// Tests LoadTimingInfo in the case a new socket is used and a PAC script is
// used.
void TestLoadTimingNotReusedWithPac(const LoadTimingInfo& load_timing_info,
                                    int connect_timing_flags) {}

// ProxyResolver that records URLs passed to it, and that can be told what
// result to return.
class CapturingProxyResolver : public ProxyResolver {};

class CapturingProxyResolverFactory : public ProxyResolverFactory {};

std::unique_ptr<HttpNetworkSession> CreateSession(
    SpdySessionDependencies* session_deps) {}

class FailingProxyResolverFactory : public ProxyResolverFactory {};

// A default minimal HttpRequestInfo for use in tests, targeting HTTP.
HttpRequestInfo DefaultRequestInfo() {}

// The default info for transports to the embedded HTTP server.
TransportInfo EmbeddedHttpServerTransportInfo() {}

}  // namespace

class HttpNetworkTransactionTestBase : public PlatformTest,
                                       public WithTaskEnvironment {};

class HttpNetworkTransactionTest : public HttpNetworkTransactionTestBase,
                                   public ::testing::WithParamInterface<bool> {};

INSTANTIATE_TEST_SUITE_P();

namespace {

// Fill |str| with a long header list that consumes >= |size| bytes.
void FillLargeHeadersString(std::string* str, int size) {}

#if defined(NTLM_PORTABLE)
uint64_t MockGetMSTime() {}

// Alternative functions that eliminate randomness and dependency on the local
// host name so that the generated NTLM messages are reproducible.
void MockGenerateRandom(base::span<uint8_t> output) {}

std::string MockGetHostName() {}
#endif  // defined(NTLM_PORTABLE)

class CaptureGroupIdTransportSocketPool : public TransportClientSocketPool {};

class CaptureKeyHttpStreamPoolObserver : public HttpStreamPool::Observer {};

//-----------------------------------------------------------------------------

// Helper functions for validating that AuthChallengeInfo's are correctly
// configured for common cases.
bool CheckBasicServerAuth(
    const std::optional<AuthChallengeInfo>& auth_challenge) {}

bool CheckBasicSecureServerAuth(
    const std::optional<AuthChallengeInfo>& auth_challenge) {}

bool CheckBasicProxyAuth(
    const std::optional<AuthChallengeInfo>& auth_challenge) {}

bool CheckBasicSecureProxyAuth(
    const std::optional<AuthChallengeInfo>& auth_challenge) {}

bool CheckDigestServerAuth(
    const std::optional<AuthChallengeInfo>& auth_challenge) {}

#if defined(NTLM_PORTABLE)
bool CheckNTLMServerAuth(
    const std::optional<AuthChallengeInfo>& auth_challenge) {}

bool CheckNTLMProxyAuth(
    const std::optional<AuthChallengeInfo>& auth_challenge) {}
#endif  // defined(NTLM_PORTABLE)

}  // namespace

TEST_P(HttpNetworkTransactionTest, Basic) {}

TEST_P(HttpNetworkTransactionTest, SimpleGET) {}

// Response with no status line.
TEST_P(HttpNetworkTransactionTest, SimpleGETNoHeaders) {}

// Response with no status line, and a weird port.  Should fail by default.
TEST_P(HttpNetworkTransactionTest, SimpleGETNoHeadersWeirdPort) {}

// Tests that request info can be destroyed after the headers phase is complete.
TEST_P(HttpNetworkTransactionTest, SimpleGETNoReadDestroyRequestInfo) {}

// Test that a failure in resolving the hostname is retrievable.
TEST_P(HttpNetworkTransactionTest, SimpleGETHostResolutionFailure) {}

// This test verifies that if the transaction fails before even connecting to a
// remote endpoint, the ConnectedCallback is never called.
TEST_P(HttpNetworkTransactionTest, ConnectedCallbackNeverCalled) {}

// This test verifies that if the ConnectedCallback returns an error, the
// entire transaction fails with that error.
TEST_P(HttpNetworkTransactionTest, ConnectedCallbackFailure) {}

// This test verifies that if the ConnectedCallback returns an error, the
// underlying socket is not closed and can be reused by the next transaction.
TEST_P(HttpNetworkTransactionTest, ConnectedCallbackFailureAllowsSocketReuse) {}

// This test verifies that the ConnectedCallback is called once in the case of
// simple requests.
TEST_P(HttpNetworkTransactionTest, ConnectedCallbackCalledOnce) {}

// This test verifies that the ConnectedCallback is called once more per
// authentication challenge.
TEST_P(HttpNetworkTransactionTest, ConnectedCallbackCalledOnEachAuthChallenge) {}

// This test verifies that the ConnectedCallback is called once more per retry.
TEST_P(HttpNetworkTransactionTest, ConnectedCallbackCalledOnEachRetry) {}

TEST_P(HttpNetworkTransactionTest, ConnectedCallbackCalledAsync) {}

TEST_P(HttpNetworkTransactionTest, ConnectedCallbackCalledAsyncError) {}

// Allow up to 4 bytes of junk to precede status line.
TEST_P(HttpNetworkTransactionTest, StatusLineJunk3Bytes) {}

// Allow up to 4 bytes of junk to precede status line.
TEST_P(HttpNetworkTransactionTest, StatusLineJunk4Bytes) {}

// Beyond 4 bytes of slop and it should fail to find a status line.
TEST_P(HttpNetworkTransactionTest, StatusLineJunk5Bytes) {}

// Same as StatusLineJunk4Bytes, except the read chunks are smaller.
TEST_P(HttpNetworkTransactionTest, StatusLineJunk4Bytes_Slow) {}

// Close the connection before enough bytes to have a status line.
TEST_P(HttpNetworkTransactionTest, StatusLinePartial) {}

// Simulate a 204 response, lacking a Content-Length header, sent over a
// persistent connection.  The response should still terminate since a 204
// cannot have a response body.
TEST_P(HttpNetworkTransactionTest, StopsReading204) {}

// A simple request using chunked encoding with some extra data after.
TEST_P(HttpNetworkTransactionTest, ChunkedEncoding) {}

// Next tests deal with http://crbug.com/56344.

TEST_P(HttpNetworkTransactionTest,
       MultipleContentLengthHeadersNoTransferEncoding) {}

TEST_P(HttpNetworkTransactionTest,
       DuplicateContentLengthHeadersNoTransferEncoding) {}

TEST_P(HttpNetworkTransactionTest,
       ComplexContentLengthHeadersNoTransferEncoding) {}

TEST_P(HttpNetworkTransactionTest,
       MultipleContentLengthHeadersTransferEncoding) {}

// Next tests deal with http://crbug.com/98895.

// Checks that a single Content-Disposition header results in no error.
TEST_P(HttpNetworkTransactionTest, SingleContentDispositionHeader) {}

// Checks that two identical Content-Disposition headers result in no error.
TEST_P(HttpNetworkTransactionTest, TwoIdenticalContentDispositionHeaders) {}

// Checks that two distinct Content-Disposition headers result in an error.
TEST_P(HttpNetworkTransactionTest, TwoDistinctContentDispositionHeaders) {}

// Checks that two identical Location headers result in no error.
// Also tests Location header behavior.
TEST_P(HttpNetworkTransactionTest, TwoIdenticalLocationHeaders) {}

// Checks that two distinct Location headers result in an error.
TEST_P(HttpNetworkTransactionTest, TwoDistinctLocationHeaders) {}

// Do a request using the HEAD method. Verify that we don't try to read the
// message body (since HEAD has none).
TEST_P(HttpNetworkTransactionTest, Head) {}

TEST_P(HttpNetworkTransactionTest, ReuseConnection) {}

TEST_P(HttpNetworkTransactionTest, Ignores100) {}

// This test is almost the same as Ignores100 above, but the response contains
// a 102 instead of a 100. Also, instead of HTTP/1.0 the response is
// HTTP/1.1 and the two status headers are read in one read.
TEST_P(HttpNetworkTransactionTest, Ignores1xx) {}

TEST_P(HttpNetworkTransactionTest, GetReceivedBodyBytes) {}

TEST_P(HttpNetworkTransactionTest, LoadTimingMeasuresTimeToFirstByteForHttp) {}

// Tests that the time-to-first-byte reported in a transaction's load timing
// info uses the first response, even if 1XX/informational.
void HttpNetworkTransactionTestBase::Check100ResponseTiming(bool use_spdy) {}

TEST_P(HttpNetworkTransactionTest, MeasuresTimeToFirst100ResponseForHttp) {}

TEST_P(HttpNetworkTransactionTest, MeasuresTimeToFirst100ResponseForSpdy) {}

TEST_P(HttpNetworkTransactionTest, Incomplete100ThenEOF) {}

TEST_P(HttpNetworkTransactionTest, EmptyResponse) {}

void HttpNetworkTransactionTestBase::KeepAliveConnectionResendRequestTest(
    const MockWrite* write_failure,
    const MockRead* read_failure) {}

void HttpNetworkTransactionTestBase::PreconnectErrorResendRequestTest(
    const MockWrite* write_failure,
    const MockRead* read_failure,
    bool use_spdy,
    bool chunked_upload) {}

// Test that we do not retry indefinitely when a server sends an error like
// ERR_HTTP2_PING_FAILED, ERR_HTTP2_SERVER_REFUSED_STREAM,
// ERR_QUIC_HANDSHAKE_FAILED or ERR_QUIC_PROTOCOL_ERROR.
TEST_P(HttpNetworkTransactionTest, FiniteRetriesOnIOError) {}

TEST_P(HttpNetworkTransactionTest, RetryTwiceOnIOError) {}

TEST_P(HttpNetworkTransactionTest, KeepAliveConnectionNotConnectedOnWrite) {}

TEST_P(HttpNetworkTransactionTest, KeepAliveConnectionReset) {}

TEST_P(HttpNetworkTransactionTest, KeepAliveConnectionEOF) {}

// Make sure that on a 408 response (Request Timeout), the request is retried,
// if the socket was a reused keep alive socket.
TEST_P(HttpNetworkTransactionTest, KeepAlive408) {}

TEST_P(HttpNetworkTransactionTest, PreconnectErrorNotConnectedOnWrite) {}

TEST_P(HttpNetworkTransactionTest, PreconnectErrorReset) {}

TEST_P(HttpNetworkTransactionTest, PreconnectErrorEOF) {}

TEST_P(HttpNetworkTransactionTest, PreconnectErrorAsyncEOF) {}

// Make sure that on a 408 response (Request Timeout), the request is retried,
// if the socket was a preconnected (UNUSED_IDLE) socket.
TEST_P(HttpNetworkTransactionTest, RetryOnIdle408) {}

TEST_P(HttpNetworkTransactionTest, SpdyPreconnectErrorNotConnectedOnWrite) {}

TEST_P(HttpNetworkTransactionTest, SpdyPreconnectErrorReset) {}

TEST_P(HttpNetworkTransactionTest, SpdyPreconnectErrorEOF) {}

TEST_P(HttpNetworkTransactionTest, SpdyPreconnectErrorAsyncEOF) {}

TEST_P(HttpNetworkTransactionTest, NonKeepAliveConnectionReset) {}

// What do various browsers do when the server closes a non-keepalive
// connection without sending any response header or body?
//
// IE7: error page
// Safari 3.1.2 (Windows): error page
// Firefox 3.0.1: blank page
// Opera 9.52: after five attempts, blank page
// Us with WinHTTP: error page (ERR_INVALID_RESPONSE)
// Us: error page (EMPTY_RESPONSE)
TEST_P(HttpNetworkTransactionTest, NonKeepAliveConnectionEOF) {}

// Next 2 cases (KeepAliveEarlyClose and KeepAliveEarlyClose2) are regression
// tests. There was a bug causing HttpNetworkTransaction to hang in the
// destructor in such situations.
// See http://crbug.com/154712 and http://crbug.com/156609.
TEST_P(HttpNetworkTransactionTest, KeepAliveEarlyClose) {}

TEST_P(HttpNetworkTransactionTest, KeepAliveEarlyClose2) {}

// Test that we correctly reuse a keep-alive connection after not explicitly
// reading the body.
TEST_P(HttpNetworkTransactionTest, KeepAliveAfterUnreadBody) {}

// Sockets that receive extra data after a response is complete should not be
// reused.
TEST_P(HttpNetworkTransactionTest, KeepAliveWithUnusedData1) {}

TEST_P(HttpNetworkTransactionTest, KeepAliveWithUnusedData2) {}

TEST_P(HttpNetworkTransactionTest, KeepAliveWithUnusedData3) {}

// This is a little different from the others - it tests the case that the
// HttpStreamParser doesn't know if there's extra data on a socket or not when
// the HttpNetworkTransaction is torn down, because the response body hasn't
// been read from yet, but the request goes through the HttpResponseBodyDrainer.
TEST_P(HttpNetworkTransactionTest, KeepAliveWithUnusedData4) {}

// Test the request-challenge-retry sequence for basic auth.
// (basic auth is the easiest to mock, because it has no randomness).
TEST_P(HttpNetworkTransactionTest, BasicAuth) {}

// Test the request-challenge-retry sequence for basic auth.
// (basic auth is the easiest to mock, because it has no randomness).
TEST_P(HttpNetworkTransactionTest, BasicAuthWithAddressChange) {}

// Test that, if the server requests auth indefinitely, HttpNetworkTransaction
// will eventually give up.
TEST_P(HttpNetworkTransactionTest, BasicAuthForever) {}

TEST_P(HttpNetworkTransactionTest, DoNotSendAuth) {}

// Test the request-challenge-retry sequence for basic auth, over a keep-alive
// connection.
TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAlive) {}

// Test the request-challenge-retry sequence for basic auth, over a keep-alive
// connection and with no response body to drain.
TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveNoBody) {}

// Test the request-challenge-retry sequence for basic auth, over a keep-alive
// connection and with a large response body to drain.
TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveLargeBody) {}

// Test the request-challenge-retry sequence for basic auth, over a keep-alive
// connection, but the server gets impatient and closes the connection.
TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveImpatientServer) {}

// Test the request-challenge-retry sequence for basic auth, over a connection
// that requires a restart when setting up an SSL tunnel.
TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp10) {}

// Test the request-challenge-retry sequence for basic auth, over a connection
// that requires a restart when setting up an SSL tunnel.
TEST_P(HttpNetworkTransactionTest, BasicAuthProxyNoKeepAliveHttp11) {}

// Test the request-challenge-retry sequence for basic auth, over a keep-alive
// proxy connection with HTTP/1.0 responses, when setting up an SSL tunnel.
TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp10) {}

// Test the request-challenge-retry sequence for basic auth, over a keep-alive
// proxy connection with HTTP/1.1 responses, when setting up an SSL tunnel.
TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHttp11) {}

// Test the request-challenge-retry sequence for basic auth, over a keep-alive
// proxy connection with HTTP/1.1 responses, when setting up an SSL tunnel, in
// the case the server sends extra data on the original socket, so it can't be
// reused.
TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveExtraData) {}

// Test the case a proxy closes a socket while the challenge body is being
// drained.
TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHangupDuringBody) {}

// Test that we don't read the response body when we fail to establish a tunnel,
// even if the user cancels the proxy's auth attempt.
TEST_P(HttpNetworkTransactionTest, BasicAuthProxyCancelTunnel) {}

// Test the no-tunnel HTTP auth case where proxy and server origins and realms
// are the same, but the user/passwords are different. Serves to verify
// credentials are correctly separated based on HttpAuth::Target.
TEST_P(HttpNetworkTransactionTest, BasicAuthProxyMatchesServerAuthNoTunnel) {}

// Test the no-tunnel HTTP auth case where proxy and server origins and realms
// are the same, but the user/passwords are different, and with different
// NetworkAnonymizationKeys. Sends one request with a NAK, response to both
// proxy and auth challenges, sends another request with another NAK, expecting
// only the proxy credentials to be cached, and thus sees only a server auth
// challenge. Then sends a request with the original NAK, expecting cached proxy
// and auth credentials that match the ones used in the first request.
//
// Serves to verify credentials are correctly separated based on
// HttpAuth::Target and NetworkAnonymizationKeys, but NetworkAnonymizationKey
// only affects server credentials, not proxy credentials.
TEST_P(HttpNetworkTransactionTest,
       BasicAuthProxyMatchesServerAuthWithNetworkAnonymizationKeyNoTunnel) {}

// Much like the test above, but uses tunnelled connections.
TEST_P(HttpNetworkTransactionTest,
       BasicAuthProxyMatchesServerAuthWithNetworkAnonymizationKeyWithTunnel) {}

// Test that we don't pass extraneous headers from the proxy's response to the
// caller when the proxy responds to CONNECT with 407.
TEST_P(HttpNetworkTransactionTest, SanitizeProxyAuthHeaders) {}

// Test when a server (non-proxy) returns a 407 (proxy-authenticate).
// The request should fail with ERR_UNEXPECTED_PROXY_AUTH.
TEST_P(HttpNetworkTransactionTest, UnexpectedProxyAuth) {}

// Tests when an HTTPS server (non-proxy) returns a 407 (proxy-authentication)
// through a non-authenticating proxy. The request should fail with
// ERR_UNEXPECTED_PROXY_AUTH.
// Note that it is impossible to detect if an HTTP server returns a 407 through
// a non-authenticating proxy - there is nothing to indicate whether the
// response came from the proxy or the server, so it is treated as if the proxy
// issued the challenge.
TEST_P(HttpNetworkTransactionTest, HttpsServerRequestsProxyAuthThroughProxy) {}

// Test a proxy auth scheme that allows default credentials and a proxy server
// that uses non-persistent connections.
TEST_P(HttpNetworkTransactionTest,
       AuthAllowsDefaultCredentialsTunnelConnectionClose) {}

// Test a proxy auth scheme that allows default credentials and a proxy server
// that hangs up when credentials are initially sent.
TEST_P(HttpNetworkTransactionTest,
       AuthAllowsDefaultCredentialsTunnelServerClosesConnection) {}

// Test a proxy auth scheme that allows default credentials and a proxy server
// that hangs up when credentials are initially sent, and hangs up again when
// they are retried.
TEST_P(HttpNetworkTransactionTest,
       AuthAllowsDefaultCredentialsTunnelServerClosesConnectionTwice) {}

// This test exercises an odd edge case where the proxy closes the connection
// after the authentication handshake is complete. Presumably this technique is
// used in lieu of returning a 403 or 5xx status code when the authentication
// succeeds, but the user is not authorized to connect to the destination
// server. There's no standard for what a proxy should do to indicate a blocked
// site.
TEST_P(HttpNetworkTransactionTest,
       AuthAllowsDefaultCredentialsTunnelConnectionClosesBeforeBody) {}

// Test a proxy auth scheme that allows default credentials and a proxy server
// that hangs up when credentials are initially sent, and sends a challenge
// again they are retried.
TEST_P(HttpNetworkTransactionTest,
       AuthAllowsDefaultCredentialsTunnelServerChallengesTwice) {}

// A more nuanced test than GenerateAuthToken test which asserts that
// ERR_INVALID_AUTH_CREDENTIALS does not cause the auth scheme to be
// unnecessarily invalidated, and that if the server co-operates, the
// authentication handshake can continue with the same scheme but with a
// different identity.
TEST_P(HttpNetworkTransactionTest, NonPermanentGenerateAuthTokenError) {}

// Proxy resolver that returns a proxy with the same host and port for different
// schemes, based on the path of the URL being requests.
class SameProxyWithDifferentSchemesProxyResolver : public ProxyResolver {};

class SameProxyWithDifferentSchemesProxyResolverFactory
    : public ProxyResolverFactory {};

// Check that when different proxy schemes are all applied to a proxy at the
// same address, the connections are not grouped together.  i.e., a request to
// foo.com using proxy.com as an HTTPS proxy won't use the same socket as a
// request to foo.com using proxy.com as an HTTP proxy.
TEST_P(HttpNetworkTransactionTest, SameDestinationForDifferentProxyTypes) {}

// Test the load timing for HTTPS requests with an HTTP proxy.
TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingNoPacTwoRequests) {}

// Test the load timing for HTTPS requests with an HTTP proxy and a PAC script.
TEST_P(HttpNetworkTransactionTest, HttpProxyLoadTimingWithPacTwoRequests) {}

// Make sure that NetworkAnonymizationKeys are passed down to the proxy layer.
TEST_P(HttpNetworkTransactionTest, ProxyResolvedWithNetworkAnonymizationKey) {}

// Test that a failure in resolving the proxy hostname is retrievable.
TEST_P(HttpNetworkTransactionTest, ProxyHostResolutionFailure) {}

// Test a simple GET (for an HTTP endpoint) through an HTTPS Proxy
// (HTTPS -> HTTP).
TEST_P(HttpNetworkTransactionTest, HttpsProxyGet) {}

// Test a simple GET (for an HTTP endpoint) through two HTTPS proxies
// (HTTPS -> HTTPS -> HTTP). This should tunnel through both proxies.
TEST_P(HttpNetworkTransactionTest, HttpsNestedProxyGet) {}

// Test a SPDY GET (for an HTTP endpoint) through an HTTPS (SPDY) proxy
// (SPDY -> HTTP).
TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGet) {}

// Test a SPDY GET (for an HTTP endpoint) through two HTTPS (SPDY) proxies
// (SPDY -> SPDY -> HTTP).
TEST_P(HttpNetworkTransactionTest, HttpsNestedProxySpdyGet) {}

// Test a SPDY GET (for an HTTP endpoint) through the same HTTPS (SPDY) proxy
// twice (SPDY -> SPDY -> HTTP).
TEST_P(HttpNetworkTransactionTest, HttpsNestedProxySameProxyTwiceSpdyGet) {}

// Test that a SPDY protocol error encountered when attempting to perform an
// HTTP request over a multi-proxy chain is handled correctly.
TEST_P(HttpNetworkTransactionTest, NestedProxyHttpOverSpdyProtocolError) {}

// Test that a proxy server requesting a client auth cert doesn't cause a crash.
// TODO(crbug.com/40284947): This test can be deleted once we no longer
// need the multi-proxy chain version below, since this functionality should
// be sufficiently tested elsewhere. For now this test just shows that
// single-proxy and multi-proxy behavior is consistent (when a read returns
// ERR_SSL_CLIENT_AUTH_CERT_NEEDED).
TEST_P(HttpNetworkTransactionTest, HttpsClientAuthCertNeededNoCrash) {}

// Test that the first proxy server in a multi-proxy chain requesting a client
// auth cert doesn't cause a crash.
// TODO(crbug.com/40284947): Support client auth certificates for
// multi-proxy chains and then replace this test with a more robust one (for
// instance, a version of the AuthEverywhere test that uses a multi-proxy
// chain).
TEST_P(HttpNetworkTransactionTest,
       HttpsNestedProxyClientAuthCertNeededFirstProxyNoCrash) {}

// Same as above but using a different method to request the client auth
// certificate.
// TODO(crbug.com/40284947): Support client auth certificates for
// multi-proxy chains and then replace this test with a more robust one (for
// instance, a version of the AuthEverywhere test that uses a multi-proxy
// chain).
TEST_P(HttpNetworkTransactionTest,
       HttpsNestedProxyClientAuthCertNeededFirstProxyNoCrash2) {}

// Test that a read returning ERR_SSL_CLIENT_AUTH_CERT_NEEDED after the first
// CONNECT doesn't result in a crash when a multi-proxy chain is in use.
// TODO(crbug.com/40284947): Support client auth certificates for
// multi-proxy chains and then replace this test with a more robust one (for
// instance, a version of the AuthEverywhere test that uses a multi-proxy
// chain).
TEST_P(HttpNetworkTransactionTest,
       HttpsNestedProxyClientAuthCertNeededAfterFirstConnectNoCrash2) {}

// Test that the second proxy server in a multi-proxy chain requesting a client
// auth cert doesn't cause a crash.
// TODO(crbug.com/40284947): Support client auth certificates for
// multi-proxy chains and then replace this test with a more robust one (for
// instance, a version of the AuthEverywhere test that uses a multi-proxy
// chain).
TEST_P(HttpNetworkTransactionTest,
       HttpsNestedProxyClientAuthCertNeededSecondProxyNoCrash) {}

// Test that the endpoint requesting a client auth cert over a multi-proxy chain
// tunnel doesn't cause a crash.
// TODO(crbug.com/40284947): Support client auth certificates for
// multi-proxy chains and then replace this test with a more robust one (for
// instance, a version of the AuthEverywhere test that uses a multi-proxy
// chain).
TEST_P(HttpNetworkTransactionTest,
       HttpsNestedProxyClientAuthCertNeededEndpointNoCrash) {}

// Verifies that a session which races and wins against the owning transaction
// (completing prior to host resolution), doesn't fail the transaction.
// Regression test for crbug.com/334413.
TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithSessionRace) {}

// Test a SPDY GET through an HTTPS proxy that uses proxy auth.
TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithProxyAuth) {}

// Test a SPDY CONNECT through an HTTPS Proxy to an HTTPS (non-SPDY) Server
// (SPDY -> HTTPS).
TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectHttps) {}

// Test a SPDY CONNECT through two HTTPS (SPDY) proxies to an HTTPS (non-SPDY)
// server (SPDY -> SPDY -> HTTPS).
TEST_P(HttpNetworkTransactionTest, HttpsNestedProxySpdyConnectHttps) {}

// Test a SPDY CONNECT through an HTTPS Proxy to a SPDY server (SPDY -> SPDY).
TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectSpdy) {}

// Test a SPDY CONNECT for an HTTPS (non-SPDY) endpoint through an HTTPS
// (non-SPDY) proxy and HTTPS (SPDY) proxy chain (HTTPS -> SPDY -> HTTPS).
TEST_P(HttpNetworkTransactionTest, HttpsNestedProxyMixedConnectSpdy) {}

// Test an HTTP CONNECT for an HTTPS (non-SPDY) endpoint through an HTTPS (SPDY)
// proxy and HTTPS (non-SPDY) proxy chain (SPDY -> HTTPS -> HTTPS).
TEST_P(HttpNetworkTransactionTest, HttpsNestedProxyMixedConnectHttps) {}

// Test a SPDY CONNECT failure through an HTTPS (SPDY) proxy
// (SPDY -> HTTPS/SPDY).
TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectFailure) {}

// Test a SPDY CONNECT failure through two HTTPS (SPDY) proxies where the
// connection to the first proxy fails (SPDY -> HTTPS/SPDY -> HTTPS/SPDY).
TEST_P(HttpNetworkTransactionTest,
       HttpsNestedProxySpdyConnectFirstProxyFailure) {}

// Test a SPDY CONNECT failure through two HTTPS (SPDY) proxies where the
// connection to the second proxy fails (SPDY -> SPDY -> HTTPS/SPDY).
TEST_P(HttpNetworkTransactionTest,
       HttpsNestedProxySpdyConnectSecondProxyFailure) {}

// This method creates a tunnel using `chain1`, proxies an HTTP GET request
// through it to ensure that it has been created successfully, and then creates
// another tunnel using `chain2` to check whether a new socket is used for it.
// This is used to test that no unexpected socket reuse occurs between different
// proxy chains.
void HttpNetworkTransactionTestBase::HttpsNestedProxyNoSocketReuseHelper(
    const ProxyChain& chain1,
    const ProxyChain& chain2) {}

// If we have established a proxy tunnel through a two hop proxy and then
// establish a tunnel through only the first hop, ensure that socket re-use does
// not occur (HTTPS A -> HTTPS B != HTTPS A).
TEST_P(HttpNetworkTransactionTest, HttpsNestedProxyNoSocketReuseFirstHop) {}

// If we have established a proxy tunnel through a two hop proxy and then
// establish a tunnel through only the second hop, ensure that socket re-use
// does not occur (HTTPS A -> HTTPS B != HTTPS B).
TEST_P(HttpNetworkTransactionTest, HttpsNestedProxyNoSocketReuseSecondHop) {}

// If we have established a proxy tunnel through a two hop proxy and then
// establish a tunnel through the same proxies with the order reversed, ensure
// that socket re-use does not occur (HTTPS A -> HTTPS B != HTTPS B -> HTTPS A).
TEST_P(HttpNetworkTransactionTest, HttpsNestedProxyNoSocketReuseReversedChain) {}

// If we have established a proxy tunnel through a two hop proxy using SPDY,
// ensure that socket reuse occurs as expected. Specifically, for:
// (SPDY A -> SPDY B -> HTTPS Endpoint),
// (SPDY A -> HTTPS Endpoint) should send the endpoint CONNECT to
// the existing SPDY A socket but for:
// (SPDY B -> HTTPS Endpoint), the SPDY A -> SPDY B socket should not be used.
TEST_P(HttpNetworkTransactionTest,
       HttpsNestedProxySpdySocketReuseDifferentChains) {}

// If we have established a proxy tunnel through a two-hop proxy using SPDY,
// ensure that socket reuse occurs as expected for two different requests (test
// that there is only one CONNECT for the second proxy in the chain).
TEST_P(HttpNetworkTransactionTest,
       HttpsNestedProxySpdySocketReuseDifferentRequests) {}

// Ensure that socket reuse occurs after an error from a SPDY connection through
// the nested proxy.
TEST_P(HttpNetworkTransactionTest, HttpsNestedProxySpdySocketReuseAfterError) {}

// Test the case where a proxied H2 session doesn't exist when an auth challenge
// is observed, but does exist by the time auth credentials are provided. In
// this case, auth and SSL are fully negotated on the second request, but then
// the socket is discarded to use the shared session.
TEST_P(HttpNetworkTransactionTest, ProxiedH2SessionAppearsDuringAuth) {}

// Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY
// HTTPS Proxy to different servers.
TEST_P(HttpNetworkTransactionTest,
       HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsTwoServers) {}

// Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY
// HTTPS Proxy to the same server.
TEST_P(HttpNetworkTransactionTest,
       HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsSameServer) {}

// Test load timing in the case of of two HTTP requests through a SPDY HTTPS
// Proxy to different servers.
TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyLoadTimingTwoHttpRequests) {}

// Test that an HTTP/2 CONNECT through an HTTPS Proxy to a HTTP/2 server and a
// direct (non-proxied) request to the proxy server are not pooled, as that
// would break socket pool isolation.
TEST_P(HttpNetworkTransactionTest, SpdyProxyIsolation1) {}

// Same as above, but reverse request order, since the code to check for an
// existing session is different for tunnels and direct connections.
TEST_P(HttpNetworkTransactionTest, SpdyProxyIsolation2) {}

// Test the challenge-response-retry sequence through an HTTPS Proxy
TEST_P(HttpNetworkTransactionTest, HttpsProxyAuthRetry) {}

// Test the challenge-response-retry sequence through an HTTPS Proxy over a
// connection that requires a restart.
TEST_P(HttpNetworkTransactionTest, HttpsProxyAuthRetryNoKeepAlive) {}

// Test the challenge-response-retry sequence through an HTTPS Proxy over a
// connection that requires a restart, with a proxy change occurring over the
// restart.
TEST_P(HttpNetworkTransactionTest, HttpsProxyAuthRetryNoKeepAliveChangeProxy) {}

// Test the challenge-response-retry sequence through an HTTPS Proxy over a
// connection that requires a restart, with a change to a direct connection
// occurring over the restart.
TEST_P(HttpNetworkTransactionTest,
       HttpsProxyAuthRetryNoKeepAliveChangeToDirect) {}

void HttpNetworkTransactionTestBase::ConnectStatusHelperWithExpectedStatus(
    const MockRead& status,
    int expected_status) {}

void HttpNetworkTransactionTestBase::ConnectStatusHelper(
    const MockRead& status) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus100) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus101) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus201) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus202) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus203) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus204) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus205) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus206) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus300) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus301) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus302) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus303) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus304) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus305) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus306) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus307) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus308) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus400) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus401) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus402) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus403) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus404) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus405) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus406) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus407) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus408) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus409) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus410) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus411) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus412) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus413) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus414) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus415) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus416) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus417) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus500) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus501) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus502) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus503) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus504) {}

TEST_P(HttpNetworkTransactionTest, ConnectStatus505) {}

// Test the flow when both the proxy server AND origin server require
// authentication. Again, this uses basic auth for both since that is
// the simplest to mock.
TEST_P(HttpNetworkTransactionTest, BasicAuthProxyThenServer) {}

// For the NTLM implementation using SSPI, we skip the NTLM tests since we
// can't hook into its internals to cause it to generate predictable NTLM
// authorization headers.
#if defined(NTLM_PORTABLE)
// The NTLM authentication unit tests are based on known test data from the
// [MS-NLMP] Specification [1]. These tests are primarily of the authentication
// flow rather than the implementation of the NTLM protocol. See net/ntlm
// for the implementation and testing of the protocol.
//
// [1] https://msdn.microsoft.com/en-us/library/cc236621.aspx

// Enter the correct password and authenticate successfully.
TEST_P(HttpNetworkTransactionTest, NTLMAuthV2) {}

// Enter a wrong password, and then the correct one.
TEST_P(HttpNetworkTransactionTest, NTLMAuthV2WrongThenRightPassword) {}

// Server requests NTLM authentication, which is not supported over HTTP/2.
// Subsequent request with authorization header should be sent over HTTP/1.1.
TEST_P(HttpNetworkTransactionTest, NTLMOverHttp2) {}

// Same as above, but with a host mapping in place. The mapped host is the one
// that should be tagged as requiring HTTP11.
TEST_P(HttpNetworkTransactionTest, NTLMOverHttp2WithHostMapping) {}

#if BUILDFLAG(ENABLE_WEBSOCKETS)

// Variant of above test using WebSockets.
TEST_P(HttpNetworkTransactionTest, NTLMOverHttp2WithWebsockets) {}

#endif  // BUILDFLAG(ENABLE_WEBSOCKETS)

// Test that, if we have an NTLM proxy and the origin resets the connection, we
// do no retry forever as a result of TLS retries. This is a regression test for
// https://crbug.com/823387. The version interference probe has since been
// removed, but we now have a legacy crypto fallback. (If that fallback is
// removed, this test should be kept but with the expectations tweaked, in case
// future fallbacks are added.)
TEST_P(HttpNetworkTransactionTest, NTLMProxyTLSHandshakeReset) {}

#endif  // NTLM_PORTABLE

// Test reading a server response which has only headers, and no body.
// After some maximum number of bytes is consumed, the transaction should
// fail with ERR_RESPONSE_HEADERS_TOO_BIG.
TEST_P(HttpNetworkTransactionTest, LargeHeadersNoBody) {}

// Make sure that we don't try to reuse a TCPClientSocket when failing to
// establish tunnel.
// http://code.google.com/p/chromium/issues/detail?id=3772
TEST_P(HttpNetworkTransactionTest, DontRecycleTransportSocketForSSLTunnel) {}

// Make sure that we recycle a socket after reading all of the response body.
TEST_P(HttpNetworkTransactionTest, RecycleSocket) {}

// Make sure that we recycle a SSL socket after reading all of the response
// body.
TEST_P(HttpNetworkTransactionTest, RecycleSSLSocket) {}

// Grab a SSL socket, use it, and put it back into the pool.  Then, reuse it
// from the pool and make sure that we recover okay.
TEST_P(HttpNetworkTransactionTest, RecycleDeadSSLSocket) {}

TEST_P(HttpNetworkTransactionTest, CloseConnectionOnDestruction) {}

// Grab a socket, use it, and put it back into the pool. Then, make
// low memory notification and ensure the socket pool is flushed.
TEST_P(HttpNetworkTransactionTest, FlushSocketPoolOnLowMemoryNotifications) {}

// Disable idle socket closing on memory pressure.
// Grab a socket, use it, and put it back into the pool. Then, make
// low memory notification and ensure the socket pool is NOT flushed.
TEST_P(HttpNetworkTransactionTest, NoFlushSocketPoolOnLowMemoryNotifications) {}

// Grab an SSL socket, use it, and put it back into the pool. Then, make
// low memory notification and ensure the socket pool is flushed.
TEST_P(HttpNetworkTransactionTest, FlushSSLSocketPoolOnLowMemoryNotifications) {}

// Make sure that we recycle a socket after a zero-length response.
// http://crbug.com/9880
TEST_P(HttpNetworkTransactionTest, RecycleSocketAfterZeroContentLength) {}

TEST_P(HttpNetworkTransactionTest, ResendRequestOnWriteBodyError) {}

// Test the request-challenge-retry sequence for basic auth when there is
// an identity in the URL. The request should be sent as normal, but when
// it fails the identity from the URL is used to answer the challenge.
TEST_P(HttpNetworkTransactionTest, AuthIdentityInURL) {}

// Test the request-challenge-retry sequence for basic auth when there is an
// incorrect identity in the URL. The identity from the URL should be used only
// once.
TEST_P(HttpNetworkTransactionTest, WrongAuthIdentityInURL) {}

// Test the request-challenge-retry sequence for basic auth when there is a
// correct identity in the URL, but its use is being suppressed. The identity
// from the URL should never be used.
TEST_P(HttpNetworkTransactionTest, AuthIdentityInURLSuppressed) {}

// Test that previously tried username/passwords for a realm get re-used.
TEST_P(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) {}

// Tests that nonce count increments when multiple auth attempts
// are started with the same nonce.
TEST_P(HttpNetworkTransactionTest, DigestPreAuthNonceCount) {}

// Test the ResetStateForRestart() private method.
TEST_P(HttpNetworkTransactionTest, ResetStateForRestart) {}

// Test HTTPS connections to a site with a bad certificate
TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificate) {}

// Test HTTPS connections to a site with a bad certificate, going through a
// proxy
TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificateViaProxy) {}

// Test HTTPS connections to a site, going through an HTTPS proxy
TEST_P(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) {}

// Test that an HTTPS Proxy cannot redirect a CONNECT request for main frames.
TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaHttpsProxy) {}

// Test that an HTTPS Proxy cannot redirect a CONNECT request for subresources.
TEST_P(HttpNetworkTransactionTest,
       RedirectOfHttpsConnectSubresourceViaHttpsProxy) {}

// Test that an HTTPS Proxy which was auto-detected cannot redirect a CONNECT
// request for main frames.
TEST_P(HttpNetworkTransactionTest,
       RedirectOfHttpsConnectViaAutoDetectedHttpsProxy) {}

// Tests that an HTTPS (SPDY) Proxy's cannot redirect a CONNECT request for main
// frames.
TEST_P(HttpNetworkTransactionTest, RedirectOfHttpsConnectViaSpdyProxy) {}

// Test that an HTTPS proxy's response to a CONNECT request is filtered.
TEST_P(HttpNetworkTransactionTest, ErrorResponseToHttpsConnectViaHttpsProxy) {}

// Test that a SPDY proxy's response to a CONNECT request is filtered.
TEST_P(HttpNetworkTransactionTest, ErrorResponseToHttpsConnectViaSpdyProxy) {}

// Test the request-challenge-retry sequence for basic auth, through
// a SPDY proxy over a single SPDY session.
TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) {}

// Test HTTPS connections to a site with a bad certificate, going through an
// HTTPS proxy
TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificateViaHttpsProxy) {}

TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgent) {}

TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgentOverTunnel) {}

TEST_P(HttpNetworkTransactionTest, BuildRequest_Referer) {}

TEST_P(HttpNetworkTransactionTest, BuildRequest_PostContentLengthZero) {}

TEST_P(HttpNetworkTransactionTest, BuildRequest_PutContentLengthZero) {}

TEST_P(HttpNetworkTransactionTest, BuildRequest_HeadContentLengthZero) {}

TEST_P(HttpNetworkTransactionTest, BuildRequest_CacheControlNoCache) {}

TEST_P(HttpNetworkTransactionTest, BuildRequest_CacheControlValidateCache) {}

TEST_P(HttpNetworkTransactionTest, BuildRequest_ExtraHeaders) {}

TEST_P(HttpNetworkTransactionTest, BuildRequest_ExtraHeadersStripped) {}

TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) {}

TEST_P(HttpNetworkTransactionTest, SOCKS4_SSL_GET) {}

TEST_P(HttpNetworkTransactionTest, SOCKS4_HTTP_GET_no_PAC) {}

TEST_P(HttpNetworkTransactionTest, SOCKS5_HTTP_GET) {}

TEST_P(HttpNetworkTransactionTest, SOCKS5_SSL_GET) {}

namespace {

// Tests that for connection endpoints the group ids are correctly set.

struct GroupIdTest {};

std::unique_ptr<HttpNetworkSession> SetupSessionForGroupIdTests(
    SpdySessionDependencies* session_deps_) {}

int GroupIdTransactionHelper(const std::string& url,
                             HttpNetworkSession* session) {}

int HttpStreamKeyTransactionHelper(std::string_view url,
                                   HttpNetworkSession* session) {}

}  // namespace

TEST_P(HttpNetworkTransactionTest, GroupIdOrHttpStreamKeyForDirectConnections) {}

TEST_P(HttpNetworkTransactionTest, GroupIdForHTTPProxyConnections) {}

TEST_P(HttpNetworkTransactionTest, GroupIdForSOCKSConnections) {}

TEST_P(HttpNetworkTransactionTest, ReconsiderProxyAfterFailedConnection) {}

// Make sure we can handle an error when writing the request.
TEST_P(HttpNetworkTransactionTest, RequestWriteError) {}

// Check that a connection closed after the start of the headers finishes ok.
TEST_P(HttpNetworkTransactionTest, ConnectionClosedAfterStartOfHeaders) {}

// Make sure that a dropped connection while draining the body for auth
// restart does the right thing.
TEST_P(HttpNetworkTransactionTest, DrainResetOK) {}

// Test HTTPS connections going through a proxy that sends extra data.
TEST_P(HttpNetworkTransactionTest, HTTPSViaProxyWithExtraData) {}

TEST_P(HttpNetworkTransactionTest, LargeContentLengthThenClose) {}

TEST_P(HttpNetworkTransactionTest, UploadFileSmallerThanLength) {}

TEST_P(HttpNetworkTransactionTest, UploadUnreadableFile) {}

TEST_P(HttpNetworkTransactionTest, CancelDuringInitRequestBody) {}

// Tests that changes to Auth realms are treated like auth rejections.
TEST_P(HttpNetworkTransactionTest, ChangeAuthRealms) {}

// Regression test for https://crbug.com/754395.
TEST_P(HttpNetworkTransactionTest, IgnoreAltSvcWithInvalidCert) {}

TEST_P(HttpNetworkTransactionTest, HonorAlternativeServiceHeader) {}

TEST_P(HttpNetworkTransactionTest,
       HonorAlternativeServiceHeaderWithNetworkAnonymizationKey) {}

// Regression test for https://crbug.com/615497.
TEST_P(HttpNetworkTransactionTest,
       DoNotParseAlternativeServiceHeaderOnInsecureRequest) {}

// HTTP/2 Alternative Services should be disabled by default.
// TODO(bnc): Remove when https://crbug.com/615413 is fixed.
TEST_P(HttpNetworkTransactionTest,
       DisableHTTP2AlternativeServicesWithDifferentHost) {}

// Regression test for https://crbug.com/615497:
// Alternative Services should be disabled for http origin.
TEST_P(HttpNetworkTransactionTest,
       DisableAlternativeServicesForInsecureOrigin) {}

TEST_P(HttpNetworkTransactionTest, ClearAlternativeServices) {}

TEST_P(HttpNetworkTransactionTest, HonorMultipleAlternativeServiceHeaders) {}

TEST_P(HttpNetworkTransactionTest, IdentifyQuicBroken) {}

TEST_P(HttpNetworkTransactionTest, IdentifyQuicNotBroken) {}

TEST_P(HttpNetworkTransactionTest, MarkBrokenAlternateProtocolAndFallback) {}

// Ensure that we are not allowed to redirect traffic via an alternate protocol
// to an unrestricted (port >= 1024) when the original traffic was on a
// restricted port (port < 1024).  Ensure that we can redirect in all other
// cases.
TEST_P(HttpNetworkTransactionTest, AlternateProtocolPortRestrictedBlocked) {}

// Ensure that we are allowed to redirect traffic via an alternate protocol to
// an unrestricted (port >= 1024) when the original traffic was on a restricted
// port (port < 1024) if we set |enable_user_alternate_protocol_ports|.
TEST_P(HttpNetworkTransactionTest, AlternateProtocolPortRestrictedPermitted) {}

// Ensure that we are not allowed to redirect traffic via an alternate protocol
// to an unrestricted (port >= 1024) when the original traffic was on a
// restricted port (port < 1024).  Ensure that we can redirect in all other
// cases.
TEST_P(HttpNetworkTransactionTest, AlternateProtocolPortRestrictedAllowed) {}

// Ensure that we are not allowed to redirect traffic via an alternate protocol
// to an unrestricted (port >= 1024) when the original traffic was on a
// restricted port (port < 1024).  Ensure that we can redirect in all other
// cases.
TEST_P(HttpNetworkTransactionTest, AlternateProtocolPortUnrestrictedAllowed1) {}

// Ensure that we are not allowed to redirect traffic via an alternate protocol
// to an unrestricted (port >= 1024) when the original traffic was on a
// restricted port (port < 1024).  Ensure that we can redirect in all other
// cases.
TEST_P(HttpNetworkTransactionTest, AlternateProtocolPortUnrestrictedAllowed2) {}

// Ensure that we are not allowed to redirect traffic via an alternate protocol
// to an unsafe port, and that we resume the second HttpStreamFactory::Job once
// the alternate protocol request fails.
TEST_P(HttpNetworkTransactionTest, AlternateProtocolUnsafeBlocked) {}

TEST_P(HttpNetworkTransactionTest, UseAlternateProtocolForNpnSpdy) {}

TEST_P(HttpNetworkTransactionTest, AlternateProtocolWithSpdyLateBinding) {}

TEST_P(HttpNetworkTransactionTest, StallAlternativeServiceForNpnSpdy) {}

// Test that proxy is resolved using the origin url,
// regardless of the alternative server.
TEST_P(HttpNetworkTransactionTest, UseOriginNotAlternativeForProxy) {}

TEST_P(HttpNetworkTransactionTest, UseAlternativeServiceForTunneledNpnSpdy) {}

TEST_P(HttpNetworkTransactionTest,
       UseAlternativeServiceForNpnSpdyWithExistingSpdySession) {}

// GenerateAuthToken is a mighty big test.
// It tests all permutation of GenerateAuthToken behavior:
//   - Synchronous and Asynchronous completion.
//   - OK or error on completion.
//   - Direct connection, non-authenticating proxy, and authenticating proxy.
//   - HTTP or HTTPS backend (to include proxy tunneling).
//   - Non-authenticating and authenticating backend.
//
// In all, there are 44 reasonable permuations (for example, if there are
// problems generating an auth token for an authenticating proxy, we don't
// need to test all permutations of the backend server).
//
// The test proceeds by going over each of the configuration cases, and
// potentially running up to three rounds in each of the tests. The TestConfig
// specifies both the configuration for the test as well as the expectations
// for the results.
TEST_P(HttpNetworkTransactionTest, GenerateAuthToken) {}

TEST_P(HttpNetworkTransactionTest, MultiRoundAuth) {}TEST_P(HttpNetworkTransactionTest, NpnWithHttpOverSSL) {}TEST_P(HttpNetworkTransactionTest, SpdyPostALPNServerHangup) {}class UrlRecordingHttpAuthHandlerMock : public HttpAuthHandlerMock {}TEST_P(HttpNetworkTransactionTest, SimpleCancel) {}TEST_P(HttpNetworkTransactionTest, CancelAfterHeaders) {}TEST_P(HttpNetworkTransactionTest, ProxyGet) {}TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) {}TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetIPv6) {}TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetHangup) {}TEST_P(HttpNetworkTransactionTest, PreconnectWithExistingSpdySession) {}void HttpNetworkTransactionTestBase::CheckErrorIsPassedBack(int error,
                                                            IoMode mode) {}TEST_P(HttpNetworkTransactionTest, SSLWriteCertError) {}TEST_P(HttpNetworkTransactionTest, ClientAuthCertCache_Direct_NoFalseStart) {}TEST_P(HttpNetworkTransactionTest, ClientAuthCertCache_Direct_FalseStart) {}TEST_P(HttpNetworkTransactionTest, ClientAuthCertCache_Proxy_Fail) {}TEST_P(HttpNetworkTransactionTest, CertificateRequestInRenego) {}TEST_P(HttpNetworkTransactionTest, UseIPConnectionPooling) {}TEST_P(HttpNetworkTransactionTest, UseIPConnectionPoolingAfterResolution) {}TEST_P(HttpNetworkTransactionTest, NoIPConnectionPoolingForProxyAndHostSpdy) {}TEST_P(HttpNetworkTransactionTest, NoIPConnectionPoolingForProxyAndHostHttp) {}TEST_P(HttpNetworkTransactionTest, NoIPConnectionPoolingForTwoProxiesSpdy) {}TEST_P(HttpNetworkTransactionTest, NoIPConnectionPoolingForTwoProxiesHttp) {}TEST_P(HttpNetworkTransactionTest, RetryWithoutConnectionPooling) {}TEST_P(HttpNetworkTransactionTest, ReturnHTTP421OnRetry) {}TEST_P(HttpNetworkTransactionTest,
       Response421WithStreamingBodyWithNonNullSource) {}TEST_P(HttpNetworkTransactionTest, Response421WithStreamingBodyWithNullSource) {}TEST_P(HttpNetworkTransactionTest,
       UseIPConnectionPoolingWithHostCacheExpiration) {}TEST_P(HttpNetworkTransactionTest, DoNotUseSpdySessionForHttp) {}TEST_P(HttpNetworkTransactionTest, AlternativeServiceNotOnHttp11) {}TEST_P(HttpNetworkTransactionTest, FailedAlternativeServiceIsNotUserVisible) {}TEST_P(HttpNetworkTransactionTest, AlternativeServiceShouldNotPoolToHttp11) {}TEST_P(HttpNetworkTransactionTest, DoNotUseSpdySessionForHttpOverTunnel) {}TEST_P(HttpNetworkTransactionTest, DoNotUseSpdySessionIfCertDoesNotMatch) {}TEST_P(HttpNetworkTransactionTest, ErrorSocketNotConnected) {}TEST_P(HttpNetworkTransactionTest, CloseIdleSpdySessionToOpenNewOne) {}TEST_P(HttpNetworkTransactionTest, HttpSyncConnectError) {}TEST_P(HttpNetworkTransactionTest, HttpAsyncConnectError) {}TEST_P(HttpNetworkTransactionTest, HttpSyncWriteError) {}TEST_P(HttpNetworkTransactionTest, HttpAsyncWriteError) {}TEST_P(HttpNetworkTransactionTest, HttpSyncReadError) {}TEST_P(HttpNetworkTransactionTest, HttpAsyncReadError) {}TEST_P(HttpNetworkTransactionTest, CloseSSLSocketOnIdleForHttpRequest) {}TEST_P(HttpNetworkTransactionTest, CloseSSLSocketOnIdleForHttpRequest2) {}TEST_P(HttpNetworkTransactionTest, PostReadsErrorResponseAfterReset) {}TEST_P(HttpNetworkTransactionTest,
       PostReadsErrorResponseAfterResetOnReusedSocket) {}TEST_P(HttpNetworkTransactionTest,
       PostReadsErrorResponseAfterResetPartialBodySent) {}TEST_P(HttpNetworkTransactionTest, ChunkedPostReadsErrorResponseAfterReset) {}TEST_P(HttpNetworkTransactionTest, PostReadsErrorResponseAfterResetAnd100) {}TEST_P(HttpNetworkTransactionTest, PostIgnoresNonErrorResponseAfterReset) {}TEST_P(HttpNetworkTransactionTest,
       PostIgnoresNonErrorResponseAfterResetAnd100) {}TEST_P(HttpNetworkTransactionTest, PostIgnoresHttp09ResponseAfterReset) {}TEST_P(HttpNetworkTransactionTest, PostIgnoresPartial400HeadersAfterReset) {}#if BUILDFLAG(ENABLE_WEBSOCKETS)void AddWebSocketHeaders(HttpRequestHeaders* headers) {}TEST_P(HttpNetworkTransactionTest, CreateWebSocketHandshakeStream) {}TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWssTunnel) {}TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWsTunnel) {}TEST_P(HttpNetworkTransactionTest, WebSocketNotSentOverQuicProxy) {}#endif  // BUILDFLAG(ENABLE_WEBSOCKETS)TEST_P(HttpNetworkTransactionTest, TotalNetworkBytesPost) {}TEST_P(HttpNetworkTransactionTest, TotalNetworkBytesPost100Continue) {}TEST_P(HttpNetworkTransactionTest, TotalNetworkBytesChunkedPost) {}void CheckContentEncodingMatching(SpdySessionDependencies* session_deps,
                                  const std::string& accept_encoding,
                                  const std::string& content_encoding,
                                  const std::string& location,
                                  bool should_match) {}TEST_P(HttpNetworkTransactionTest, MatchContentEncoding1) {}TEST_P(HttpNetworkTransactionTest, MatchContentEncoding2) {}TEST_P(HttpNetworkTransactionTest, MatchContentEncoding3) {}TEST_P(HttpNetworkTransactionTest, MatchContentEncoding4) {}TEST_P(HttpNetworkTransactionTest, ProxyResolutionFailsSync) {}TEST_P(HttpNetworkTransactionTest, ProxyResolutionFailsAsync) {}TEST_P(HttpNetworkTransactionTest, NoSupportedProxies) {}#if BUILDFLAG(ENABLE_REPORTING)class HttpNetworkTransactionReportingTest
    : public HttpNetworkTransactionTestBase,
      public ::testing::WithParamInterface<bool> {}TEST_P(HttpNetworkTransactionReportingTest,
       DontProcessReportToHeaderNoService) {}TEST_P(HttpNetworkTransactionReportingTest, DontProcessReportToHeaderHttp) {}TEST_P(HttpNetworkTransactionReportingTest, ProcessReportToHeaderHttps) {}TEST_P(HttpNetworkTransactionReportingTest,
       DontProcessReportToHeaderInvalidHttps) {}INSTANTIATE_TEST_SUITE_P()#endif  // BUILDFLAG(ENABLE_REPORTING)#if BUILDFLAG(ENABLE_REPORTING)const char kUserAgent[] =const char kReferrer[] =class HttpNetworkTransactionNetworkErrorLoggingTest
    : public HttpNetworkTransactionTest {}INSTANTIATE_TEST_SUITE_P()TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       DontProcessNelHeaderNoService) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       DontProcessNelHeaderHttp) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       DontProcessNelHeaderProxy) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest, ProcessNelHeaderHttps) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       DontProcessNelHeaderInvalidHttps) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest, CreateReportSuccess) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       CreateReportDNSErrorAfterStartSync) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       CreateReportDNSErrorAfterStartAsync) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       CreateReportErrorAfterStart) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       CreateReportErrorAfterStartAsync) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       CreateReportReadBodyError) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       CreateReportReadBodyErrorAsync) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       CreateReportRestartWithAuth) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       CreateReportRestartWithAuthAsync) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       CreateReportRetryKeepAliveConnectionReset) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       CreateReportRetryKeepAlive408) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       CreateReportRetry421WithoutConnectionPooling) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       CreateReportCancelAfterStart) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       CreateReportCancelBeforeReadingBody) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest, DontCreateReportHttp) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       DontCreateReportHttpError) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest, DontCreateReportProxy) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest,
       ReportContainsUploadDepth) {}TEST_P(HttpNetworkTransactionNetworkErrorLoggingTest, ReportElapsedTime) {}#endif  // BUILDFLAG(ENABLE_REPORTING)TEST_P(HttpNetworkTransactionTest, AlwaysFailRequestToCache) {}TEST_P(HttpNetworkTransactionTest, ZeroRTTDoesntConfirm) {}TEST_P(HttpNetworkTransactionTest, ZeroRTTSyncConfirmSyncWrite) {}TEST_P(HttpNetworkTransactionTest, ZeroRTTSyncConfirmAsyncWrite) {}TEST_P(HttpNetworkTransactionTest, ZeroRTTAsyncConfirmSyncWrite) {}TEST_P(HttpNetworkTransactionTest, ZeroRTTAsyncConfirmAsyncWrite) {}TEST_P(HttpNetworkTransactionTest, ZeroRTTReject) {}TEST_P(HttpNetworkTransactionTest, ZeroRTTConfirmErrorSync) {}TEST_P(HttpNetworkTransactionTest, ZeroRTTConfirmErrorAsync) {}TEST_P(HttpNetworkTransactionTest, AuthEverything) {}TEST_P(HttpNetworkTransactionTest, AuthEverythingWithConnectClose) {}TEST_P(HttpNetworkTransactionTest, ProxyHTTPAndServerTLSAuth) {}TEST_P(HttpNetworkTransactionTest, ClientCertSocketReuse) {}TEST_P(HttpNetworkTransactionTest, NetworkIsolation) {}TEST_P(HttpNetworkTransactionTest, NetworkIsolationH2) {}TEST_P(HttpNetworkTransactionTest, NetworkIsolationPreconnect) {}TEST_P(HttpNetworkTransactionTest, NetworkIsolationSSL) {}TEST_P(HttpNetworkTransactionTest, NetworkIsolationSSLProxy) {}TEST_P(HttpNetworkTransactionTest, SSLConfigChanged) {}TEST_P(HttpNetworkTransactionTest, SSLConfigChangedDuringTransaction) {}TEST_P(HttpNetworkTransactionTest, SSLConfigChangedPendingConnect) {}TEST_P(HttpNetworkTransactionTest, PostHandshakeClientCertWithSockets) {}TEST_P(HttpNetworkTransactionTest, RequestWithDnsAliases) {}TEST_P(HttpNetworkTransactionTest, RequestWithNoAdditionalDnsAliases) {}TEST_P(HttpNetworkTransactionTest, SetProxyInfoInResponse_Direct) {}TEST_P(HttpNetworkTransactionTest, SetProxyInfoInResponse_Proxied) {}TEST_P(HttpNetworkTransactionTest, SetProxyInfoInResponse_Empty) {}TEST_P(HttpNetworkTransactionTest, SetProxyInfoInResponse_IpProtectionProxied) {}TEST_P(HttpNetworkTransactionTest, SetProxyInfoInResponse_IpProtectionDirect) {}class IpProtectionProxyDelegate : public TestProxyDelegate {}TEST_P(HttpNetworkTransactionTest,
       HttpsNestedProxyIpProtectionRequestHeaderAddedWhenEnabled) {}TEST_P(HttpNetworkTransactionTest,
       HttpsNestedProxyIpProtectionRequestHeaderNotAddedForIpProtectionDirect) {}TEST_P(HttpNetworkTransactionTest,
       HttpsNestedProxyIpProtectionRequestHeaderNotAddedIfFeatureDisabled) {}TEST_P(HttpNetworkTransactionTest,
       HttpsNestedProxyIpProtectionRequestHeaderNotAddedAfterFallback) {}class HttpNetworkTransactionPoolTest : public HttpNetworkTransactionTest {}INSTANTIATE_TEST_SUITE_P()TEST_P(HttpNetworkTransactionPoolTest, SwitchToHttpStreamPool) {}