chromium/net/disk_cache/backend_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.

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

#include <stdint.h>

#include <memory>
#include <optional>
#include <string_view>

#include "base/containers/queue.h"
#include "base/files/file.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/memory_pressure_listener.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool.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/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "base/trace_event/memory_allocator_dump.h"
#include "base/trace_event/process_memory_dump.h"
#include "build/build_config.h"
#include "net/base/cache_type.h"
#include "net/base/completion_once_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/base/request_priority.h"
#include "net/base/test_completion_callback.h"
#include "net/base/tracing.h"
#include "net/disk_cache/backend_cleanup_tracker.h"
#include "net/disk_cache/blockfile/backend_impl.h"
#include "net/disk_cache/blockfile/entry_impl.h"
#include "net/disk_cache/blockfile/experiments.h"
#include "net/disk_cache/blockfile/mapped_file.h"
#include "net/disk_cache/cache_util.h"
#include "net/disk_cache/disk_cache_test_base.h"
#include "net/disk_cache/disk_cache_test_util.h"
#include "net/disk_cache/memory/mem_backend_impl.h"
#include "net/disk_cache/simple/simple_backend_impl.h"
#include "net/disk_cache/simple/simple_entry_format.h"
#include "net/disk_cache/simple/simple_histogram_enums.h"
#include "net/disk_cache/simple/simple_index.h"
#include "net/disk_cache/simple/simple_synchronous_entry.h"
#include "net/disk_cache/simple/simple_test_util.h"
#include "net/disk_cache/simple/simple_util.h"
#include "net/test/gtest_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/base/dynamic_annotations.h"

EntryResult;
IsError;
IsOk;
ByRef;
Contains;
Eq;
Field;

#if BUILDFLAG(IS_WIN)
#include <windows.h>

#include "base/win/scoped_handle.h"
#endif

// TODO(crbug.com/41451310): Fix memory leaks in tests and re-enable on LSAN.
#ifdef LEAK_SANITIZER
#define MAYBE_BlockFileOpenOrCreateEntry
#define MAYBE_NonEmptyCorruptSimpleCacheDoesNotRecover
#define MAYBE_SimpleOpenOrCreateEntry
#else
#define MAYBE_BlockFileOpenOrCreateEntry
#define MAYBE_NonEmptyCorruptSimpleCacheDoesNotRecover
#define MAYBE_SimpleOpenOrCreateEntry
#endif

Time;

namespace {

const char kExistingEntryKey[] =;

std::unique_ptr<disk_cache::BackendImpl> CreateExistingEntryCache(
    const base::FilePath& cache_path) {}

#if BUILDFLAG(IS_FUCHSIA)
// Load tests with large numbers of file descriptors perform poorly on
// virtualized test execution environments.
// TODO(crbug.com/40560856): Remove this workaround when virtualized test
// performance improves.
const int kLargeNumEntries = 100;
#else
const int kLargeNumEntries =;
#endif

}  // namespace

// Tests that can run with different types of caches.
class DiskCacheBackendTest : public DiskCacheTestWithCache {};

void DiskCacheBackendTest::CreateKeyAndCheck(disk_cache::Backend* cache,
                                             std::string key) {}

void DiskCacheBackendTest::WaitForSimpleCacheIndexAndCheck(
    disk_cache::Backend* cache) {}

void DiskCacheBackendTest::RunUntilIdle() {}

int DiskCacheBackendTest::GeneratePendingIO(net::TestCompletionCallback* cb) {}

void DiskCacheBackendTest::InitSparseCache(base::Time* doomed_start,
                                           base::Time* doomed_end) {}

// Creates entries based on random keys. Stores these keys in |key_pool|.
bool DiskCacheBackendTest::CreateSetOfRandomEntries(
    std::set<std::string>* key_pool) {}

// Performs iteration over the backend and checks that the keys of entries
// opened are in |keys_to_match|, then erases them. Up to |max_to_open| entries
// will be opened, if it is positive. Otherwise, iteration will continue until
// OpenNextEntry stops returning net::OK.
bool DiskCacheBackendTest::EnumerateAndMatchKeys(
    int max_to_open,
    TestIterator* iter,
    std::set<std::string>* keys_to_match,
    size_t* count) {}

int DiskCacheBackendTest::GetEntryMetadataSize(std::string key) {}

