chromium/net/disk_cache/simple/simple_index_unittest.cc

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

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

#include <algorithm>
#include <functional>
#include <memory>
#include <utility>

#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/hash/hash.h"
#include "base/memory/raw_ptr.h"
#include "base/pickle.h"
#include "base/strings/stringprintf.h"
#include "base/task/task_runner.h"
#include "base/test/mock_entropy_provider.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "net/base/cache_type.h"
#include "net/disk_cache/backend_cleanup_tracker.h"
#include "net/disk_cache/disk_cache.h"
#include "net/disk_cache/simple/simple_index_delegate.h"
#include "net/disk_cache/simple/simple_index_file.h"
#include "net/disk_cache/simple/simple_test_util.h"
#include "net/disk_cache/simple/simple_util.h"
#include "net/test/test_with_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace disk_cache {
namespace {

const base::Time kTestLastUsedTime =;
const uint32_t kTestEntrySize =;
const uint8_t kTestEntryMemoryData =;

uint32_t RoundSize(uint32_t in) {}

}  // namespace

class EntryMetadataTest : public testing::Test {};

class MockSimpleIndexFile final : public SimpleIndexFile {};

class SimpleIndexTest : public net::TestWithTaskEnvironment,
                        public SimpleIndexDelegate {};

class SimpleIndexAppCacheTest : public SimpleIndexTest {};

class SimpleIndexCodeCacheTest : public SimpleIndexTest {};

TEST_F(EntryMetadataTest, Basics) {}

// Tests that setting an unusually small/large last used time results in
// truncation (rather than crashing).
TEST_F(EntryMetadataTest, SaturatedLastUsedTime) {}

TEST_F(EntryMetadataTest, Serialize) {}

TEST_F(SimpleIndexTest, IndexSizeCorrectOnMerge) {}

// State of index changes as expected with an insert and a remove.
TEST_F(SimpleIndexTest, BasicInsertRemove) {}

TEST_F(SimpleIndexTest, Has) {}

TEST_F(SimpleIndexTest, UseIfExists) {}

TEST_F(SimpleIndexTest, UpdateEntrySize) {}

TEST_F(SimpleIndexTest, GetEntryCount) {}

// Confirm that we get the results we expect from a simple init.
TEST_F(SimpleIndexTest, BasicInit) {}

// Remove something that's going to come in from the loaded index.
TEST_F(SimpleIndexTest, RemoveBeforeInit) {}

// Insert something that's going to come in from the loaded index; correct
// result?
TEST_F(SimpleIndexTest, InsertBeforeInit) {}

// Insert and Remove something that's going to come in from the loaded index.
TEST_F(SimpleIndexTest, InsertRemoveBeforeInit) {}

// Insert and Remove something that's going to come in from the loaded index.
TEST_F(SimpleIndexTest, RemoveInsertBeforeInit) {}

// Do all above tests at once + a non-conflict to test for cross-key
// interactions.
TEST_F(SimpleIndexTest, AllInitConflicts) {}

TEST_F(SimpleIndexTest, BasicEviction) {}

TEST_F(SimpleIndexTest, EvictBySize) {}

TEST_F(SimpleIndexCodeCacheTest, DisableEvictBySize) {}

// Same as test above, but using much older entries to make sure that small
// things eventually get evictied.
TEST_F(SimpleIndexTest, EvictBySize2) {}

// Confirm all the operations queue a disk write at some point in the
// future.
TEST_F(SimpleIndexTest, DiskWriteQueued) {}

TEST_F(SimpleIndexTest, DiskWriteExecuted) {}

TEST_F(SimpleIndexTest, DiskWritePostponed) {}

// net::APP_CACHE mode should not need to queue disk writes in as many places
// as the default net::DISK_CACHE mode.
TEST_F(SimpleIndexAppCacheTest, DiskWriteQueued) {}

}  // namespace disk_cache