chromium/net/http/http_cache_unittest.cc

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

#include "net/http/http_cache.h"

#include <stdint.h>

#include <algorithm>
#include <memory>
#include <optional>
#include <set>
#include <utility>
#include <vector>

#include "base/files/scoped_temp_dir.h"
#include "base/format_macros.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_clock.h"
#include "base/time/time.h"
#include "base/trace_event/memory_allocator_dump.h"
#include "base/trace_event/memory_dump_request_args.h"
#include "base/trace_event/process_memory_dump.h"
#include "net/base/cache_type.h"
#include "net/base/completion_repeating_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_flags.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/schemeful_site.h"
#include "net/base/tracing.h"
#include "net/base/upload_bytes_element_reader.h"
#include "net/cert/cert_status_flags.h"
#include "net/cert/x509_certificate.h"
#include "net/disk_cache/disk_cache.h"
#include "net/http/http_byte_range.h"
#include "net/http/http_cache_transaction.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_request_info.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_response_headers_test_util.h"
#include "net/http/http_response_info.h"
#include "net/http/http_transaction.h"
#include "net/http/http_transaction_test_util.h"
#include "net/http/http_util.h"
#include "net/http/mock_http_cache.h"
#include "net/log/net_log_event_type.h"
#include "net/log/net_log_source.h"
#include "net/log/net_log_with_source.h"
#include "net/log/test_net_log.h"
#include "net/log/test_net_log_util.h"
#include "net/socket/client_socket_handle.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_connection_status_flags.h"
#include "net/test/cert_test_util.h"
#include "net/test/gtest_util.h"
#include "net/test/scoped_mutually_exclusive_feature_list.h"
#include "net/test/test_data_directory.h"
#include "net/test/test_with_task_environment.h"
#include "net/websockets/websocket_handshake_stream_base.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"

IsError;
IsOk;
AllOf;
ByRef;
Contains;
ElementsAre;
Eq;
Field;
Gt;
IsEmpty;
NotNull;

Time;