int DiskCacheBackendTest::GetRoundedSize(int exact_size) {}

void DiskCacheBackendTest::BackendBasics() {}

TEST_F(DiskCacheBackendTest, Basics) {}

TEST_F(DiskCacheBackendTest, NewEvictionBasics) {}

TEST_F(DiskCacheBackendTest, MemoryOnlyBasics) {}

TEST_F(DiskCacheBackendTest, AppCacheBasics) {}

TEST_F(DiskCacheBackendTest, ShaderCacheBasics) {}

void DiskCacheBackendTest::BackendKeying() {}

TEST_F(DiskCacheBackendTest, Keying) {}

TEST_F(DiskCacheBackendTest, NewEvictionKeying) {}

TEST_F(DiskCacheBackendTest, MemoryOnlyKeying) {}

TEST_F(DiskCacheBackendTest, AppCacheKeying) {}

TEST_F(DiskCacheBackendTest, ShaderCacheKeying) {}

TEST_F(DiskCacheTest, CreateBackend) {}

TEST_F(DiskCacheTest, MemBackendPostCleanupCallback) {}

TEST_F(DiskCacheTest, CreateBackendDouble) {}

TEST_F(DiskCacheBackendTest, CreateBackendDoubleOpenEntry) {}

TEST_F(DiskCacheBackendTest, CreateBackendPostCleanup) {}

TEST_F(DiskCacheBackendTest, SimpleCreateBackendRecoveryAppCache) {}

// Tests that |BackendImpl| fails to initialize with a missing file.
TEST_F(DiskCacheBackendTest, CreateBackend_MissingFile) {}

TEST_F(DiskCacheBackendTest, MemoryListensToMemoryPressure) {}

TEST_F(DiskCacheBackendTest, ExternalFiles) {}

// Tests that we deal with file-level pending operations at destruction time.
void DiskCacheBackendTest::BackendShutdownWithPendingFileIO(bool fast) {}

TEST_F(DiskCacheBackendTest, ShutdownWithPendingFileIO) {}

// Here and below, tests that simulate crashes are not compiled in LeakSanitizer
// builds because they contain a lot of intentional memory leaks.
#if !defined(LEAK_SANITIZER)
// We'll be leaking from this test.
TEST_F(DiskCacheBackendTest, ShutdownWithPendingFileIO_Fast) {}
#endif

// See crbug.com/330074
#if !BUILDFLAG(IS_IOS)
// Tests that one cache instance is not affected by another one going away.
TEST_F(DiskCacheBackendTest, MultipleInstancesWithPendingFileIO) {}
#endif

// Tests that we deal with background-thread pending operations.
void DiskCacheBackendTest::BackendShutdownWithPendingIO(bool fast) {}

TEST_F(DiskCacheBackendTest, ShutdownWithPendingIO) {}

#if !defined(LEAK_SANITIZER)
// We'll be leaking from this test.
TEST_F(DiskCacheBackendTest, ShutdownWithPendingIO_Fast) {}
#endif

// Tests that we deal with create-type pending operations.
void DiskCacheBackendTest::BackendShutdownWithPendingCreate(bool fast) {}

TEST_F(DiskCacheBackendTest, ShutdownWithPendingCreate) {}

#if !defined(LEAK_SANITIZER)
// We'll be leaking an entry from this test.
TEST_F(DiskCacheBackendTest, ShutdownWithPendingCreate_Fast) {}
#endif

void DiskCacheBackendTest::BackendShutdownWithPendingDoom() {}

TEST_F(DiskCacheBackendTest, ShutdownWithPendingDoom) {}

// Disabled on android since this test requires cache creator to create
// blockfile caches.
#if !BUILDFLAG(IS_ANDROID)
TEST_F(DiskCacheTest, TruncatedIndex) {}
#endif

void DiskCacheBackendTest::BackendSetSize() {}

TEST_F(DiskCacheBackendTest, SetSize) {}

TEST_F(DiskCacheBackendTest, NewEvictionSetSize) {}

TEST_F(DiskCacheBackendTest, MemoryOnlySetSize) {}

void DiskCacheBackendTest::BackendLoad() {}

TEST_F(DiskCacheBackendTest, Load) {}

TEST_F(DiskCacheBackendTest, NewEvictionLoad) {}

TEST_F(DiskCacheBackendTest, MemoryOnlyLoad) {}

