#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/history/core/browser/expire_history_backend.h"
#include <stddef.h>
#include <memory>
#include <string>
#include <utility>
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/current_thread.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/favicon/core/favicon_database.h"
#include "components/history/core/browser/history_backend_client.h"
#include "components/history/core/browser/history_backend_notifier.h"
#include "components/history/core/browser/history_constants.h"
#include "components/history/core/browser/history_database.h"
#include "components/history/core/browser/history_types.h"
#include "components/history/core/browser/top_sites.h"
#include "components/history/core/browser/top_sites_impl.h"
#include "components/history/core/browser/top_sites_observer.h"
#include "components/history/core/test/history_client_fake_bookmarks.h"
#include "components/history/core/test/test_history_database.h"
#include "components/history/core/test/thumbnail.h"
#include "components/history/core/test/wait_top_sites_loaded_observer.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/testing_pref_service.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
UnorderedElementsAre;
namespace history {
namespace {
const std::string kTestAppId = …;
base::Time PretendNow() { … }
bool MockCanAddURLToHistory(const GURL& url) { … }
base::Time GetOldFaviconThreshold() { … }
}
class ExpireHistoryTest : public testing::Test, public HistoryBackendNotifier { … };
void ExpireHistoryTest::AddExampleData(URLID url_ids[3],
base::Time visit_times[4],
bool set_app_id) { … }
bool ExpireHistoryTest::HasFavicon(favicon_base::FaviconID favicon_id) { … }
favicon_base::FaviconID ExpireHistoryTest::GetFavicon(
const GURL& page_url,
favicon_base::IconType icon_type) { … }
void ExpireHistoryTest::EnsureURLInfoGone(const URLRow& row, bool expired) { … }
bool ExpireHistoryTest::ModifiedNotificationSentDueToExpiry(const GURL& url) { … }
bool ExpireHistoryTest::ModifiedNotificationSentDueToUserAction(
const GURL& url) { … }
bool ExpireHistoryTest::ModifiedNotificationSent(
const GURL& url,
bool should_be_from_expiration) { … }
TEST_F(ExpireHistoryTest, DeleteFaviconsIfPossible) { … }
TEST_F(ExpireHistoryTest, DeleteURLAndFavicon) { … }
TEST_F(ExpireHistoryTest, DeleteURLWithTimeBound) { … }
TEST_F(ExpireHistoryTest, DeleteURLWithoutFavicon) { … }
TEST_F(ExpireHistoryTest, DeleteURLAndContextAnnotations) { … }
TEST_F(ExpireHistoryTest, DeleteStarredVisitedURL) { … }
TEST_F(ExpireHistoryTest, DeleteStarredUnvisitedURL) { … }
TEST_F(ExpireHistoryTest, DeleteURLs) { … }
TEST_F(ExpireHistoryTest, FlushRecentURLsUnstarred) { … }
TEST_F(ExpireHistoryTest, FlushURLsUnstarredBetweenTwoTimestamps) { … }
TEST_F(ExpireHistoryTest, FlushRecentURLsUnstarredWithMaxTime) { … }
TEST_F(ExpireHistoryTest, FlushRecentURLsWithAppIdUnstarredWithMaxTime) { … }
TEST_F(ExpireHistoryTest, FlushAllURLsUnstarred) { … }
TEST_F(ExpireHistoryTest, FlushURLsForTimes) { … }
TEST_F(ExpireHistoryTest, FlushRecentURLsUnstarredRestricted) { … }
TEST_F(ExpireHistoryTest, FlushRecentURLsStarred) { … }
TEST_F(ExpireHistoryTest, ExpireHistoryBetweenPropagatesUserInitiated) { … }
TEST_F(ExpireHistoryTest, ExpireHistoryBeforeUnstarred) { … }
TEST_F(ExpireHistoryTest, ExpireHistoryBeforeStarred) { … }
TEST_F(ExpireHistoryTest, ExpireSomeOldHistory) { … }
TEST_F(ExpireHistoryTest, ExpiringVisitsReader) { … }
TEST_F(ExpireHistoryTest, ClearOldOnDemandFaviconsDoesDeleteUnstarred) { … }
TEST_F(ExpireHistoryTest, ClearOldOnDemandFaviconsDoesNotDeleteStarred) { … }
TEST_F(ExpireHistoryTest, ClearOldOnDemandFaviconsDoesDeleteAfterLongDelay) { … }
TEST_F(ExpireHistoryTest,
ClearOldOnDemandFaviconsDoesNotDeleteAfterShortDelay) { … }
TEST_F(ExpireHistoryTest, DeleteVisitAndRedirects) { … }
TEST_F(ExpireHistoryTest, DeleteVisitAndRedirectsWithLoop) { … }
TEST_F(ExpireHistoryTest, DeleteVisitButNotActualReferers) { … }
TEST_F(ExpireHistoryTest, DeleteVisitsWithoutDeletingURLs) { … }
}