#include "components/site_engagement/content/site_engagement_service.h"
#include <algorithm>
#include <map>
#include <string>
#include <utility>
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/simple_test_clock.h"
#include "base/time/default_clock.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/engagement/history_aware_site_engagement_service.h"
#include "chrome/browser/engagement/site_engagement_service_factory.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "components/content_settings/core/browser/content_settings_observer.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/history/core/browser/history_database_params.h"
#include "components/history/core/browser/history_service.h"
#include "components/history/core/test/test_history_database.h"
#include "components/prefs/pref_service.h"
#include "components/site_engagement/content/engagement_type.h"
#include "components/site_engagement/content/site_engagement_helper.h"
#include "components/site_engagement/content/site_engagement_metrics.h"
#include "components/site_engagement/content/site_engagement_observer.h"
#include "components/site_engagement/content/site_engagement_score.h"
#include "components/site_engagement/core/pref_names.h"
#include "components/webapps/common/web_app_id.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
NavigationSimulator;
namespace site_engagement {
namespace {
base::FilePath g_temp_history_dir;
const double kMaxRoundingDeviation = …;
class SiteEngagementChangeWaiter : public content_settings::Observer { … };
base::Time GetReferenceTime() { … }
std::unique_ptr<KeyedService> BuildTestHistoryService(
content::BrowserContext* context) { … }
std::unique_ptr<KeyedService> BuildTestSiteEngagementService(
content::BrowserContext* context) { … }
}
class ObserverTester : public SiteEngagementObserver { … };
class SiteEngagementServiceTest : public ChromeRenderViewHostTestHarness { … };
TEST_F(SiteEngagementServiceTest, GetMedianEngagement) { … }
TEST_F(SiteEngagementServiceTest, ScoreIncrementsOnPageRequest) { … }
TEST_F(SiteEngagementServiceTest, GetTotalNavigationPoints) { … }
TEST_F(SiteEngagementServiceTest, GetTotalUserInputPoints) { … }
TEST_F(SiteEngagementServiceTest, GetTotalNotificationPoints) { … }
TEST_F(SiteEngagementServiceTest, DISABLED_RestrictedToHTTPAndHTTPS) { … }
TEST_F(SiteEngagementServiceTest, LastShortcutLaunch) { … }
TEST_F(SiteEngagementServiceTest, DISABLED_CheckHistograms) { … }
TEST_F(SiteEngagementServiceTest, CleanupEngagementScores) { … }
TEST_F(SiteEngagementServiceTest, CleanupEngagementScoresProportional) { … }
TEST_F(SiteEngagementServiceTest, CleanupEngagementScoresShortDecayPeriod) { … }
TEST_F(SiteEngagementServiceTest, NavigationAccumulation) { … }
TEST_F(SiteEngagementServiceTest, IsBootstrapped) { … }
TEST_F(SiteEngagementServiceTest, CleanupOriginsOnHistoryDeletion) { … }
TEST_F(SiteEngagementServiceTest, EngagementLevel) { … }
TEST_F(SiteEngagementServiceTest, Observers) { … }
TEST_F(SiteEngagementServiceTest, LastEngagementTime) { … }
TEST_F(SiteEngagementServiceTest, CleanupMovesScoreBackToNow) { … }
TEST_F(SiteEngagementServiceTest, CleanupMovesScoreBackToRebase) { … }
TEST_F(SiteEngagementServiceTest, IncognitoEngagementService) { … }
TEST_F(SiteEngagementServiceTest, GetScoreFromSettings) { … }
TEST_F(SiteEngagementServiceTest, GetAllDetailsIncludesBonusOnlyScores) { … }
TEST_F(SiteEngagementServiceTest, GetAllDetailsFilterByURLSets) { … }
}