#include "net/disk_cache/disk_cache_test_base.h"
#include <memory>
#include <utility>
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/platform_thread.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/disk_cache/backend_cleanup_tracker.h"
#include "net/disk_cache/blockfile/backend_impl.h"
#include "net/disk_cache/cache_util.h"
#include "net/disk_cache/disk_cache.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_file_tracker.h"
#include "net/disk_cache/simple/simple_index.h"
#include "net/test/gtest_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
IsOk;
DiskCacheTest::DiskCacheTest() { … }
DiskCacheTest::~DiskCacheTest() = default;
bool DiskCacheTest::CopyTestCache(const std::string& name) { … }
bool DiskCacheTest::CleanupCacheDir() { … }
void DiskCacheTest::TearDown() { … }
DiskCacheTestWithCache::TestIterator::TestIterator(
std::unique_ptr<disk_cache::Backend::Iterator> iterator)
: … { … }
DiskCacheTestWithCache::TestIterator::~TestIterator() = default;
int DiskCacheTestWithCache::TestIterator::OpenNextEntry(
disk_cache::Entry** next_entry) { … }
DiskCacheTestWithCache::DiskCacheTestWithCache() = default;
DiskCacheTestWithCache::~DiskCacheTestWithCache() = default;
void DiskCacheTestWithCache::InitCache() { … }
void DiskCacheTestWithCache::SimulateCrash() { … }
void DiskCacheTestWithCache::SetTestMode() { … }
void DiskCacheTestWithCache::SetMaxSize(int64_t size, bool should_succeed) { … }
disk_cache::EntryResult DiskCacheTestWithCache::OpenOrCreateEntry(
const std::string& key) { … }
disk_cache::EntryResult DiskCacheTestWithCache::OpenOrCreateEntryWithPriority(
const std::string& key,
net::RequestPriority request_priority) { … }
int DiskCacheTestWithCache::OpenEntry(const std::string& key,
disk_cache::Entry** entry) { … }
int DiskCacheTestWithCache::OpenEntryWithPriority(
const std::string& key,
net::RequestPriority request_priority,
disk_cache::Entry** entry) { … }
int DiskCacheTestWithCache::CreateEntry(const std::string& key,
disk_cache::Entry** entry) { … }
int DiskCacheTestWithCache::CreateEntryWithPriority(
const std::string& key,
net::RequestPriority request_priority,
disk_cache::Entry** entry) { … }
int DiskCacheTestWithCache::DoomEntry(const std::string& key) { … }
int DiskCacheTestWithCache::DoomAllEntries() { … }
int DiskCacheTestWithCache::DoomEntriesBetween(const base::Time initial_time,
const base::Time end_time) { … }
int DiskCacheTestWithCache::DoomEntriesSince(const base::Time initial_time) { … }
int64_t DiskCacheTestWithCache::CalculateSizeOfAllEntries() { … }
int64_t DiskCacheTestWithCache::CalculateSizeOfEntriesBetween(
const base::Time initial_time,
const base::Time end_time) { … }
std::unique_ptr<DiskCacheTestWithCache::TestIterator>
DiskCacheTestWithCache::CreateIterator() { … }
void DiskCacheTestWithCache::FlushQueueForTest() { … }
void DiskCacheTestWithCache::RunTaskForTest(base::OnceClosure closure) { … }
int DiskCacheTestWithCache::ReadData(disk_cache::Entry* entry,
int index,
int offset,
net::IOBuffer* buf,
int len) { … }
int DiskCacheTestWithCache::WriteData(disk_cache::Entry* entry,
int index,
int offset,
net::IOBuffer* buf,
int len,
bool truncate) { … }
int DiskCacheTestWithCache::ReadSparseData(disk_cache::Entry* entry,
int64_t offset,
net::IOBuffer* buf,
int len) { … }
int DiskCacheTestWithCache::WriteSparseData(disk_cache::Entry* entry,
int64_t offset,
net::IOBuffer* buf,
int len) { … }
int DiskCacheTestWithCache::GetAvailableRange(disk_cache::Entry* entry,
int64_t offset,
int len,
int64_t* start) { … }
void DiskCacheTestWithCache::TrimForTest(bool empty) { … }
void DiskCacheTestWithCache::TrimDeletedListForTest(bool empty) { … }
void DiskCacheTestWithCache::AddDelay() { … }
void DiskCacheTestWithCache::OnExternalCacheHit(const std::string& key) { … }
std::unique_ptr<disk_cache::Backend> DiskCacheTestWithCache::TakeCache() { … }
void DiskCacheTestWithCache::TearDown() { … }
void DiskCacheTestWithCache::ResetCaches() { … }
void DiskCacheTestWithCache::InitMemoryCache() { … }
void DiskCacheTestWithCache::InitDiskCache() { … }
void DiskCacheTestWithCache::CreateBackend(uint32_t flags) { … }