namespace net {

CacheEntryStatus;

class WebSocketEndpointLockManager;

namespace {

constexpr auto ToSimpleString =;

// Tests the load timing values of a request that goes through a
// MockNetworkTransaction.
void TestLoadTimingNetworkRequest(const LoadTimingInfo& load_timing_info) {}

// Tests the load timing values of a request that receives a cached response.
void TestLoadTimingCachedResponse(const LoadTimingInfo& load_timing_info) {}

void DeferCallback(bool* defer) {}

class DeleteCacheCompletionCallback
    : public TestGetBackendCompletionCallbackBase {};

//-----------------------------------------------------------------------------
// helpers

void ReadAndVerifyTransaction(HttpTransaction* trans,
                              const MockTransaction& trans_info) {}

void ReadRemainingAndVerifyTransaction(HttpTransaction* trans,
                                       const std::string& already_read,
                                       const MockTransaction& trans_info) {}

void RunTransactionTestBase(HttpCache* cache,
                            const MockTransaction& trans_info,
                            const MockHttpRequest& request,
                            HttpResponseInfo* response_info,
                            const NetLogWithSource& net_log,
                            LoadTimingInfo* load_timing_info,
                            int64_t* sent_bytes,
                            int64_t* received_bytes,
                            IPEndPoint* remote_endpoint) {}

void RunTransactionTestWithRequest(HttpCache* cache,
                                   const MockTransaction& trans_info,
                                   const MockHttpRequest& request,
                                   HttpResponseInfo* response_info) {}

void RunTransactionTestAndGetTiming(HttpCache* cache,
                                    const MockTransaction& trans_info,
                                    const NetLogWithSource& log,
                                    LoadTimingInfo* load_timing_info) {}

void RunTransactionTestAndGetTimingAndConnectedSocketAddress(
    HttpCache* cache,
    const MockTransaction& trans_info,
    const NetLogWithSource& log,
    LoadTimingInfo* load_timing_info,
    IPEndPoint* remote_endpoint) {}

void RunTransactionTest(HttpCache* cache, const MockTransaction& trans_info) {}

void RunTransactionTestWithLog(HttpCache* cache,
                               const MockTransaction& trans_info,
                               const NetLogWithSource& log) {}

void RunTransactionTestWithResponseInfo(HttpCache* cache,
                                        const MockTransaction& trans_info,
                                        HttpResponseInfo* response) {}

void RunTransactionTestWithResponseInfoAndGetTiming(
    HttpCache* cache,
    const MockTransaction& trans_info,
    HttpResponseInfo* response,
    const NetLogWithSource& log,
    LoadTimingInfo* load_timing_info) {}

void RunTransactionTestWithResponse(HttpCache* cache,
                                    const MockTransaction& trans_info,
                                    std::string* response_headers) {}

void RunTransactionTestWithResponseAndGetTiming(
    HttpCache* cache,
    const MockTransaction& trans_info,
    std::string* response_headers,
    const NetLogWithSource& log,
    LoadTimingInfo* load_timing_info) {}

// This class provides a handler for kFastNoStoreGET_Transaction so that the
// no-store header can be included on demand.
class FastTransactionServer {};
bool FastTransactionServer::no_store;

const MockTransaction kFastNoStoreGET_Transaction =;

// This class provides a handler for kRangeGET_TransactionOK so that the range
// request can be served on demand.
class RangeTransactionServer {};
bool RangeTransactionServer::not_modified_ =;
bool RangeTransactionServer::modified_ =;
bool RangeTransactionServer::bad_200_ =;
bool RangeTransactionServer::redirect_ =;
int64_t RangeTransactionServer::length_ =;

// A dummy extra header that must be preserved on a given request.

// EXTRA_HEADER_LINE doesn't include a line terminator because it
// will be passed to AddHeaderFromString() which doesn't accept them.
#define EXTRA_HEADER_LINE

// EXTRA_HEADER contains a line terminator, as expected by
// AddHeadersFromString() (_not_ AddHeaderFromString()).
#define EXTRA_HEADER

static const char kExtraHeaderKey[] =;

// Static.
void RangeTransactionServer::RangeHandler(const HttpRequestInfo* request,
                                          std::string* response_status,
                                          std::string* response_headers,
                                          std::string* response_data) {}

const MockTransaction kRangeGET_TransactionOK =;

const char kFullRangeData[] =;

// Verifies the response headers (|response|) match a partial content
// response for the range starting at |start| and ending at |end|.
void Verify206Response(const std::string& response, int start, int end) {}

// Creates a truncated entry that can be resumed using byte ranges.
void CreateTruncatedEntry(std::string raw_headers, MockHttpCache* cache) {}

// Verifies that there's an entry with this |key| with the truncated flag set to
// |flag_value|, and with an optional |data_size| (if not zero).
void VerifyTruncatedFlag(MockHttpCache* cache,
                         const std::string& key,
                         bool flag_value,
                         int data_size) {}

// Helper to represent a network HTTP response.
struct Response {};

struct Context {};

class FakeWebSocketHandshakeStreamCreateHelper
    : public WebSocketHandshakeStreamBase::CreateHelper {};

// Returns true if |entry| is not one of the log types paid attention to in this
// test. Note that HTTP_CACHE_WRITE_INFO and HTTP_CACHE_*_DATA are
// ignored.
bool ShouldIgnoreLogEntry(const NetLogEntry& entry) {}

// Gets the entries from |net_log| created by the cache layer and asserted on in
// these tests.
std::vector<NetLogEntry> GetFilteredNetLogEntries(
    const RecordingNetLogObserver& net_log_observer) {}

bool LogContainsEventType(const RecordingNetLogObserver& net_log_observer,
                          NetLogEventType expected) {}

// Returns a TransportInfo distinct from the default for mock transactions,
// with the given port number.
TransportInfo TestTransportInfoWithPort(uint16_t port) {}

// Returns a TransportInfo distinct from the default for mock transactions.
TransportInfo TestTransportInfo() {}

TransportInfo CachedTestTransportInfo() {}

// Helper function, generating valid HTTP cache key from `url`.
// See also: HttpCache::GenerateCacheKey(..)
std::string GenerateCacheKey(const std::string& url) {}

}  // namespace

HttpCacheTest;

class HttpCacheIOCallbackTest : public HttpCacheTest {};

class HttpSplitCacheKeyTest : public HttpCacheTest {};

//-----------------------------------------------------------------------------
// Tests.

TEST_F(HttpCacheTest, CreateThenDestroy) {}

TEST_F(HttpCacheTest, GetBackend) {}

HttpCacheSimpleGetTest;

TEST_F(HttpCacheSimpleGetTest, Basic) {}

// This test verifies that the callback passed to SetConnectedCallback() is
// called once for simple GET calls that traverse the cache.
TEST_F(HttpCacheSimpleGetTest, ConnectedCallback) {}

// This test verifies that when the callback passed to SetConnectedCallback()
// returns an error, the transaction fails with that error.
TEST_F(HttpCacheSimpleGetTest, ConnectedCallbackReturnError) {}

// This test verifies that the callback passed to SetConnectedCallback() is
// called once for requests that hit the cache.
TEST_F(HttpCacheSimpleGetTest, ConnectedCallbackOnCacheHit) {}

// This test verifies that when the callback passed to SetConnectedCallback()
// is called for a request that hit the cache and returns an error, the cache
// entry is reusable.
TEST_F(HttpCacheSimpleGetTest, ConnectedCallbackOnCacheHitReturnError) {}

// This test verifies that when the callback passed to SetConnectedCallback()
// returns `ERR_INCONSISTENT_IP_ADDRESS_SPACE`, the cache entry is invalidated.
TEST_F(HttpCacheSimpleGetTest,
       ConnectedCallbackOnCacheHitReturnInconsistentIpError) {}

// This test verifies that when the callback passed to SetConnectedCallback()
// returns
// `ERR_CACHED_IP_ADDRESS_SPACE_BLOCKED_BY_PRIVATE_NETWORK_ACCESS_POLICY`, the
// cache entry is invalidated, and we'll retry the connection from the network.
TEST_F(HttpCacheSimpleGetTest,
       ConnectedCallbackOnCacheHitReturnPrivateNetworkAccessBlockedError) {}

// This test verifies that the callback passed to SetConnectedCallback() is
// called with the right transport type when the cached entry was originally
// fetched via proxy.
TEST_F(HttpCacheSimpleGetTest, ConnectedCallbackOnCacheHitFromProxy) {}

TEST_F(HttpCacheSimpleGetTest, DelayedCacheLock) {}

TEST_F(HttpCacheTest, GetExperimentMode) {}

enum class SplitCacheTestCase {};

const struct {} kTestCaseToFeatureMapping[] =;

class HttpCacheTestSplitCacheFeature
    : public HttpCacheTest,
      public ::testing::WithParamInterface<SplitCacheTestCase> {};

TEST_P(HttpCacheTestSplitCacheFeature, SimpleGetVerifyGoogleFontMetrics) {}

INSTANTIATE_TEST_SUITE_P();

class HttpCacheTestSplitCacheFeatureEnabled : public HttpCacheTest {};

TEST_F(HttpCacheSimpleGetTest, NoDiskCache) {}

TEST_F(HttpCacheSimpleGetTest, NoDiskCache2) {}

// Tests that IOBuffers are not referenced after IO completes.
TEST_F(HttpCacheTest, ReleaseBuffer) {}

TEST_F(HttpCacheSimpleGetTest, WithDiskFailures) {}

// Tests that disk failures after the transaction has started don't cause the
// request to fail.
TEST_F(HttpCacheSimpleGetTest, WithDiskFailures2) {}

// Tests that we handle failures to read from the cache.
TEST_F(HttpCacheSimpleGetTest, WithDiskFailures3) {}

TEST_F(HttpCacheSimpleGetTest, LoadOnlyFromCacheHit) {}

TEST_F(HttpCacheSimpleGetTest, LoadOnlyFromCacheMiss) {}

TEST_F(HttpCacheSimpleGetTest, LoadPreferringCacheHit) {}

TEST_F(HttpCacheSimpleGetTest, LoadPreferringCacheMiss) {}

// Tests LOAD_SKIP_CACHE_VALIDATION in the presence of vary headers.
TEST_F(HttpCacheSimpleGetTest, LoadPreferringCacheVaryMatch) {}

// Tests LOAD_SKIP_CACHE_VALIDATION in the presence of vary headers.
TEST_F(HttpCacheSimpleGetTest, LoadPreferringCacheVaryMismatch) {}

// Tests that we honor Vary: * with LOAD_SKIP_CACHE_VALIDATION (crbug/778681)
TEST_F(HttpCacheSimpleGetTest, LoadSkipCacheValidationVaryStar) {}

// Tests that was_cached was set properly on a failure, even if the cached
// response wasn't returned.
TEST_F(HttpCacheSimpleGetTest, CacheSignalFailure) {}

// Tests that if the transaction is destroyed right after setting the
// cache_entry_status_ as CANT_CONDITIONALIZE, then RecordHistograms should not
// hit a dcheck.
TEST_F(HttpCacheTest, RecordHistogramsCantConditionalize) {}

// Confirm if we have an empty cache, a read is marked as network verified.
TEST_F(HttpCacheSimpleGetTest, NetworkAccessedNetwork) {}

// Confirm if we have a fresh entry in cache, it isn't marked as
// network verified.
TEST_F(HttpCacheSimpleGetTest, NetworkAccessedCache) {}

TEST_F(HttpCacheSimpleGetTest, LoadBypassCache) {}

TEST_F(HttpCacheSimpleGetTest, LoadBypassCacheImplicit) {}

TEST_F(HttpCacheSimpleGetTest, LoadBypassCacheImplicit2) {}

TEST_F(HttpCacheSimpleGetTest, LoadValidateCache) {}

TEST_F(HttpCacheSimpleGetTest, LoadValidateCacheImplicit) {}

// Tests that |unused_since_prefetch| is updated accordingly (e.g. it is set to
// true after a prefetch and set back to false when the prefetch is used).
TEST_F(HttpCacheSimpleGetTest, UnusedSincePrefetch) {}

// Tests that requests made with the LOAD_RESTRICTED_PREFETCH_FOR_MAIN_FRAME
// load flag result in HttpResponseInfo entries with the |restricted_prefetch|
// flag set. Also tests that responses with |restricted_prefetch| flag set can
// only be used by requests that have the
// LOAD_CAN_USE_RESTRICTED_PREFETCH_FOR_MAIN_FRAME load flag.
TEST_F(HttpCacheSimpleGetTest, RestrictedPrefetchIsRestrictedUntilReuse) {}

TEST_F(HttpCacheSimpleGetTest, RestrictedPrefetchReuseIsLimited) {}

TEST_F(HttpCacheSimpleGetTest, UnusedSincePrefetchWriteError) {}

// Make sure that if a prefetch entry is truncated, then an attempt to re-use it
// gets aborted in connected handler that truncated bit is not lost.
TEST_F(HttpCacheTest, PrefetchTruncateCancelInConnectedCallback) {}

// Make sure that if a stale-while-revalidate entry is truncated, then an
// attempt to re-use it gets aborted in connected handler that truncated bit is
// not lost.
TEST_F(HttpCacheTest, StaleWhiteRevalidateTruncateCancelInConnectedCallback) {}

static const auto kPreserveRequestHeaders =;

// Tests that we don't remove extra headers for simple requests.
TEST_F(HttpCacheSimpleGetTest, PreserveRequestHeaders) {}

// Tests that we don't remove extra headers for conditionalized requests.
TEST_F(HttpCacheTest, ConditionalizedGetPreserveRequestHeaders) {}

TEST_F(HttpCacheSimpleGetTest, ManyReaders) {}

HttpCacheRangeGetTest;

TEST_F(HttpCacheRangeGetTest, FullAfterPartial) {}

// Tests that when a range request transaction becomes a writer for the first
// range and then fails conditionalization for the next range and decides to
// doom the entry, then there should not be a dcheck assertion hit.
TEST_F(HttpCacheRangeGetTest, OverlappingRangesCouldntConditionalize) {}

TEST_F(HttpCacheRangeGetTest, FullAfterPartialReuse) {}

// This test verifies that the ConnectedCallback passed to a cache transaction
// is called once per subrange in the case of a range request with a partial
// cache hit.
TEST_F(HttpCacheRangeGetTest, ConnectedCallbackCalledForEachRange) {}

// This test verifies that when the ConnectedCallback passed to a cache range
// transaction returns an `ERR_INCONSISTENT_IP_ADDRESS_SPACE` error during a
// partial read from cache, then the cache entry is invalidated.
TEST_F(HttpCacheRangeGetTest, ConnectedCallbackReturnInconsistentIpError) {}

// This test verifies that when the ConnectedCallback passed to a cache range
// transaction returns an `ERR_INCONSISTENT_IP_ADDRESS_SPACE` error during a
// network transaction, then the cache entry is invalidated.
TEST_F(HttpCacheRangeGetTest,
       ConnectedCallbackReturnInconsistentIpErrorForNetwork) {}

// This test verifies that when the ConnectedCallback passed to a cache
// transaction returns an error for the second (or third) subrange transaction,
// the overall cache transaction fails with that error. The cache entry is still
// usable after that.
TEST_F(HttpCacheRangeGetTest, ConnectedCallbackReturnErrorSecondTime) {}

// This test verifies that the ConnectedCallback passed to a cache transaction
// is called once per subrange in the case of a range request with a partial
// cache hit, even when a prefix of the range is cached.
TEST_F(HttpCacheRangeGetTest, ConnectedCallbackCalledForEachRangeWithPrefix) {}

// Tests that a range transaction is still usable even if it's unable to access
// the cache.
TEST_F(HttpCacheRangeGetTest, FailedCacheAccess) {}

// Tests that we can have parallel validation on range requests.
TEST_F(HttpCacheRangeGetTest, ParallelValidationNoMatch) {}

// Tests that if a transaction is dooming the entry and the entry was doomed by
// another transaction that was not part of the entry and created a new entry,
// the new entry should not be incorrectly doomed. (crbug.com/736993)
TEST_F(HttpCacheRangeGetTest, ParallelValidationNoMatchDoomEntry) {}

// Same as above but tests that the 2nd transaction does not do anything if
// there is nothing to doom. (crbug.com/736993)
TEST_F(HttpCacheRangeGetTest, ParallelValidationNoMatchDoomEntry1) {}

// Tests parallel validation on range requests with non-overlapping ranges.
TEST_F(HttpCacheRangeGetTest, ParallelValidationDifferentRanges) {}

// Tests that a request does not create Writers when readers is not empty.
TEST_F(HttpCacheRangeGetTest, DoNotCreateWritersWhenReaderExists) {}

// Tests parallel validation on range requests can be successfully restarted
// when there is a cache lock timeout.
TEST_F(HttpCacheRangeGetTest, ParallelValidationCacheLockTimeout) {}

// Tests a full request and a simultaneous range request and the range request
// dooms the entry created by the full request due to not being able to
// conditionalize.
TEST_F(HttpCacheRangeGetTest, ParallelValidationCouldntConditionalize) {}

// Tests a 200 request and a simultaneous range request where conditionalization
// is possible.
TEST_F(HttpCacheRangeGetTest, ParallelValidationCouldConditionalize) {}

// Tests parallel validation on range requests with overlapping ranges.
TEST_F(HttpCacheRangeGetTest, ParallelValidationOverlappingRanges) {}

// Tests parallel validation on range requests with overlapping ranges and the
// impact of deleting the writer on transactions that have validated.
TEST_F(HttpCacheRangeGetTest, ParallelValidationRestartDoneHeaders) {}

// A test of doing a range request to a cached 301 response
TEST_F(HttpCacheRangeGetTest, CachedRedirect) {}

// A transaction that fails to validate an entry, while attempting to write
// the response, should still get data to its consumer even if the attempt to
// create a new entry fails.
TEST_F(HttpCacheSimpleGetTest, ValidationFailureWithCreateFailure) {}

// Parallel validation results in 200.
TEST_F(HttpCacheSimpleGetTest, ParallelValidationNoMatch) {}

TEST_F(HttpCacheRangeGetTest, Enormous) {}

// Parallel validation results in 200 for 1 transaction and validation matches
// for subsequent transactions.
TEST_F(HttpCacheSimpleGetTest, ParallelValidationNoMatch1) {}

// Tests that a GET followed by a DELETE results in DELETE immediately starting
// the headers phase and the entry is doomed.
TEST_F(HttpCacheSimpleGetTest, ParallelValidationDelete) {}

// Tests that a transaction which is in validated queue can be destroyed without
// any impact to other transactions.
TEST_F(HttpCacheSimpleGetTest, ParallelValidationCancelValidated) {}

// Tests that an idle writer transaction can be deleted without impacting the
// existing writers.
TEST_F(HttpCacheSimpleGetTest, ParallelWritingCancelIdleTransaction) {}

// Tests that a transaction which is in validated queue can timeout and start
// the headers phase again.
TEST_F(HttpCacheSimpleGetTest, ParallelValidationValidatedTimeout) {}

// Tests that a transaction which is in readers can be destroyed without
// any impact to other transactions.
TEST_F(HttpCacheSimpleGetTest, ParallelValidationCancelReader) {}

// Tests that when the only writer goes away, it immediately cleans up rather
// than wait for the network request to finish. See https://crbug.com/804868.
TEST_F(HttpCacheSimpleGetTest, HangingCacheWriteCleanup) {}

// Tests that a transaction writer can be destroyed mid-read.
// A waiting for read transaction should be able to read the data that was
// driven by the Read started by the cancelled writer.
TEST_F(HttpCacheSimpleGetTest, ParallelWritingCancelWriter) {}

// Tests the case when network read failure happens. Idle and waiting
// transactions should fail and headers transaction should be restarted.
TEST_F(HttpCacheSimpleGetTest, ParallelWritingNetworkReadFailed) {}

// Tests the case when cache write failure happens. Idle and waiting
// transactions should fail and headers transaction should be restarted.
TEST_F(HttpCacheSimpleGetTest, ParallelWritingCacheWriteFailed) {}

HttpCacheSimplePostTest;

// Tests that POST requests do not join existing transactions for parallel
// writing to the cache. Note that two POSTs only map to the same entry if their
// upload data identifier is same and that should happen for back-forward case
// (LOAD_ONLY_FROM_CACHE). But this test tests without LOAD_ONLY_FROM_CACHE
// because read-only transactions anyways do not join parallel writing.
// TODO(shivanisha) Testing this because it is allowed by the code but looks
// like the code should disallow two POSTs without LOAD_ONLY_FROM_CACHE with the
// same upload data identifier to map to the same entry.
TEST_F(HttpCacheSimplePostTest, ParallelWritingDisallowed) {}

// Tests the case when parallel writing succeeds. Tests both idle and waiting
// transactions.
TEST_F(HttpCacheSimpleGetTest, ParallelWritingSuccess) {}

// Tests the case when parallel writing involves things bigger than what cache
// can store. In this case, the best we can do is re-fetch it.
TEST_F(HttpCacheSimpleGetTest, ParallelWritingHuge) {}

// Tests that network transaction's info is saved correctly when a writer
// transaction that created the network transaction becomes a reader. Also
// verifies that the network bytes are only attributed to the transaction that
// created the network transaction.
TEST_F(HttpCacheSimpleGetTest, ParallelWritingVerifyNetworkBytes) {}

// Tests than extra Read from the consumer should not hang/crash the browser.
TEST_F(HttpCacheSimpleGetTest, ExtraRead) {}

// Tests when a writer is destroyed mid-read, all the other writer transactions
// can continue writing to the entry.
TEST_F(HttpCacheSimpleGetTest, ParallelValidationCancelWriter) {}

// Tests that when StopCaching is invoked on a writer, dependent transactions
// are restarted.
TEST_F(HttpCacheSimpleGetTest, ParallelValidationStopCaching) {}

// Tests that when StopCaching is invoked on a writer transaction, it is a
// no-op if there are other writer transactions.
TEST_F(HttpCacheSimpleGetTest, ParallelWritersStopCachingNoOp) {}

// Tests that a transaction is currently in headers phase and is destroyed
// leading to destroying the entry.
TEST_F(HttpCacheSimpleGetTest, ParallelValidationCancelHeaders) {}

// Similar to the above test, except here cache write fails and the
// validated transactions should be restarted.
TEST_F(HttpCacheSimpleGetTest, ParallelWritersFailWrite) {}

// This is a test for http://code.google.com/p/chromium/issues/detail?id=4769.
// If cancelling a request is racing with another request for the same resource
// finishing, we have to make sure that we remove both transactions from the
// entry.
TEST_F(HttpCacheSimpleGetTest, RacingReaders) {}

// Tests that we can doom an entry with pending transactions and delete one of
// the pending transactions before the first one completes.
// See http://code.google.com/p/chromium/issues/detail?id=25588
TEST_F(HttpCacheSimpleGetTest, DoomWithPending) {}

TEST_F(HttpCacheTest, DoomDoesNotSetHints) {}

// This is a test for http://code.google.com/p/chromium/issues/detail?id=4731.
// We may attempt to delete an entry synchronously with the act of adding a new
// transaction to said entry.
TEST_F(HttpCacheTest, FastNoStoreGetDoneWithPending) {}

TEST_F(HttpCacheSimpleGetTest, ManyWritersCancelFirst) {}

// Tests that we can cancel requests that are queued waiting to open the disk
// cache entry.
TEST_F(HttpCacheSimpleGetTest, ManyWritersCancelCreate) {}

// Tests that we can cancel a single request to open a disk cache entry.
TEST_F(HttpCacheSimpleGetTest, CancelCreate) {}

// Tests that we delete/create entries even if multiple requests are queued.
TEST_F(HttpCacheSimpleGetTest, ManyWritersBypassCache) {}

// Tests that a (simulated) timeout allows transactions waiting on the cache
// lock to continue.
TEST_F(HttpCacheSimpleGetTest, WriterTimeout) {}

// Tests that a (simulated) timeout allows transactions waiting on the cache
// lock to continue but read only transactions to error out.
TEST_F(HttpCacheSimpleGetTest, WriterTimeoutReadOnlyError) {}

TEST_F(HttpCacheSimpleGetTest, AbandonedCacheRead) {}

// Tests that we can delete the HttpCache and deal with queued transactions
// ("waiting for the backend" as opposed to Active or Doomed entries).
TEST_F(HttpCacheSimpleGetTest, ManyWritersDeleteCache) {}

// Tests that we queue requests when initializing the backend.
TEST_F(HttpCacheSimpleGetTest, WaitForBackend) {}

// Tests that we can cancel requests that are queued waiting for the backend
// to be initialized.
TEST_F(HttpCacheSimpleGetTest, WaitForBackend_CancelCreate) {}

// Tests that we can delete the HttpCache while creating the backend.
TEST_F(HttpCacheTest, DeleteCacheWaitingForBackend) {}

// Tests that we can delete the cache while creating the backend, from within
// one of the callbacks.
TEST_F(HttpCacheTest, DeleteCacheWaitingForBackend2) {}

TEST_F(HttpCacheTest, TypicalGetConditionalRequest) {}

static const auto kETagGetConditionalRequestHandler =;

HttpCacheETagGetTest;

TEST_F(HttpCacheETagGetTest, ConditionalRequest304) {}

class RevalidationServer {};

HttpCacheGetTest;

// Tests revalidation after a vary match.
TEST_F(HttpCacheGetTest, ValidateCacheVaryMatch) {}

// Tests revalidation after a vary mismatch if etag is present.
TEST_F(HttpCacheGetTest, ValidateCacheVaryMismatch) {}

// Tests revalidation after a vary mismatch due to vary: * if etag is present.
TEST_F(HttpCacheGetTest, ValidateCacheVaryMismatchStar) {}

// Tests lack of revalidation after a vary mismatch and no etag.
TEST_F(HttpCacheGetTest, DontValidateCacheVaryMismatch) {}

// Tests that a new vary header provided when revalidating an entry is saved.
TEST_F(HttpCacheGetTest, ValidateCacheVaryMatchUpdateVary) {}

// Tests that new request headers causing a vary mismatch are paired with the
// new response when the server says the old response can be used.
TEST_F(HttpCacheGetTest, ValidateCacheVaryMismatchUpdateRequestHeader) {}

// Tests that a 304 without vary headers doesn't delete the previously stored
// vary data after a vary match revalidation.
TEST_F(HttpCacheGetTest, ValidateCacheVaryMatchDontDeleteVary) {}

// Tests that a 304 without vary headers doesn't delete the previously stored
// vary data after a vary mismatch.
TEST_F(HttpCacheGetTest, ValidateCacheVaryMismatchDontDeleteVary) {}

static void ETagGet_UnconditionalRequest_Handler(const HttpRequestInfo* request,
                                                 std::string* response_status,
                                                 std::string* response_headers,
                                                 std::string* response_data) {}

TEST_F(HttpCacheETagGetTest, Http10) {}

TEST_F(HttpCacheETagGetTest, Http10Range) {}

static void ETagGet_ConditionalRequest_NoStore_Handler(
    const HttpRequestInfo* request,
    std::string* response_status,
    std::string* response_headers,
    std::string* response_data) {}

TEST_F(HttpCacheETagGetTest, ConditionalRequest304NoStore) {}

// Helper that does 4 requests using HttpCache:
//
// (1) loads |kUrl| -- expects |net_response_1| to be returned.
// (2) loads |kUrl| from cache only -- expects |net_response_1| to be returned.
// (3) loads |kUrl| using |extra_request_headers| -- expects |net_response_2| to
//     be returned.
// (4) loads |kUrl| from cache only -- expects |cached_response_2| to be
//     returned.
// The entry will be created once and will be opened for the 3 subsequent
// requests.
static void ConditionalizedRequestUpdatesCacheHelper(
    const Response& net_response_1,
    const Response& net_response_2,
    const Response& cached_response_2,
    const char* extra_request_headers) {}

// Check that when an "if-modified-since" header is attached
// to the request, the result still updates the cached entry.
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache1) {}

