chromium/net/disk_cache/simple/simple_index_file_unittest.cc

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

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

#include "net/disk_cache/simple/simple_index_file.h"

#include <memory>

#include "base/check.h"
#include "base/files/file.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/callback.h"
#include "base/hash/hash.h"
#include "base/location.h"
#include "base/pickle.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
#include "net/base/cache_type.h"
#include "net/base/test_completion_callback.h"
#include "net/disk_cache/backend_cleanup_tracker.h"
#include "net/disk_cache/disk_cache.h"
#include "net/disk_cache/disk_cache_test_util.h"
#include "net/disk_cache/simple/simple_backend_impl.h"
#include "net/disk_cache/simple/simple_backend_version.h"
#include "net/disk_cache/simple/simple_entry_format.h"
#include "net/disk_cache/simple/simple_index.h"
#include "net/disk_cache/simple/simple_util.h"
#include "net/disk_cache/simple/simple_version_upgrade.h"
#include "net/test/gtest_util.h"
#include "net/test/test_with_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

IsOk;

Time;
SimpleIndexFile;
SimpleIndex;

namespace disk_cache {

namespace {

uint32_t RoundSize(uint32_t in) {}

}  // namespace

TEST(IndexMetadataTest, Basics) {}

TEST(IndexMetadataTest, Serialize) {}

// This derived index metadata class allows us to serialize the older V6 format
// of the index metadata, thus allowing us to test deserializing the old format.
class V6IndexMetadataForTest : public SimpleIndexFile::IndexMetadata {};

TEST(IndexMetadataTest, ReadV6Format) {}

// This derived index metadata class allows us to serialize the older V7 format
// of the index metadata, thus allowing us to test deserializing the old format.
class V7IndexMetadataForTest : public SimpleIndexFile::IndexMetadata {};

class V8IndexMetadataForTest : public SimpleIndexFile::IndexMetadata {};

// This friend derived class is able to reexport its ancestors private methods
// as public, for use in tests.
class WrappedSimpleIndexFile : public SimpleIndexFile {};

class SimpleIndexFileTest : public net::TestWithTaskEnvironment {};

TEST_F(SimpleIndexFileTest, Serialize) {}

TEST_F(SimpleIndexFileTest, SerializeAppCache) {}

TEST_F(SimpleIndexFileTest, ReadV7Format) {}

TEST_F(SimpleIndexFileTest, ReadV8Format) {}

TEST_F(SimpleIndexFileTest, ReadV8FormatAppCache) {}

TEST_F(SimpleIndexFileTest, LegacyIsIndexFileStale) {}

TEST_F(SimpleIndexFileTest, WriteThenLoadIndex) {}

TEST_F(SimpleIndexFileTest, LoadCorruptIndex) {}

TEST_F(SimpleIndexFileTest, LoadCorruptIndex2) {}

// Tests that after an upgrade the backend has the index file put in place.
TEST_F(SimpleIndexFileTest, SimpleCacheUpgrade) {}

TEST_F(SimpleIndexFileTest, OverwritesStaleTempFile) {}

}  // namespace disk_cache