chromium/chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade_unittest.cc

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

#include "chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade.h"

#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>

#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "chrome/browser/performance_manager/persistence/site_data/site_data_cache_facade_factory.h"
#include "chrome/browser/performance_manager/persistence/site_data/unittest_utils.h"
#include "chrome/test/base/testing_profile.h"
#include "components/performance_manager/performance_manager_impl.h"
#include "components/performance_manager/persistence/site_data/leveldb_site_data_store.h"
#include "components/performance_manager/persistence/site_data/site_data_cache_factory.h"
#include "components/performance_manager/persistence/site_data/site_data_cache_impl.h"
#include "components/performance_manager/test_support/run_in_graph.h"
#include "content/public/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

namespace performance_manager {

namespace {

// Mock version of a SiteDataCacheImpl. In practice instances of this object
// live on the Performance Manager sequence and all the mocked methods will be
// called from there.
class LenientMockSiteDataCacheImpl : public SiteDataCacheImpl {};
MockSiteDataCache;

}  // namespace

class SiteDataCacheFacadeTest : public testing::TestWithPerformanceManager {};

TEST_F(SiteDataCacheFacadeTest, IsDataCacheRecordingForTesting) {}

// Verify that an origin is removed from the data cache (in memory and on disk)
// when there are no more references to it in the history, after the history is
// partially cleared.
TEST_F(SiteDataCacheFacadeTest, OnURLsDeleted_Partial_OriginNotReferenced) {}

// Verify that an origin is *not* removed from the data cache (in memory and on
// disk) when there remain references to it in the history, after the history is
// partially cleared.
TEST_F(SiteDataCacheFacadeTest, OnURLsDeleted_Partial_OriginStillReferenced) {}

// Verify that origins are removed from the data cache (in memory and on disk)
// when the history is completely cleared.
TEST_F(SiteDataCacheFacadeTest, OnURLsDeleted_Full) {}

}  // namespace performance_manager