// Check that when an "if-none-match" header is attached
// to the request, the result updates the cached entry.
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache2) {}

// Check that when an "if-modified-since" header is attached
// to a request, the 304 (not modified result) result updates the cached
// headers, and the 304 response is returned rather than the cached response.
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache3) {}

// Test that when doing an externally conditionalized if-modified-since
// and there is no corresponding cache entry, a new cache entry is NOT
// created (304 response).
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache4) {}

// Test that when doing an externally conditionalized if-modified-since
// and there is no corresponding cache entry, a new cache entry is NOT
// created (200 response).
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache5) {}

// Test that when doing an externally conditionalized if-modified-since
// if the date does not match the cache entry's last-modified date,
// then we do NOT use the response (304) to update the cache.
// (the if-modified-since date is 2 days AFTER the cache's modification date).
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache6) {}

// Test that when doing an externally conditionalized if-none-match
// if the etag does not match the cache entry's etag, then we do not use the
// response (304) to update the cache.
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache7) {}

// Test that doing an externally conditionalized request with both if-none-match
// and if-modified-since updates the cache.
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache8) {}

// Test that doing an externally conditionalized request with both if-none-match
// and if-modified-since does not update the cache with only one match.
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache9) {}

// Test that doing an externally conditionalized request with both if-none-match
// and if-modified-since does not update the cache with only one match.
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache10) {}

