#include "third_party/blink/renderer/core/fragment_directive/text_fragment_anchor_metrics.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/task_environment.h"
#include "components/ukm/test_ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/scroll/scroll_enums.mojom-blink.h"
#include "third_party/blink/public/platform/web_security_origin.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/renderer/core/fragment_directive/text_fragment_anchor.h"
#include "third_party/blink/renderer/core/fragment_directive/text_fragment_test_util.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/input/event_handler.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/testing/sim/sim_request.h"
#include "third_party/blink/renderer/core/testing/sim/sim_test.h"
#include "third_party/blink/renderer/platform/scheduler/public/main_thread_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/scoped_fake_ukm_recorder.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
namespace blink {
RunPendingTasks;
const char kSuccessUkmMetric[] = …;
const char kSourceUkmMetric[] = …;
class TextFragmentAnchorMetricsTest : public TextFragmentAnchorTestBase { … };
TEST_F(TextFragmentAnchorMetricsTest, UMAMetricsCollected) { … }
TEST_F(TextFragmentAnchorMetricsTest, UMAMetricsCollectedSearchEngineReferrer) { … }
TEST_F(TextFragmentAnchorMetricsTest, NoMatchFoundWithUnknownSource) { … }
TEST_F(TextFragmentAnchorMetricsTest, NoMatchFoundWithSearchEngineSource) { … }
TEST_F(TextFragmentAnchorMetricsTest, NoTextFragmentAnchor) { … }
TEST_F(TextFragmentAnchorMetricsTest, MatchFoundNoScroll) { … }
TEST_F(TextFragmentAnchorMetricsTest, ExactTextParameters) { … }
TEST_F(TextFragmentAnchorMetricsTest, TextRangeParameters) { … }
TEST_F(TextFragmentAnchorMetricsTest, InvalidFragmentDirective) { … }
class TextFragmentRelatedMetricTest : public TextFragmentAnchorMetricsTest,
public testing::WithParamInterface<bool> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(TextFragmentRelatedMetricTest, TextFragmentAPIUseCounter) { … }
TEST_P(TextFragmentRelatedMetricTest, TextFragmentActivationDoesNotCountAPI) { … }
TEST_F(TextFragmentAnchorMetricsTest, LinkOpenedSuccessUKM) { … }
TEST_F(TextFragmentAnchorMetricsTest, LinkOpenedFailedUKM) { … }
TEST_F(TextFragmentAnchorMetricsTest, ForceLoadAtTopUseCounter) { … }
TEST_F(TextFragmentAnchorMetricsTest, NoForceLoadAtTopUseCounter) { … }
TEST_F(TextFragmentAnchorMetricsTest,
TextFragmentBlockedByForceLoadAtTopUseCounter) { … }
TEST_F(TextFragmentAnchorMetricsTest, TextFragmentLinkOpenSource_GoogleDomain) { … }
TEST_F(TextFragmentAnchorMetricsTest, ShadowDOMUseCounter) { … }
}