TEST_F(DiskCacheBackendTest, AppCacheLoad) {}

TEST_F(DiskCacheBackendTest, ShaderCacheLoad) {}

// Tests the chaining of an entry to the current head.
void DiskCacheBackendTest::BackendChain() {}

TEST_F(DiskCacheBackendTest, Chain) {}

TEST_F(DiskCacheBackendTest, NewEvictionChain) {}

TEST_F(DiskCacheBackendTest, AppCacheChain) {}

TEST_F(DiskCacheBackendTest, ShaderCacheChain) {}

TEST_F(DiskCacheBackendTest, NewEvictionTrim) {}

// Before looking for invalid entries, let's check a valid entry.
void DiskCacheBackendTest::BackendValidEntry() {}

TEST_F(DiskCacheBackendTest, ValidEntry) {}

TEST_F(DiskCacheBackendTest, NewEvictionValidEntry) {}

// The same logic of the previous test (ValidEntry), but this time force the
// entry to be invalid, simulating a crash in the middle.
// We'll be leaking memory from this test.
void DiskCacheBackendTest::BackendInvalidEntry() {}

#if !defined(LEAK_SANITIZER)
// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, InvalidEntry) {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntry) {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, AppCacheInvalidEntry) {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, ShaderCacheInvalidEntry) {}

// Almost the same test, but this time crash the cache after reading an entry.
// We'll be leaking memory from this test.
void DiskCacheBackendTest::BackendInvalidEntryRead() {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, InvalidEntryRead) {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntryRead) {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, AppCacheInvalidEntryRead) {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, ShaderCacheInvalidEntryRead) {}

// We'll be leaking memory from this test.
void DiskCacheBackendTest::BackendInvalidEntryWithLoad() {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, InvalidEntryWithLoad) {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntryWithLoad) {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, AppCacheInvalidEntryWithLoad) {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, ShaderCacheInvalidEntryWithLoad) {}

// We'll be leaking memory from this test.
void DiskCacheBackendTest::BackendTrimInvalidEntry() {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, TrimInvalidEntry) {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, NewEvictionTrimInvalidEntry) {}

// We'll be leaking memory from this test.
void DiskCacheBackendTest::BackendTrimInvalidEntry2() {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, TrimInvalidEntry2) {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, NewEvictionTrimInvalidEntry2) {}
#endif  // !defined(LEAK_SANITIZER)

void DiskCacheBackendTest::BackendEnumerations() {}

TEST_F(DiskCacheBackendTest, Enumerations) {}

TEST_F(DiskCacheBackendTest, NewEvictionEnumerations) {}

TEST_F(DiskCacheBackendTest, MemoryOnlyEnumerations) {}

TEST_F(DiskCacheBackendTest, ShaderCacheEnumerations) {}

TEST_F(DiskCacheBackendTest, AppCacheEnumerations) {}

// Verifies enumerations while entries are open.
void DiskCacheBackendTest::BackendEnumerations2() {}

TEST_F(DiskCacheBackendTest, Enumerations2) {}

TEST_F(DiskCacheBackendTest, NewEvictionEnumerations2) {}

TEST_F(DiskCacheBackendTest, AppCacheEnumerations2) {}

TEST_F(DiskCacheBackendTest, ShaderCacheEnumerations2) {}

void DiskCacheBackendTest::BackendDoomMidEnumeration() {}

TEST_F(DiskCacheBackendTest, DoomEnumerations) {}

TEST_F(DiskCacheBackendTest, NewEvictionDoomEnumerations) {}

TEST_F(DiskCacheBackendTest, MemoryOnlyDoomEnumerations) {}

TEST_F(DiskCacheBackendTest, ShaderCacheDoomEnumerations) {}

TEST_F(DiskCacheBackendTest, AppCacheDoomEnumerations) {}

TEST_F(DiskCacheBackendTest, SimpleDoomEnumerations) {}

// Verify that ReadData calls do not update the LRU cache
// when using the SHADER_CACHE type.
TEST_F(DiskCacheBackendTest, ShaderCacheEnumerationReadData) {}

#if !defined(LEAK_SANITIZER)
// Verify handling of invalid entries while doing enumerations.
// We'll be leaking memory from this test.
void DiskCacheBackendTest::BackendInvalidEntryEnumeration() {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, InvalidEntryEnumeration) {}

