#include "components/input/render_widget_host_input_event_router.h"
#include <memory>
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "components/input/render_widget_targeter.h"
#include "components/viz/common/hit_test/hit_test_query.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "components/viz/test/host_frame_sink_manager_test_api.h"
#include "content/browser/compositor/surface_utils.h"
#include "content/browser/renderer_host/agent_scheduling_group_host.h"
#include "content/browser/renderer_host/cross_process_frame_connector.h"
#include "content/browser/renderer_host/frame_token_message_queue.h"
#include "content/browser/renderer_host/render_widget_host_factory.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_child_frame.h"
#include "content/browser/site_instance_group.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/mock_render_process_host.h"
#include "content/public/test/test_browser_context.h"
#include "content/public/test/test_image_transport_factory.h"
#include "content/test/mock_render_widget_host_delegate.h"
#include "content/test/test_render_view_host.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/viz/public/mojom/hit_test/input_target_client.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/mojom/input/touch_event.mojom.h"
#if defined(USE_AURA)
#include "ui/aura/test/aura_test_helper.h"
#include "ui/aura/test/test_screen.h"
#include "ui/aura/window_tree_host.h"
#include "ui/gfx/mojom/delegated_ink_point_renderer.mojom.h"
#endif
namespace content {
namespace {
class MockFrameConnector : public CrossProcessFrameConnector { … };
class StubHitTestQuery : public viz::HitTestQuery { … };
class MockRootRenderWidgetHostView : public TestRenderWidgetHostView { … };
class MockInputTargetClient : public viz::mojom::InputTargetClient { … };
}
class RenderWidgetHostInputEventRouterTest : public testing::Test { … };
TEST_F(RenderWidgetHostInputEventRouterTest,
DoNotChangeTargetViewDuringTouchScrollGesture) { … }
TEST_F(RenderWidgetHostInputEventRouterTest,
EnsureRendererDestroyedHandlesUnAckedTouchEvents) { … }
TEST_F(RenderWidgetHostInputEventRouterTest, EnsureDroppedTouchEventsAreAcked) { … }
TEST_F(RenderWidgetHostInputEventRouterTest, DoNotCoalesceTouchEvents) { … }
TEST_F(RenderWidgetHostInputEventRouterTest, DoNotCoalesceGestureEvents) { … }
TEST_F(RenderWidgetHostInputEventRouterTest,
CancelScrollBubblingWhenChildDetaches) { … }
TEST_F(RenderWidgetHostInputEventRouterTest,
ContinueScrollBubblingWhenIrrelevantChildDetaches) { … }
TEST_F(RenderWidgetHostInputEventRouterTest,
FilteredGestureDoesntInterruptBubbling) { … }
void RenderWidgetHostInputEventRouterTest::TestSendNewGestureWhileBubbling(
TestRenderWidgetHostViewChildFrame* bubbling_origin,
RenderWidgetHostViewBase* gesture_target,
bool should_cancel) { … }
TEST_F(RenderWidgetHostInputEventRouterTest,
CancelBubblingOnNewGestureToBubblingTarget) { … }
TEST_F(RenderWidgetHostInputEventRouterTest,
CancelNestedBubblingOnNewGestureToBubblingTarget) { … }
TEST_F(RenderWidgetHostInputEventRouterTest,
CancelNestedBubblingOnNewGestureToIntermediateTarget) { … }
TEST_F(RenderWidgetHostInputEventRouterTest,
ContinueBubblingOnNewGestureToBubblingOrigin) { … }
TEST_F(RenderWidgetHostInputEventRouterTest, DoNotBubbleMultipleSequences) { … }
TEST_F(RenderWidgetHostInputEventRouterTest,
DoNotBubbleIfUnrelatedGestureInTarget) { … }
TEST_F(RenderWidgetHostInputEventRouterTest,
NestedDoNotBubbleIfUnrelatedGestureInTarget) { … }
TEST_F(RenderWidgetHostInputEventRouterTest,
DoNotSendMouseLeaveEventsForDisconnectedGuestView) { … }
TEST_F(RenderWidgetHostInputEventRouterTest, CanCallShowContextMenuAtPoint) { … }
TEST_F(RenderWidgetHostInputEventRouterTest,
EnsureAutoScrollLatchedTargetIsCleared) { … }
TEST_F(RenderWidgetHostInputEventRouterTest, QueryResultAfterChildViewDead) { … }
#if defined(USE_AURA)
class MockDelegatedInkPointRenderer
: public gfx::mojom::DelegatedInkPointRenderer { … };
class MockCompositor : public ui::Compositor { … };
enum TestEvent { … };
enum HoveringState { … };
class DelegatedInkPointTest
: public RenderWidgetHostInputEventRouterTest,
public testing::WithParamInterface<std::tuple<TestEvent, HoveringState>> { … };
struct DelegatedInkPointTestPassToString { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(DelegatedInkPointTest, EventForwardedToCompositor) { … }
TEST_P(DelegatedInkPointTest, MojoInterfaceReboundOnDisconnect) { … }
TEST_P(DelegatedInkPointTest, StopForwardingOnHoverStateChange) { … }
TEST_P(DelegatedInkPointTest, IgnoreEnterAndExitEvents) { … }
#if BUILDFLAG(IS_LINUX)
#define MAYBE_ForwardPointsToChildFrame …
#else
#define MAYBE_ForwardPointsToChildFrame …
#endif
TEST_P(DelegatedInkPointTest, MAYBE_ForwardPointsToChildFrame) { … }
#endif
}