TEST_F(HttpCacheTest, UrlContainingHash) {}

// Tests that we skip the cache for POST requests that do not have an upload
// identifier.
TEST_F(HttpCacheSimplePostTest, SkipsCache) {}

// Tests POST handling with a disabled cache (no DCHECK).
TEST_F(HttpCacheSimplePostTest, DisabledCache) {}

TEST_F(HttpCacheSimplePostTest, LoadOnlyFromCacheMiss) {}

HttpCacheSimplePostTest;

TEST_F(HttpCacheSimplePostTest, LoadOnlyFromCacheHit) {}

// Test that we don't hit the cache for POST requests if there is a byte range.
TEST_F(HttpCacheSimplePostTest, WithRanges) {}

// Tests that a POST is cached separately from a GET.
TEST_F(HttpCacheSimplePostTest, SeparateCache) {}

// Tests that a successful POST invalidates a previously cached GET.
TEST_F(HttpCacheSimplePostTest, Invalidate205) {}

// Tests that a successful POST invalidates a previously cached GET,
// with cache split by top-frame origin.
TEST_F(HttpCacheTestSplitCacheFeatureEnabled,
       SimplePostInvalidate205SplitCache) {}

// Tests that a successful POST invalidates a previously cached GET, even when
// there is no upload identifier.
TEST_F(HttpCacheSimplePostTest, NoUploadIdInvalidate205) {}