// We'll be leaking memory from this test.
TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntryEnumeration) {}
#endif  // !defined(LEAK_SANITIZER)

// Tests that if for some reason entries are modified close to existing cache
// iterators, we don't generate fatal errors or reset the cache.
void DiskCacheBackendTest::BackendFixEnumerators() {}

TEST_F(DiskCacheBackendTest, FixEnumerators) {}

TEST_F(DiskCacheBackendTest, NewEvictionFixEnumerators) {}

void DiskCacheBackendTest::BackendDoomRecent() {}

TEST_F(DiskCacheBackendTest, DoomRecent) {}

TEST_F(DiskCacheBackendTest, NewEvictionDoomRecent) {}

TEST_F(DiskCacheBackendTest, MemoryOnlyDoomRecent) {}

TEST_F(DiskCacheBackendTest, MemoryOnlyDoomEntriesSinceSparse) {}

TEST_F(DiskCacheBackendTest, DoomEntriesSinceSparse) {}

TEST_F(DiskCacheBackendTest, MemoryOnlyDoomAllSparse) {}

TEST_F(DiskCacheBackendTest, DoomAllSparse) {}

// This test is for https://crbug.com/827492.
TEST_F(DiskCacheBackendTest, InMemorySparseEvict) {}

void DiskCacheBackendTest::BackendDoomBetween() {}

TEST_F(DiskCacheBackendTest, DoomBetween) {}

TEST_F(DiskCacheBackendTest, NewEvictionDoomBetween) {}

TEST_F(DiskCacheBackendTest, MemoryOnlyDoomBetween) {}

TEST_F(DiskCacheBackendTest, MemoryOnlyDoomEntriesBetweenSparse) {}

TEST_F(DiskCacheBackendTest, DoomEntriesBetweenSparse) {}

void DiskCacheBackendTest::BackendCalculateSizeOfAllEntries() {}

TEST_F(DiskCacheBackendTest, CalculateSizeOfAllEntries) {}

TEST_F(DiskCacheBackendTest, MemoryOnlyCalculateSizeOfAllEntries) {}

TEST_F(DiskCacheBackendTest, SimpleCacheCalculateSizeOfAllEntries) {}

void DiskCacheBackendTest::BackendCalculateSizeOfEntriesBetween(
    bool expect_access_time_comparisons) {}

TEST_F(DiskCacheBackendTest, CalculateSizeOfEntriesBetween) {}

TEST_F(DiskCacheBackendTest, MemoryOnlyCalculateSizeOfEntriesBetween) {}

TEST_F(DiskCacheBackendTest, SimpleCacheCalculateSizeOfEntriesBetween) {}

TEST_F(DiskCacheBackendTest, SimpleCacheAppCacheCalculateSizeOfEntriesBetween) {}

void DiskCacheBackendTest::BackendTransaction(const std::string& name,
                                              int num_entries,
                                              bool load) {}

void DiskCacheBackendTest::BackendRecoverInsert() {}

TEST_F(DiskCacheBackendTest, RecoverInsert) {}

TEST_F(DiskCacheBackendTest, NewEvictionRecoverInsert) {}

void DiskCacheBackendTest::BackendRecoverRemove() {}

#if BUILDFLAG(IS_WIN)
// http://crbug.com/396392
#define MAYBE_RecoverRemove
#else
#define MAYBE_RecoverRemove
#endif
TEST_F(DiskCacheBackendTest, MAYBE_RecoverRemove) {}

#if BUILDFLAG(IS_WIN)
// http://crbug.com/396392
#define MAYBE_NewEvictionRecoverRemove
#else
#define MAYBE_NewEvictionRecoverRemove
#endif
TEST_F(DiskCacheBackendTest, MAYBE_NewEvictionRecoverRemove) {}

void DiskCacheBackendTest::BackendRecoverWithEviction() {}

TEST_F(DiskCacheBackendTest, RecoverWithEviction) {}

TEST_F(DiskCacheBackendTest, NewEvictionRecoverWithEviction) {}

// Tests that the |BackendImpl| fails to start with the wrong cache version.
TEST_F(DiskCacheTest, WrongVersion) {}

// Tests that the disk cache successfully joins the control group, dropping the
// existing cache in favour of a new empty cache.
// Disabled on android since this test requires cache creator to create
// blockfile caches.
#if !BUILDFLAG(IS_ANDROID)
TEST_F(DiskCacheTest, SimpleCacheControlJoin) {}
#endif

