chromium/third_party/blink/renderer/core/html/anchor_element_metrics_sender_test.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/html/anchor_element_metrics_sender.h"

#include "base/containers/contains.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "cc/trees/browser_controls_params.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/mojom/loader/navigation_predictor.mojom-blink.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/execution_context/agent.h"
#include "third_party/blink/renderer/core/frame/browser_controls.h"
#include "third_party/blink/renderer/core/frame/frame_test_helpers.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/html/anchor_element_metrics.h"
#include "third_party/blink/renderer/core/html/html_anchor_element.h"
#include "third_party/blink/renderer/core/html/html_collection.h"
#include "third_party/blink/renderer/core/input/event_handler.h"
#include "third_party/blink/renderer/core/intersection_observer/intersection_observer.h"
#include "third_party/blink/renderer/core/loader/anchor_element_interaction_tracker.h"
#include "third_party/blink/renderer/core/loader/document_loader.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/script/classic_script.h"
#include "third_party/blink/renderer/core/style/computed_style.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/test/fake_task_runner.h"
#include "third_party/blink/renderer/platform/testing/testing_platform_support_with_mock_scheduler.h"
#include "third_party/blink/renderer/platform/wtf/hash_set.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
#include "ui/gfx/geometry/transform.h"

namespace blink {

class MockAnchorElementMetricsHost
    : public mojom::blink::AnchorElementMetricsHost {};

class TestWebFrameWidgetWithScreenInfo
    : public frame_test_helpers::TestWebFrameWidget {};

class AnchorElementMetricsSenderTest : public SimTest {};

// Test that anchors on non-HTTPS pages are not reported.
TEST_F(AnchorElementMetricsSenderTest, AddAnchorElementHTTP) {}

TEST_F(AnchorElementMetricsSenderTest, AddAnchorElement) {}

TEST_F(AnchorElementMetricsSenderTest, AddAnchorElementAfterLoad) {}

TEST_F(AnchorElementMetricsSenderTest, AddAndRemoveAnchorElement) {}

TEST_F(AnchorElementMetricsSenderTest, AddAnchorElementFromDocumentFragment) {}

TEST_F(AnchorElementMetricsSenderTest, AnchorElementNeverConnected) {}

TEST_F(AnchorElementMetricsSenderTest, RemoveAnchorElement) {}

TEST_F(AnchorElementMetricsSenderTest,
       RemoveAnchorElementWithoutMoreInsertions) {}

TEST_F(AnchorElementMetricsSenderTest, RemoveMultipleParents) {}

TEST_F(AnchorElementMetricsSenderTest, RemoveAnchorElementAfterLayout) {}

TEST_F(AnchorElementMetricsSenderTest, AnchorElementLeftViewport) {}

TEST_F(AnchorElementMetricsSenderTest,
       AnchorElementInteractionTrackerSendsPointerEvents) {}

TEST_F(AnchorElementMetricsSenderTest, AnchorElementEnteredViewportLater) {}

TEST_F(AnchorElementMetricsSenderTest, AnchorElementClicked) {}

TEST_F(AnchorElementMetricsSenderTest,
       ReportAnchorElementPointerDataOnHoverTimerFired) {}

TEST_F(AnchorElementMetricsSenderTest, MaxIntersectionObservations) {}

TEST_F(AnchorElementMetricsSenderTest, IntersectionObserverDelay) {}

TEST_F(AnchorElementMetricsSenderTest, PositionUpdate) {}

// TODO(crbug.com/347719430): This test can be removed if
// LocalFrameView::FrameToViewport supports local root subframes with local
// main frames.
TEST_F(AnchorElementMetricsSenderTest,
       PositionUpdate_IgnorePointerDownInsideLocalRootSubframe) {}

// TODO(crbug.com/347719430): This test can be removed if
// LocalFrameView::FrameToViewport supports local root subframes with local
// main frames.
TEST_F(AnchorElementMetricsSenderTest,
       PositionUpdate_NotComputedForAnchorInsideLocalRootSubframe) {}

TEST_F(AnchorElementMetricsSenderTest,
       PositionUpdate_BrowserTopControlsHeight) {}

// Regression test for crbug.com/352973572.
TEST_F(AnchorElementMetricsSenderTest, SubframeWithObservedAnchorsDetached) {}

TEST_F(AnchorElementMetricsSenderTest,
       AnchorsNotReportedAsRemovedWhenMainFrameIsDetached) {}

}  // namespace blink