// Tests that processing a POST before creating the backend doesn't crash.
TEST_F(HttpCacheSimplePostTest, NoUploadIdNoBackend) {}

// Tests that we don't invalidate entries as a result of a failed POST.
TEST_F(HttpCacheSimplePostTest, DontInvalidate100) {}

HttpCacheSimpleHeadTest;

// Tests that a HEAD request is not cached by itself.
TEST_F(HttpCacheSimpleHeadTest, LoadOnlyFromCacheMiss) {}

// Tests that a HEAD request is served from a cached GET.
TEST_F(HttpCacheSimpleHeadTest, LoadOnlyFromCacheHit) {}

// Tests that a read-only request served from the cache preserves CL.
TEST_F(HttpCacheSimpleHeadTest, ContentLengthOnHitRead) {}

// Tests that a read-write request served from the cache preserves CL.
TEST_F(HttpCacheTest, ETagHeadContentLengthOnHitReadWrite) {}

// Tests that a HEAD request that includes byte ranges bypasses the cache.
TEST_F(HttpCacheSimpleHeadTest, WithRanges) {}

// Tests that a HEAD request can be served from a partially cached resource.
TEST_F(HttpCacheSimpleHeadTest, WithCachedRanges) {}

// Tests that a HEAD request can be served from a truncated resource.
TEST_F(HttpCacheSimpleHeadTest, WithTruncatedEntry) {}

HttpCacheTypicalHeadTest;

// Tests that a HEAD request updates the cached response.
TEST_F(HttpCacheTypicalHeadTest, UpdatesResponse) {}

// Tests that an externally conditionalized HEAD request updates the cache.
TEST_F(HttpCacheTypicalHeadTest, ConditionalizedRequestUpdatesResponse) {}

// Tests that a HEAD request invalidates an old cached entry.
TEST_F(HttpCacheSimpleHeadTest, InvalidatesEntry) {}

HttpCacheSimplePutTest;

// Tests that we do not cache the response of a PUT.
TEST_F(HttpCacheSimplePutTest, Miss) {}

// Tests that we invalidate entries as a result of a PUT.
TEST_F(HttpCacheSimplePutTest, Invalidate) {}

// Tests that we invalidate entries as a result of a PUT.
TEST_F(HttpCacheSimplePutTest, Invalidate305) {}

// Tests that we don't invalidate entries as a result of a failed PUT.
TEST_F(HttpCacheSimplePutTest, DontInvalidate404) {}

HttpCacheSimpleDeleteTest;

// Tests that we do not cache the response of a DELETE.
TEST_F(HttpCacheSimpleDeleteTest, Miss) {}

// Tests that we invalidate entries as a result of a DELETE.
TEST_F(HttpCacheSimpleDeleteTest, Invalidate) {}

// Tests that we invalidate entries as a result of a DELETE.
TEST_F(HttpCacheSimpleDeleteTest, Invalidate301) {}

// Tests that we don't invalidate entries as a result of a failed DELETE.
TEST_F(HttpCacheSimpleDeleteTest, DontInvalidate416) {}

HttpCacheSimplePatchTest;

// Tests that we invalidate entries as a result of a PATCH.
TEST_F(HttpCacheSimplePatchTest, Invalidate) {}

// Tests that we invalidate entries as a result of a PATCH.
TEST_F(HttpCacheSimplePatchTest, Invalidate301) {}

// Tests that we don't invalidate entries as a result of a failed PATCH.
TEST_F(HttpCacheSimplePatchTest, DontInvalidate416) {}

// Tests that we don't invalidate entries after a failed network transaction.
TEST_F(HttpCacheSimpleGetTest, DontInvalidateOnFailure) {}

TEST_F(HttpCacheRangeGetTest, SkipsCache) {}

// Test that we skip the cache for range requests that include a validation
// header.
TEST_F(HttpCacheRangeGetTest, SkipsCache2) {}

TEST_F(HttpCacheSimpleGetTest, DoesntLogHeaders) {}

TEST_F(HttpCacheRangeGetTest, LogsHeaders) {}

TEST_F(HttpCacheTest, ExternalValidationLogsHeaders) {}

TEST_F(HttpCacheTest, SpecialHeadersLogsHeaders) {}

// Tests that receiving 206 for a regular request is handled correctly.
TEST_F(HttpCacheGetTest, Crazy206) {}

// Tests that receiving 416 for a regular request is handled correctly.
TEST_F(HttpCacheGetTest, Crazy416) {}

// Tests that we don't store partial responses that can't be validated.
TEST_F(HttpCacheRangeGetTest, NoStrongValidators) {}

// Tests failures to conditionalize byte range requests.
TEST_F(HttpCacheRangeGetTest, NoConditionalization) {}

// Tests that restarting a partial request when the cached data cannot be
// revalidated logs an event.
TEST_F(HttpCacheRangeGetTest, NoValidationLogsRestart) {}

// Tests that a failure to conditionalize a regular request (no range) with a
// sparse entry results in a full response.
TEST_F(HttpCacheGetTest, NoConditionalization) {}

// Verifies that conditionalization failures when asking for a range that would
// require the cache to modify the range to ask, result in a network request
// that matches the user's one.
TEST_F(HttpCacheRangeGetTest, NoConditionalization2) {}

// Tests that we cache partial responses that lack content-length.
TEST_F(HttpCacheRangeGetTest, NoContentLength) {}

// Tests that we can cache range requests and fetch random blocks from the
// cache and the network.
TEST_F(HttpCacheRangeGetTest, OK) {}

TEST_F(HttpCacheRangeGetTest, CacheReadError) {}

// Tests that range requests with no-store get correct content-length
// (https://crbug.com/700197).
TEST_F(HttpCacheRangeGetTest, NoStore) {}

// Tests a 304 setting no-store on existing 206 entry.
TEST_F(HttpCacheRangeGetTest, NoStore304) {}

// Tests that we can cache range requests and fetch random blocks from the
// cache and the network, with synchronous responses.
TEST_F(HttpCacheRangeGetTest, SyncOK) {}