// Tests that the disk cache can restart in the control group preserving
// existing entries.
TEST_F(DiskCacheTest, SimpleCacheControlRestart) {}

// Tests that the disk cache can leave the control group preserving existing
// entries.
TEST_F(DiskCacheTest, SimpleCacheControlLeave) {}

// Tests that the cache is properly restarted on recovery error.
// Disabled on android since this test requires cache creator to create
// blockfile caches.
#if !BUILDFLAG(IS_ANDROID)
TEST_F(DiskCacheBackendTest, DeleteOld) {}
#endif

// We want to be able to deal with messed up entries on disk.
void DiskCacheBackendTest::BackendInvalidEntry2() {}

TEST_F(DiskCacheBackendTest, InvalidEntry2) {}

TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntry2) {}

// Tests that we don't crash or hang when enumerating this cache.
void DiskCacheBackendTest::BackendInvalidEntry3() {}

TEST_F(DiskCacheBackendTest, InvalidEntry3) {}

TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntry3) {}

// Test that we handle a dirty entry on the LRU list, already replaced with
// the same key, and with hash collisions.
TEST_F(DiskCacheBackendTest, InvalidEntry4) {}

// Test that we handle a dirty entry on the deleted list, already replaced with
// the same key, and with hash collisions.
TEST_F(DiskCacheBackendTest, InvalidEntry5) {}

TEST_F(DiskCacheBackendTest, InvalidEntry6) {}

// Tests that we don't hang when there is a loop on the hash collision list.
// The test cache could be a result of bug 69135.
TEST_F(DiskCacheBackendTest, BadNextEntry1) {}

// Tests that we don't hang when there is a loop on the hash collision list.
// The test cache could be a result of bug 69135.
TEST_F(DiskCacheBackendTest, BadNextEntry2) {}

TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntry6) {}

// Tests handling of corrupt entries by keeping the rankings node around, with
// a fatal failure.
void DiskCacheBackendTest::BackendInvalidEntry7() {}

TEST_F(DiskCacheBackendTest, InvalidEntry7) {}

TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntry7) {}

// Tests handling of corrupt entries by keeping the rankings node around, with
// a non fatal failure.
void DiskCacheBackendTest::BackendInvalidEntry8() {}

TEST_F(DiskCacheBackendTest, InvalidEntry8) {}

TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntry8) {}

// Tests handling of corrupt entries detected by enumerations. Note that these
// tests (xx9 to xx11) are basically just going though slightly different
// codepaths so they are tighlty coupled with the code, but that is better than
// not testing error handling code.
void DiskCacheBackendTest::BackendInvalidEntry9(bool eviction) {}

TEST_F(DiskCacheBackendTest, InvalidEntry9) {}

TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntry9) {}

TEST_F(DiskCacheBackendTest, TrimInvalidEntry9) {}

TEST_F(DiskCacheBackendTest, NewEvictionTrimInvalidEntry9) {}

// Tests handling of corrupt entries detected by enumerations.
void DiskCacheBackendTest::BackendInvalidEntry10(bool eviction) {}

TEST_F(DiskCacheBackendTest, InvalidEntry10) {}

TEST_F(DiskCacheBackendTest, TrimInvalidEntry10) {}

// Tests handling of corrupt entries detected by enumerations.
void DiskCacheBackendTest::BackendInvalidEntry11(bool eviction) {}

TEST_F(DiskCacheBackendTest, InvalidEntry11) {}

TEST_F(DiskCacheBackendTest, TrimInvalidEntry11) {}

// Tests handling of corrupt entries in the middle of a long eviction run.
void DiskCacheBackendTest::BackendTrimInvalidEntry12() {}

TEST_F(DiskCacheBackendTest, TrimInvalidEntry12) {}

TEST_F(DiskCacheBackendTest, NewEvictionTrimInvalidEntry12) {}

// We want to be able to deal with messed up entries on disk.
void DiskCacheBackendTest::BackendInvalidRankings2() {}

TEST_F(DiskCacheBackendTest, InvalidRankings2) {}

TEST_F(DiskCacheBackendTest, NewEvictionInvalidRankings2) {}

// If the LRU is corrupt, we delete the cache.
void DiskCacheBackendTest::BackendInvalidRankings() {}

