#include "components/history_clusters/core/context_clusterer_history_service_observer.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/gmock_move_support.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "components/history/core/browser/history_service.h"
#include "components/history_clusters/core/config.h"
#include "components/optimization_guide/core/test_optimization_guide_decider.h"
#include "components/search_engines/search_engines_test_environment.h"
#include "components/search_engines/template_url_service.h"
#include "components/site_engagement/core/site_engagement_score_provider.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace history_clusters {
namespace {
_;
DoAll;
ElementsAre;
Invoke;
Return;
SaveArg;
history::URLRows CreateURLRows(const std::vector<GURL>& urls) { … }
class TestOptimizationGuideDecider
: public optimization_guide::TestOptimizationGuideDecider { … };
const TemplateURLService::Initializer kTemplateURLData[] = …;
class MockHistoryService : public history::HistoryService { … };
class TestSiteEngagementScoreProvider
: public site_engagement::SiteEngagementScoreProvider { … };
std::vector<history::VisitID> GetClusterVisitIds(
const std::vector<history::ClusterVisit>& visits) { … }
}
class ContextClustererHistoryServiceObserverTest : public testing::Test { … };
TEST_F(ContextClustererHistoryServiceObserverTest, ClusterOneVisit) { … }
TEST_F(ContextClustererHistoryServiceObserverTest,
StillPersistsClusterEvenIfClusterIdComesBackWayLaterSingleVisit) { … }
TEST_F(ContextClustererHistoryServiceObserverTest,
StillPersistsClusterEvenIfClusterIdComesBackWayLaterMultipleVisits) { … }
TEST_F(ContextClustererHistoryServiceObserverTest,
ClusterTwoVisitsTiedByReferringVisit) { … }
TEST_F(ContextClustererHistoryServiceObserverTest,
ClusterTwoVisitsTiedByOpenerVisit) { … }
TEST_F(ContextClustererHistoryServiceObserverTest,
ClusterTwoVisitsOpenerTakesPrecedenceOverReferrer) { … }
TEST_F(ContextClustererHistoryServiceObserverTest, ClusterTwoVisitsTiedByURL) { … }
TEST_F(ContextClustererHistoryServiceObserverTest,
ClusterVisitsTiedBySearchURL) { … }
TEST_F(ContextClustererHistoryServiceObserverTest, SplitClusterOnSearchTerm) { … }
TEST_F(ContextClustererHistoryServiceObserverTest,
SplitClusterOnNavigationTime) { … }
TEST_F(ContextClustererHistoryServiceObserverTest,
DoesNotClusterSyncedVisitsButUpdatesDetails) { … }
TEST_F(ContextClustererHistoryServiceObserverTest,
SearchNormalizedUrlIsNotAdjusted) { … }
TEST_F(ContextClustererHistoryServiceObserverTest, SkipsBlocklistedHost) { … }
TEST_F(ContextClustererHistoryServiceObserverTest, MultipleClusters) { … }
TEST_F(ContextClustererHistoryServiceObserverTest, CleansUpClusters) { … }
TEST_F(ContextClustererHistoryServiceObserverTest, DeleteAllHistory) { … }
TEST_F(ContextClustererHistoryServiceObserverTest, DeleteSelectURLs) { … }
}