chromium/components/feed/core/v2/persistent_key_value_store_impl_unittest.cc

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

#include "components/feed/core/v2/persistent_key_value_store_impl.h"

#include <map>
#include <set>
#include <utility>

#include "base/functional/callback_helpers.h"
#include "base/hash/hash.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "components/feed/core/proto/v2/keyvalue_store.pb.h"
#include "components/feed/core/v2/config.h"
#include "components/feed/core/v2/public/persistent_key_value_store.h"
#include "components/feed/core/v2/test/callback_receiver.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace feed {
namespace {
kMaxEntriesInMemory;

int hash_int(int v) {}

class PersistentKeyValueStoreTest : public testing::Test {};

TEST_F(PersistentKeyValueStoreTest, Put) {}

TEST_F(PersistentKeyValueStoreTest, GetEmptyKey) {}

TEST_F(PersistentKeyValueStoreTest, GetKeyNotPresent) {}

TEST_F(PersistentKeyValueStoreTest, GetKeyPresent) {}

TEST_F(PersistentKeyValueStoreTest, Delete) {}

TEST_F(PersistentKeyValueStoreTest, DeleteNotPresent) {}

TEST_F(PersistentKeyValueStoreTest, ClearAll) {}

TEST_F(PersistentKeyValueStoreTest, EvictOldEntriesOnEmptyDatabaseDoesntCrash) {}

TEST_F(PersistentKeyValueStoreTest, EvictOldEntriesBelowSizeLimit) {}

TEST_F(PersistentKeyValueStoreTest, EvictOldEntriesAboveSizeLimit) {}

TEST_F(PersistentKeyValueStoreTest, PutAndGetAreQueuedWhileEvicting) {}

TEST_F(PersistentKeyValueStoreTest, EvictOldEntriesDeletesOldEntriesFirst) {}

TEST_F(PersistentKeyValueStoreTest,
       EvictOldEntriesDeletesOldEntriesFirstReverseKeys) {}

TEST_F(PersistentKeyValueStoreTest, EvictOldEntriesDeleteFutureEntriesFirst) {}

TEST_F(PersistentKeyValueStoreTest, EvictOldEntriesManyEntries) {}

TEST_F(PersistentKeyValueStoreTest, EvictOldEntriesExactlyMaxEntriesInMemory) {}

TEST_F(PersistentKeyValueStoreTest, EvictOldEntriesMaxEntriesInMemoryPlusOne) {}

void CallAfterNPostTasks(int post_task_count, base::OnceClosure done) {}

// Test that `EvictOldEntries()` completes without crashing, even when the
// store is deleted between posted tasks.
TEST_F(PersistentKeyValueStoreTest, DeleteStoreWhileEvictOldEntriesIsRunning) {}

TEST_F(PersistentKeyValueStoreTest, DataStoreCleansOldDataAutomatically) {}

}  // namespace
}  // namespace feed