TEST_F(DiskCacheBackendTest, InvalidRankingsSuccess) {}

TEST_F(DiskCacheBackendTest, NewEvictionInvalidRankingsSuccess) {}

TEST_F(DiskCacheBackendTest, InvalidRankingsFailure) {}

TEST_F(DiskCacheBackendTest, NewEvictionInvalidRankingsFailure) {}

// If the LRU is corrupt and we have open entries, we disable the cache.
void DiskCacheBackendTest::BackendDisable() {}

TEST_F(DiskCacheBackendTest, DisableSuccess) {}

TEST_F(DiskCacheBackendTest, NewEvictionDisableSuccess) {}

TEST_F(DiskCacheBackendTest, DisableFailure) {}

TEST_F(DiskCacheBackendTest, NewEvictionDisableFailure) {}

// This is another type of corruption on the LRU; disable the cache.
void DiskCacheBackendTest::BackendDisable2() {}

TEST_F(DiskCacheBackendTest, DisableSuccess2) {}

TEST_F(DiskCacheBackendTest, NewEvictionDisableSuccess2) {}

TEST_F(DiskCacheBackendTest, DisableFailure2) {}

TEST_F(DiskCacheBackendTest, NewEvictionDisableFailure2) {}

// If the index size changes when we disable the cache, we should not crash.
void DiskCacheBackendTest::BackendDisable3() {}

TEST_F(DiskCacheBackendTest, DisableSuccess3) {}

TEST_F(DiskCacheBackendTest, NewEvictionDisableSuccess3) {}

// If we disable the cache, already open entries should work as far as possible.
void DiskCacheBackendTest::BackendDisable4() {}

TEST_F(DiskCacheBackendTest, DisableSuccess4) {}

TEST_F(DiskCacheBackendTest, NewEvictionDisableSuccess4) {}

// Tests the exposed API with a disabled cache.
void DiskCacheBackendTest::BackendDisabledAPI() {}

TEST_F(DiskCacheBackendTest, DisabledAPI) {}

TEST_F(DiskCacheBackendTest, NewEvictionDisabledAPI) {}

// Test that some eviction of some kind happens.
void DiskCacheBackendTest::BackendEviction() {}

TEST_F(DiskCacheBackendTest, BackendEviction) {}

TEST_F(DiskCacheBackendTest, MemoryOnlyBackendEviction) {}

// TODO(morlovich): Enable BackendEviction test for simple cache after
// performance problems are addressed. See crbug.com/588184 for more
// information.

// This overly specific looking test is a regression test aimed at
// crbug.com/589186.
TEST_F(DiskCacheBackendTest, MemoryOnlyUseAfterFree) {}

TEST_F(DiskCacheBackendTest, MemoryCapsWritesToMaxSize) {}

TEST_F(DiskCacheTest, Backend_UsageStatsTimer) {}

TEST_F(DiskCacheBackendTest, TimerNotCreated) {}

TEST_F(DiskCacheBackendTest, Backend_UsageStats) {}

void DiskCacheBackendTest::BackendDoomAll() {}

TEST_F(DiskCacheBackendTest, DoomAll) {}

TEST_F(DiskCacheBackendTest, NewEvictionDoomAll) {}

TEST_F(DiskCacheBackendTest, MemoryOnlyDoomAll) {}

TEST_F(DiskCacheBackendTest, AppCacheOnlyDoomAll) {}

TEST_F(DiskCacheBackendTest, ShaderCacheOnlyDoomAll) {}

// If the index size changes when we doom the cache, we should not crash.
void DiskCacheBackendTest::BackendDoomAll2() {}

TEST_F(DiskCacheBackendTest, DoomAll2) {}

TEST_F(DiskCacheBackendTest, NewEvictionDoomAll2) {}

// We should be able to create the same entry on multiple simultaneous instances
// of the cache.
TEST_F(DiskCacheTest, MultipleInstances) {}

// Test the six regions of the curve that determines the max cache size.
TEST_F(DiskCacheTest, AutomaticMaxSize) {}

// Make sure that we keep the total memory used by the internal buffers under
// control.
TEST_F(DiskCacheBackendTest, TotalBuffersSize1) {}

// This test assumes at least 150MB of system memory.
TEST_F(DiskCacheBackendTest, TotalBuffersSize2) {}