// Tests that if the previous transaction is cancelled while busy (doing sparse
// IO), a new transaction (that reuses that same ActiveEntry) waits until the
// entry is ready again.
TEST_F(HttpCacheTest, SparseWaitForEntry) {}

// Tests that we don't revalidate an entry unless we are required to do so.
TEST_F(HttpCacheRangeGetTest, Revalidate1) {}

// Checks that we revalidate an entry when the headers say so.
TEST_F(HttpCacheRangeGetTest, Revalidate2) {}

// Tests that we deal with 304s for range requests.
TEST_F(HttpCacheRangeGetTest, 304) {}

// Tests that we deal with 206s when revalidating range requests.
TEST_F(HttpCacheRangeGetTest, ModifiedResult) {}

// Tests that when a server returns 206 with a sub-range of the requested range,
// and there is nothing stored in the cache, the returned response is passed to
// the caller as is. In this context, a subrange means a response that starts
// with the same byte that was requested, but that is not the whole range that
// was requested.
TEST_F(HttpCacheRangeGetTest, 206ReturnsSubrangeRangeNoCachedContent) {}

// Tests that when a server returns 206 with a sub-range of the requested range,
// and there was an entry stored in the cache, the cache gets out of the way.
TEST_F(HttpCacheRangeGetTest, 206ReturnsSubrangeRangeCachedContent) {}

// Tests that when a server returns 206 with a sub-range of the requested range,
// and there was an entry stored in the cache, the cache gets out of the way,
// when the caller is not using ranges.
TEST_F(HttpCacheGetTest, 206ReturnsSubrangeRangeCachedContent) {}

// Tests that when a server returns 206 with a random range and there is
// nothing stored in the cache, the returned response is passed to the caller
// as is. In this context, a WrongRange means that the returned range may or may
// not have any relationship with the requested range (may or may not be
// contained). The important part is that the first byte doesn't match the first
// requested byte.
TEST_F(HttpCacheRangeGetTest, 206ReturnsWrongRangeNoCachedContent) {}

// Tests that when a server returns 206 with a random range and there is
// an entry stored in the cache, the cache gets out of the way.
TEST_F(HttpCacheRangeGetTest, 206ReturnsWrongRangeCachedContent) {}

// Tests that when a caller asks for a range beyond EOF, with an empty cache,
// the response matches the one provided by the server.
TEST_F(HttpCacheRangeGetTest, 206ReturnsSmallerFileNoCachedContent) {}

// Tests that when a caller asks for a range beyond EOF, with a cached entry,
// the cache automatically fixes the request.
TEST_F(HttpCacheRangeGetTest, 206ReturnsSmallerFileCachedContent) {}

// Tests that when a caller asks for a not-satisfiable range, the server's
// response is forwarded to the caller.
TEST_F(HttpCacheRangeGetTest, 416NoCachedContent) {}

// Tests that we cache 301s for range requests.
TEST_F(HttpCacheRangeGetTest, MovedPermanently301) {}

HttpCacheUnknownRangeGetTest;

// Tests that we can cache range requests when the start or end is unknown.
// We start with one suffix request, followed by a request from a given point.
TEST_F(HttpCacheUnknownRangeGetTest, SuffixRangeThenIntRange) {}

// Tests that we can cache range requests when the start or end is unknown.
// We start with one request from a given point, followed by a suffix request.
// We'll also verify that synchronous cache responses work as intended.
TEST_F(HttpCacheUnknownRangeGetTest, IntRangeThenSuffixRange) {}

// Similar to UnknownRangeGET_2, except that the resource size is empty.
// Regression test for crbug.com/813061, and probably https://crbug.com/1375128
TEST_F(HttpCacheUnknownRangeGetTest, SuffixRangeEmptyResponse) {}

// Testcase for https://crbug.com/1433305, validation of range request to a
// cache 302, which is notably bodiless.
TEST_F(HttpCacheUnknownRangeGetTest, Empty302) {}

// Testcase for https://crbug.com/1433305, validation of range request to a
// cache 302, which is notably bodiless, where the 302 is replaced with an
// actual body.
TEST_F(HttpCacheUnknownRangeGetTest, Empty302Replaced) {}

// Tests that receiving Not Modified when asking for an open range doesn't mess
// up things.
TEST_F(HttpCacheUnknownRangeGetTest, Basic304) {}

// Tests that we can handle non-range requests when we have cached a range.
TEST_F(HttpCacheGetTest, Previous206) {}

// Tests that we can handle non-range requests when we have cached the first
// part of the object and the server replies with 304 (Not Modified).
TEST_F(HttpCacheGetTest, Previous206NotModified) {}

// Tests that we can handle a regular request to a sparse entry, that results in
// new content provided by the server (206).
TEST_F(HttpCacheGetTest, Previous206NewContent) {}

// Tests that we can handle cached 206 responses that are not sparse.
TEST_F(HttpCacheGetTest, Previous206NotSparse) {}

// Tests that we can handle cached 206 responses that are not sparse. This time
// we issue a range request and expect to receive a range.
TEST_F(HttpCacheRangeGetTest, Previous206NotSparser2) {}

// Tests that we can handle cached 206 responses that can't be validated.
TEST_F(HttpCacheGetTest, Previous206NotValidation) {}

// Tests that we can handle range requests with cached 200 responses.
TEST_F(HttpCacheRangeGetTest, Previous200) {}

// Tests that we can handle a 200 response when dealing with sparse entries.
TEST_F(HttpCacheTest, RangeRequestResultsIn200) {}

// Tests that a range request that falls outside of the size that we know about
// only deletes the entry if the resource has indeed changed.
TEST_F(HttpCacheRangeGetTest, MoreThanCurrentSize) {}

// Tests that we don't delete a sparse entry when we cancel a request.
TEST_F(HttpCacheRangeGetTest, Cancel) {}

// Tests that we don't mark an entry as truncated if it is partial and not
// already truncated.
TEST_F(HttpCacheRangeGetTest, CancelWhileReading) {}

// Tests that we don't delete a sparse entry when we start a new request after
// cancelling the previous one.
TEST_F(HttpCacheRangeGetTest, Cancel2) {}

// A slight variation of the previous test, this time we cancel two requests in
// a row, making sure that the second is waiting for the entry to be ready.
TEST_F(HttpCacheRangeGetTest, Cancel3) {}

// Tests that an invalid range response results in no cached entry.
TEST_F(HttpCacheRangeGetTest, InvalidResponse1) {}

// Tests that we reject a range that doesn't match the content-length.
TEST_F(HttpCacheRangeGetTest, InvalidResponse2) {}

// Tests that if a server tells us conflicting information about a resource we
// drop the entry.
TEST_F(HttpCacheRangeGetTest, InvalidResponse3) {}

// Tests that we handle large range values properly.
TEST_F(HttpCacheRangeGetTest, LargeValues) {}

// Tests that we don't crash with a range request if the disk cache was not
// initialized properly.
TEST_F(HttpCacheRangeGetTest, NoDiskCache) {}

// Tests that we handle byte range requests that skip the cache.
TEST_F(HttpCacheTest, RangeHead) {}

// Tests that we don't crash when after reading from the cache we issue a
// request for the next range and the server gives us a 200 synchronously.
TEST_F(HttpCacheRangeGetTest, FastFlakyServer) {}

// Tests that when the server gives us less data than expected, we don't keep
// asking for more data.
TEST_F(HttpCacheRangeGetTest, FastFlakyServer2) {}

TEST_F(HttpCacheRangeGetTest, OkLoadOnlyFromCache) {}

// Tests the handling of the "truncation" flag.
TEST_F(HttpCacheTest, WriteResponseInfoTruncated) {}

// Tests basic pickling/unpickling of HttpResponseInfo.
TEST_F(HttpCacheTest, PersistHttpResponseInfo) {}

