#include <memory>
#include "base/base64.h"
#include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/history_test_utils.h"
#include "chrome/browser/history_clusters/history_clusters_metrics_logger.h"
#include "chrome/browser/history_clusters/history_clusters_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/webui/history/history_ui.h"
#include "chrome/browser/ui/webui/history_clusters/history_clusters_handler.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/history_clusters/core/features.h"
#include "components/history_clusters/core/url_constants.h"
#include "components/ukm/test_ukm_recorder.h"
#include "components/variations/active_field_trials.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source.h"
#include "ui/webui/resources/cr_components/history_clusters/history_clusters.mojom.h"
namespace history_clusters {
namespace {
enum class UiTab { … };
void ValidateHistoryClustersUKMEntry(const ukm::mojom::UkmEntry* entry,
HistoryClustersInitialState init_state,
int num_queries,
int num_toggles_to_basic_history) { … }
}
class HistoryClustersMetricsBrowserTest : public InProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_F(HistoryClustersMetricsBrowserTest,
NoUKMEventOnOtherPages) { … }
#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \
BUILDFLAG(IS_MAC)
#define MAYBE_DirectNavigationNoInteraction …
#else
#define MAYBE_DirectNavigationNoInteraction …
#endif
IN_PROC_BROWSER_TEST_F(HistoryClustersMetricsBrowserTest,
MAYBE_DirectNavigationNoInteraction) { … }
#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
BUILDFLAG(IS_MAC)
#define MAYBE_DirectNavigationWithQuery …
#else
#define MAYBE_DirectNavigationWithQuery …
#endif
IN_PROC_BROWSER_TEST_F(HistoryClustersMetricsBrowserTest,
MAYBE_DirectNavigationWithQuery) { … }
#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \
BUILDFLAG(IS_MAC)
#define MAYBE_DirectNavigationWithToggleToBasic …
#else
#define MAYBE_DirectNavigationWithToggleToBasic …
#endif
IN_PROC_BROWSER_TEST_F(HistoryClustersMetricsBrowserTest,
MAYBE_DirectNavigationWithToggleToBasic) { … }
IN_PROC_BROWSER_TEST_F(
HistoryClustersMetricsBrowserTest,
DISABLED_DirectNavigationWithToggleToBasicAndToggleBack) { … }
#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
BUILDFLAG(IS_MAC)
#define MAYBE_IndirectNavigation …
#else
#define MAYBE_IndirectNavigation …
#endif
IN_PROC_BROWSER_TEST_F(HistoryClustersMetricsBrowserTest,
MAYBE_IndirectNavigation) { … }
}