// Tests that sharing of external files works and we are able to delete the
// files when we need to.
TEST_F(DiskCacheBackendTest, FileSharing) {}

TEST_F(DiskCacheBackendTest, UpdateRankForExternalCacheHit) {}

TEST_F(DiskCacheBackendTest, ShaderCacheUpdateRankForExternalCacheHit) {}

TEST_F(DiskCacheBackendTest, SimpleCacheShutdownWithPendingCreate) {}

TEST_F(DiskCacheBackendTest, SimpleCacheShutdownWithPendingDoom) {}

TEST_F(DiskCacheBackendTest, SimpleCacheShutdownWithPendingFileIO) {}

TEST_F(DiskCacheBackendTest, SimpleCacheBasics) {}

TEST_F(DiskCacheBackendTest, SimpleCacheAppCacheBasics) {}

TEST_F(DiskCacheBackendTest, SimpleCacheKeying) {}

TEST_F(DiskCacheBackendTest, SimpleCacheAppCacheKeying) {}

TEST_F(DiskCacheBackendTest, SimpleCacheLoad) {}

TEST_F(DiskCacheBackendTest, SimpleCacheAppCacheLoad) {}

TEST_F(DiskCacheBackendTest, SimpleDoomRecent) {}

// crbug.com/330926, crbug.com/370677
TEST_F(DiskCacheBackendTest, DISABLED_SimpleDoomBetween) {}

TEST_F(DiskCacheBackendTest, SimpleCacheDoomAll) {}

TEST_F(DiskCacheBackendTest, SimpleCacheAppCacheOnlyDoomAll) {}

TEST_F(DiskCacheBackendTest, SimpleCacheOpenMissingFile) {}

TEST_F(DiskCacheBackendTest, SimpleCacheOpenBadFile) {}

// Tests that the Simple Cache Backend fails to initialize with non-matching
// file structure on disk.
TEST_F(DiskCacheBackendTest, SimpleCacheOverBlockfileCache) {}

// Tests that the |BackendImpl| refuses to initialize on top of the files
// generated by the Simple Cache Backend.
TEST_F(DiskCacheBackendTest, BlockfileCacheOverSimpleCache) {}

TEST_F(DiskCacheBackendTest, SimpleCacheFixEnumerators) {}

// Tests basic functionality of the SimpleBackend implementation of the
// enumeration API.
TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationBasics) {}

// Tests that the enumerations are not affected by dooming an entry in the
// middle.
TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationWhileDoomed) {}

// Tests that enumerations are not affected by corrupt files.
TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationCorruption) {}

// Tests that enumerations don't leak memory when the backend is destructed
// mid-enumeration.
TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationDestruction) {}

// Verify that tasks run in priority order when the experiment is enabled.
// Test has races, disabling until fixed: https://crbug.com/853283
TEST_F(DiskCacheBackendTest, DISABLED_SimpleCachePrioritizedEntryOrder) {}

// Tests that enumerations include entries with long keys.
TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationLongKeys) {}

// Tests that a SimpleCache doesn't crash when files are deleted very quickly
// after closing.
// NOTE: IF THIS TEST IS FLAKY THEN IT IS FAILING. See https://crbug.com/416940
TEST_F(DiskCacheBackendTest, SimpleCacheDeleteQuickly) {}

TEST_F(DiskCacheBackendTest, SimpleCacheLateDoom) {}

TEST_F(DiskCacheBackendTest, SimpleCacheNegMaxSize) {}

TEST_F(DiskCacheBackendTest, SimpleLastModified) {}

TEST_F(DiskCacheBackendTest, SimpleFdLimit) {}

TEST_F(DiskCacheBackendTest, SparseEvict) {}

TEST_F(DiskCacheBackendTest, InMemorySparseDoom) {}

TEST_F(DiskCacheBackendTest, BlockFileMaxSizeLimit) {}

TEST_F(DiskCacheBackendTest, InMemoryMaxSizeLimit) {}

TEST_F(DiskCacheBackendTest, SimpleMaxSizeLimit) {}

void DiskCacheBackendTest::BackendOpenOrCreateEntry() {}

TEST_F(DiskCacheBackendTest, InMemoryOnlyOpenOrCreateEntry) {}

TEST_F(DiskCacheBackendTest, MAYBE_BlockFileOpenOrCreateEntry) {}