// Tests that we delete an entry when the request is cancelled before starting
// to read from the network.
TEST_F(HttpCacheTest, DoomOnDestruction) {}

// Tests that we delete an entry when the request is cancelled if the response
// does not have content-length and strong validators.
TEST_F(HttpCacheTest, DoomOnDestruction2) {}

// Tests that we delete an entry when the request is cancelled if the response
// has an "Accept-Ranges: none" header.
TEST_F(HttpCacheTest, DoomOnDestruction3) {}

// Tests that we mark an entry as incomplete when the request is cancelled.
TEST_F(HttpCacheTest, SetTruncatedFlag) {}

// Tests that we do not mark an entry as truncated when the request is
// cancelled.
TEST_F(HttpCacheTest, DontSetTruncatedFlagForGarbledResponseCode) {}

// Tests that we don't mark an entry as truncated when we read everything.
TEST_F(HttpCacheTest, DontSetTruncatedFlag) {}

// Tests that sparse entries don't set the truncate flag.
TEST_F(HttpCacheRangeGetTest, DontTruncate) {}

// Tests that sparse entries don't set the truncate flag (when the byte range
//  starts after 0).
TEST_F(HttpCacheRangeGetTest, DontTruncate2) {}

// Tests that we can continue with a request that was interrupted.
TEST_F(HttpCacheGetTest, IncompleteResource) {}

// Tests the handling of no-store when revalidating a truncated entry.
TEST_F(HttpCacheGetTest, IncompleteResourceNoStore) {}

// Tests cancelling a request after the server sent no-store.
TEST_F(HttpCacheGetTest, IncompleteResourceCancel) {}

// Tests that we delete truncated entries if the server changes its mind midway.
TEST_F(HttpCacheGetTest, IncompleteResource2) {}

// Tests that we always validate a truncated request.
TEST_F(HttpCacheGetTest, IncompleteResource3) {}

// Tests that we handle 401s for truncated resources.
TEST_F(HttpCacheGetTest, IncompleteResourceWithAuth) {}

// Test that the transaction won't retry failed partial requests
// after it starts reading data.  http://crbug.com/474835
TEST_F(HttpCacheTest, TransactionRetryLimit) {}

// Tests that we cache a 200 response to the validation request.
TEST_F(HttpCacheGetTest, IncompleteResource4) {}

// Tests that when we cancel a request that was interrupted, we mark it again
// as truncated.
TEST_F(HttpCacheGetTest, CancelIncompleteResource) {}

// Tests that we can handle range requests when we have a truncated entry.
TEST_F(HttpCacheRangeGetTest, IncompleteResource) {}

TEST_F(HttpCacheTest, SyncRead) {}

TEST_F(HttpCacheTest, ValidationResultsIn200) {}

TEST_F(HttpCacheTest, CachedRedirect) {}

// Verify that no-cache resources are stored in cache, but are not fetched from
// cache during normal loads.
TEST_F(HttpCacheTest, CacheControlNoCacheNormalLoad) {}

// Verify that no-cache resources are stored in cache and fetched from cache
// when the LOAD_SKIP_CACHE_VALIDATION flag is set.
TEST_F(HttpCacheTest, CacheControlNoCacheHistoryLoad) {}

TEST_F(HttpCacheTest, CacheControlNoStore) {}

TEST_F(HttpCacheTest, CacheControlNoStore2) {}

TEST_F(HttpCacheTest, CacheControlNoStore3) {}

// Ensure that we don't cache requests served over bad HTTPS.
TEST_F(HttpCacheSimpleGetTest, SSLError) {}

// Ensure that we don't crash by if left-behind transactions.
TEST_F(HttpCacheTest, OutlivedTransactions) {}

// Test that the disabled mode works.
TEST_F(HttpCacheTest, CacheDisabledMode) {}

// Other tests check that the response headers of the cached response
// get updated on 304. Here we specifically check that the
// HttpResponseHeaders::request_time and HttpResponseHeaders::response_time
// fields also gets updated.
// http://crbug.com/20594.
TEST_F(HttpCacheTest, UpdatesRequestResponseTimeOn304) {}

TEST_F(HttpCacheTestSplitCacheFeatureEnabled,
       SplitCacheWithNetworkIsolationKey) {}

TEST_F(HttpCacheTest, HttpCacheProfileThirdPartyCSS) {}

TEST_F(HttpCacheTest, HttpCacheProfileThirdPartyJavaScript) {}

TEST_F(HttpCacheTest, HttpCacheProfileThirdPartyFont) {}

TEST_P(HttpCacheTestSplitCacheFeature, SplitCache) {}

TEST_P(HttpCacheTestSplitCacheFeature, GenerateCacheKeyForRequestFailures) {}
TEST_F(HttpCacheTest, SplitCacheEnabledByDefault) {}

TEST_F(HttpCacheTest, SplitCacheEnabledByDefaultButOverridden) {}

TEST_F(HttpCacheTestSplitCacheFeatureEnabled, SplitCacheUsesRegistrableDomain) {}

TEST_F(HttpCacheTest, NonSplitCache) {}

TEST_F(HttpCacheTest, SkipVaryCheck) {}

TEST_F(HttpCacheTest, SkipVaryCheckStar) {}

// Tests that we only return valid entries with LOAD_ONLY_FROM_CACHE
// transactions unless LOAD_SKIP_CACHE_VALIDATION is set.
TEST_F(HttpCacheTest, ValidLoadOnlyFromCache) {}

TEST_F(HttpCacheTest, InvalidLoadFlagCombination) {}

// Tests that we don't mark entries as truncated when a filter detects the end
// of the stream.
TEST_F(HttpCacheTest, FilterCompletion) {}

// Tests that we don't mark entries as truncated and release the cache
// entry when DoneReading() is called before any Read() calls, such as
// for a redirect.
TEST_F(HttpCacheTest, DoneReading) {}

// Tests that we stop caching when told.
TEST_F(HttpCacheTest, StopCachingDeletesEntry) {}

// Tests that we stop caching when told, even if DoneReading is called
// after StopCaching.
TEST_F(HttpCacheTest, StopCachingThenDoneReadingDeletesEntry) {}

// Tests that we stop caching when told, when using auth.
TEST_F(HttpCacheTest, StopCachingWithAuthDeletesEntry) {}

// Tests that when we are told to stop caching we don't throw away valid data.
TEST_F(HttpCacheTest, StopCachingSavesEntry) {}

// Tests that we handle truncated enries when StopCaching is called.
TEST_F(HttpCacheTest, StopCachingTruncatedEntry) {}

namespace {

enum class TransactionPhase {};

CacheInitializer;
HugeCacheTestConfiguration;

class HttpCacheHugeResourceTest
    : public ::testing::TestWithParam<HugeCacheTestConfiguration>,
      public WithTaskEnvironment {};

const int64_t HttpCacheHugeResourceTest::kTotalSize;

// static
void HttpCacheHugeResourceTest::LargeResourceTransactionHandler(
    const HttpRequestInfo* request,
    std::string* response_status,
    std::string* response_headers,
    std::string* response_data) {}

// static
int HttpCacheHugeResourceTest::LargeBufferReader(int64_t content_length,
                                                 int64_t offset,
                                                 IOBuffer* buf,
                                                 int buf_len) {}

// static
void HttpCacheHugeResourceTest::SetFlagOnBeforeNetworkStart(bool* started,
                                                            bool* /* defer */) {}

// static
void HttpCacheHugeResourceTest::SetupTruncatedCacheEntry(MockHttpCache* cache) {}

// static
void HttpCacheHugeResourceTest::SetupPrefixSparseCacheEntry(
    MockHttpCache* cache) {}

// static
void HttpCacheHugeResourceTest::SetupInfixSparseCacheEntry(
    MockHttpCache* cache) {}

// static
std::list<HugeCacheTestConfiguration>
HttpCacheHugeResourceTest::GetTestModes() {}

// static
std::list<HugeCacheTestConfiguration> HttpCacheHugeResourceTest::kTestModes =;

INSTANTIATE_TEST_SUITE_P();

}  // namespace