TEST_F(DiskCacheBackendTest, MAYBE_SimpleOpenOrCreateEntry) {}

void DiskCacheBackendTest::BackendDeadOpenNextEntry() {}

TEST_F(DiskCacheBackendTest, BlockFileBackendDeadOpenNextEntry) {}

TEST_F(DiskCacheBackendTest, SimpleBackendDeadOpenNextEntry) {}

TEST_F(DiskCacheBackendTest, InMemorySimpleBackendDeadOpenNextEntry) {}

void DiskCacheBackendTest::BackendIteratorConcurrentDoom() {}

TEST_F(DiskCacheBackendTest, BlockFileIteratorConcurrentDoom) {}

TEST_F(DiskCacheBackendTest, SimpleIteratorConcurrentDoom) {}

TEST_F(DiskCacheBackendTest, InMemoryConcurrentDoom) {}

TEST_F(DiskCacheBackendTest, EmptyCorruptSimpleCacheRecovery) {}

TEST_F(DiskCacheBackendTest, MAYBE_NonEmptyCorruptSimpleCacheDoesNotRecover) {}

TEST_F(DiskCacheBackendTest, SimpleOwnershipTransferBackendDestroyRace) {}

// Verify that reloading the cache will preserve indices in kNeverReset mode.
TEST_F(DiskCacheBackendTest, SimpleCacheSoftResetKeepsValues) {}

// Verify that reloading the cache will not preserve indices in Reset mode.
TEST_F(DiskCacheBackendTest, SimpleCacheHardResetDropsValues) {}

// Test to make sure cancelation of backend operation that got queued after
// a pending doom on backend destruction happens properly.
TEST_F(DiskCacheBackendTest, SimpleCancelOpPendingDoom) {}

TEST_F(DiskCacheBackendTest, SimpleDontLeakPostDoomCreate) {}

TEST_F(DiskCacheBackendTest, BlockFileDelayedWriteFailureRecovery) {}

TEST_F(DiskCacheBackendTest, BlockFileInsertAliasing) {}

TEST_F(DiskCacheBackendTest, MemCacheBackwardsClock) {}

TEST_F(DiskCacheBackendTest, SimpleOpenOrCreateIndexError) {}

TEST_F(DiskCacheBackendTest, SimpleOpenOrCreateIndexErrorOptimistic) {}

TEST_F(DiskCacheBackendTest, SimpleDoomAfterBackendDestruction) {}

void DiskCacheBackendTest::BackendValidateMigrated() {}

TEST_F(DiskCacheBackendTest, BlockfileMigrate20) {}

TEST_F(DiskCacheBackendTest, BlockfileMigrate21) {}

TEST_F(DiskCacheBackendTest, BlockfileMigrateNewEviction20) {}

TEST_F(DiskCacheBackendTest, BlockfileMigrateNewEviction21) {}

// Disabled on android since this test requires cache creator to create
// blockfile caches, and we don't use them on Android anyway.
#if !BUILDFLAG(IS_ANDROID)
TEST_F(DiskCacheBackendTest, BlockfileEmptyIndex) {}
#endif

// See https://crbug.com/1486958
TEST_F(DiskCacheBackendTest, SimpleDoomIter) {}

// See https://crbug.com/1486958 for non-corrupting version,
// https://crbug.com/1510452 for corrupting one.
TEST_F(DiskCacheBackendTest, SimpleOpenIter) {}

// Make sure that if we close an entry in callback from open/create we do not
// trigger dangling pointer warnings.
TEST_F(DiskCacheBackendTest, BlockFileImmediateCloseNoDangle) {}

// Test that when a write causes a doom, it doesn't result in wrong delivery
// order of callbacks due to re-entrant operation execution.
TEST_F(DiskCacheBackendTest, SimpleWriteOrderEviction) {}

// Test that when a write causes a doom, it doesn't result in wrong delivery
// order of callbacks due to re-entrant operation execution. Variant that
// uses stream 0 ops only.
TEST_F(DiskCacheBackendTest, SimpleWriteOrderEvictionStream0) {}

// Test to make sure that if entry creation triggers eviction, a queued up
// close (possible with optimistic ops) doesn't run from within creation
// completion handler (which is indirectly detected as a dangling pointer).
TEST_F(DiskCacheBackendTest, SimpleNoCloseFromWithinCreate) {}