// Test what happens when StopCaching() is called while reading a huge resource
// fetched via GET. Various combinations of cache state and when StopCaching()
// is called is controlled by the parameter passed into the test via the
// INSTANTIATE_TEST_SUITE_P invocation above.
TEST_P(HttpCacheHugeResourceTest,
       StopCachingFollowedByReadForHugeTruncatedResource) {}

// Tests that we detect truncated resources from the net when there is
// a Content-Length header.
TEST_F(HttpCacheTest, TruncatedByContentLength) {}

// Tests that we actually flag entries as truncated when we detect an error
// from the net.
TEST_F(HttpCacheTest, TruncatedByContentLength2) {}

// Make sure that calling SetPriority on a cache transaction passes on
// its priority updates to its underlying network transaction.
TEST_F(HttpCacheTest, SetPriority) {}

// Make sure that calling SetWebSocketHandshakeStreamCreateHelper on a cache
// transaction passes on its argument to the underlying network transaction.
TEST_F(HttpCacheTest, SetWebSocketHandshakeStreamCreateHelper) {}

// Make sure that a cache transaction passes on its priority to
// newly-created network transactions.
TEST_F(HttpCacheTest, SetPriorityNewTransaction) {}

namespace {

void RunTransactionAndGetNetworkBytes(MockHttpCache* cache,
                                      const MockTransaction& trans_info,
                                      int64_t* sent_bytes,
                                      int64_t* received_bytes) {}

}  // namespace

TEST_F(HttpCacheTest, NetworkBytesCacheMissAndThenHit) {}

TEST_F(HttpCacheTest, NetworkBytesConditionalRequest304) {}

TEST_F(HttpCacheTest, NetworkBytesConditionalRequest200) {}

TEST_F(HttpCacheTest, NetworkBytesRange) {}

class HttpCachePrefetchValidationTest : public TestWithTaskEnvironment {};

TEST_F(HttpCachePrefetchValidationTest, SkipValidationShortlyAfterPrefetch) {}

TEST_F(HttpCachePrefetchValidationTest, ValidateLongAfterPrefetch) {}

TEST_F(HttpCachePrefetchValidationTest, SkipValidationOnceOnly) {}

TEST_F(HttpCachePrefetchValidationTest, SkipValidationOnceReadOnly) {}

TEST_F(HttpCachePrefetchValidationTest, BypassCacheOverwritesPrefetch) {}

TEST_F(HttpCachePrefetchValidationTest,
       SkipValidationOnExistingEntryThatNeedsValidation) {}

TEST_F(HttpCachePrefetchValidationTest,
       SkipValidationOnExistingEntryThatDoesNotNeedValidation) {}

TEST_F(HttpCachePrefetchValidationTest, PrefetchMultipleTimes) {}

TEST_F(HttpCachePrefetchValidationTest, ValidateOnDelayedSecondPrefetch) {}

TEST_F(HttpCacheTest, StaleContentNotUsedWhenLoadFlagNotSet) {}

TEST_F(HttpCacheTest, StaleContentUsedWhenLoadFlagSetAndUsableThenTimesout) {}

TEST_F(HttpCacheTest, StaleContentUsedWhenLoadFlagSetAndUsable) {}

TEST_F(HttpCacheTest, StaleContentNotUsedWhenUnusable) {}

TEST_F(HttpCacheTest, StaleContentWriteError) {}

// Tests that we allow multiple simultaneous, non-overlapping transactions to
// take place on a sparse entry.
TEST_F(HttpCacheRangeGetTest, MultipleRequests) {}

// Verify that a range request can be satisfied from a completely cached
// resource with the LOAD_ONLY_FROM_CACHE flag set. Currently it's not
// implemented so it returns ERR_CACHE_MISS. See also
// HttpCacheTest.RangeGET_OK_LoadOnlyFromCache.
// TODO(ricea): Update this test if it is implemented in future.
TEST_F(HttpCacheRangeGetTest, Previous200LoadOnlyFromCache) {}

// Makes sure that a request stops using the cache when the response headers
// with "Cache-Control: no-store" arrives. That means that another request for
// the same URL can be processed before the response body of the original
// request arrives.
TEST_F(HttpCacheTest, NoStoreResponseShouldNotBlockFollowingRequests) {}

// Tests that serving a response entirely from cache replays the previous
// SSLInfo.
TEST_F(HttpCacheTest, CachePreservesSSLInfo) {}

// Tests that SSLInfo gets updated when revalidating a cached response.
TEST_F(HttpCacheTest, RevalidationUpdatesSSLInfo) {}

TEST_F(HttpCacheTest, CacheEntryStatusOther) {}

TEST_F(HttpCacheTest, CacheEntryStatusNotInCache) {}

TEST_F(HttpCacheTest, CacheEntryStatusUsed) {}

TEST_F(HttpCacheTest, CacheEntryStatusValidated) {}

TEST_F(HttpCacheTest, CacheEntryStatusUpdated) {}

TEST_F(HttpCacheTest, CacheEntryStatusCantConditionalize) {}

TEST_F(HttpSplitCacheKeyTest, GetResourceURLFromHttpCacheKey) {}

TEST_F(HttpCacheTest, GetResourceURLFromHttpCacheKey) {}

class TestCompletionCallbackForHttpCache : public TestCompletionCallbackBase {};

TEST_F(HttpCacheIOCallbackTest, FailedDoomFollowedByOpen) {}

TEST_F(HttpCacheIOCallbackTest, FailedDoomFollowedByCreate) {}

TEST_F(HttpCacheIOCallbackTest, FailedDoomFollowedByDoom) {}

TEST_F(HttpCacheIOCallbackTest, FailedOpenFollowedByCreate) {}

TEST_F(HttpCacheIOCallbackTest, FailedCreateFollowedByOpen) {}

TEST_F(HttpCacheIOCallbackTest, FailedCreateFollowedByCreate) {}

TEST_F(HttpCacheIOCallbackTest, CreateFollowedByCreate) {}

TEST_F(HttpCacheIOCallbackTest, OperationFollowedByDoom) {}

TEST_F(HttpCacheIOCallbackTest, CreateFollowedByOpenOrCreate) {}

TEST_F(HttpCacheIOCallbackTest, FailedCreateFollowedByOpenOrCreate) {}

TEST_F(HttpCacheIOCallbackTest, OpenFollowedByOpenOrCreate) {}

TEST_F(HttpCacheIOCallbackTest, FailedOpenFollowedByOpenOrCreate) {}

TEST_F(HttpCacheIOCallbackTest, OpenOrCreateFollowedByCreate) {}

TEST_F(HttpCacheIOCallbackTest, OpenOrCreateFollowedByOpenOrCreate) {}

TEST_F(HttpCacheIOCallbackTest, FailedOpenOrCreateFollowedByOpenOrCreate) {}

TEST_F(HttpCacheTest, DnsAliasesNoRevalidation) {}

TEST_F(HttpCacheTest, NoDnsAliasesNoRevalidation) {}

TEST_F(HttpCacheTest, DnsAliasesRevalidation) {}

HttpCacheFirstPartySetsBypassCacheTest;

TEST_F(HttpCacheFirstPartySetsBypassCacheTest, ShouldBypassNoId) {}

TEST_F(HttpCacheFirstPartySetsBypassCacheTest, ShouldBypassIdTooSmall) {}

TEST_F(HttpCacheFirstPartySetsBypassCacheTest, ShouldNotBypass) {}

TEST_F(HttpCacheFirstPartySetsBypassCacheTest, ShouldNotBypassNoFilter) {}

TEST_F(HttpCacheTest, SecurityHeadersAreCopiedToConditionalizedResponse) {}

}  // namespace net