#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <tuple>
#include <utility>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "cc/mojom/render_frame_metadata.mojom.h"
#include "cc/trees/render_frame_metadata.h"
#include "components/input/switches.h"
#include "components/viz/common/surfaces/local_surface_id.h"
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
#include "components/viz/test/begin_frame_args_test.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/browser/renderer_host/data_transfer_util.h"
#include "content/browser/renderer_host/display_feature.h"
#include "content/browser/renderer_host/frame_token_message_queue.h"
#include "content/browser/renderer_host/input/touch_emulator_impl.h"
#include "content/browser/renderer_host/mock_render_widget_host.h"
#include "content/browser/renderer_host/render_view_host_delegate_view.h"
#include "content/browser/renderer_host/render_widget_host_delegate.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/renderer_host/visible_time_request_trigger.h"
#include "content/browser/site_instance_group.h"
#include "content/browser/storage_partition_impl.h"
#include "content/common/content_constants_internal.h"
#include "content/public/browser/keyboard_event_processing_result.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/drop_data.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/test/mock_render_input_router.h"
#include "content/test/mock_widget.h"
#include "content/test/mock_widget_input_handler.h"
#include "content/test/stub_render_widget_host_owner_delegate.h"
#include "content/test/test_render_view_host.h"
#include "content/test/test_render_widget_host.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "skia/ext/skia_utils_base.h"
#include "testing/gmock/include/gmock/gmock.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/common/page/page_zoom.h"
#include "third_party/blink/public/common/widget/visual_properties.h"
#include "third_party/blink/public/mojom/drag/drag.mojom.h"
#include "third_party/blink/public/mojom/input/input_handler.mojom-shared.h"
#include "third_party/blink/public/mojom/input/touch_event.mojom.h"
#include "ui/base/cursor/cursor.h"
#include "ui/display/display_util.h"
#include "ui/display/screen.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/blink/blink_features.h"
#include "ui/events/blink/web_input_event_traits.h"
#include "ui/events/gesture_detection/gesture_provider_config_helper.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/canvas.h"
#if BUILDFLAG(IS_ANDROID)
#include "base/strings/utf_string_conversions.h"
#include "content/browser/renderer_host/render_widget_host_view_android.h"
#include "ui/android/screen_android.h"
#endif
#if BUILDFLAG(IS_MAC)
#include "content/browser/renderer_host/test_render_widget_host_view_mac_factory.h"
#include "ui/display/test/test_screen.h"
#endif
#if BUILDFLAG(IS_IOS)
#include "content/browser/renderer_host/test_render_widget_host_view_ios_factory.h"
#endif
#if defined(USE_AURA) || BUILDFLAG(IS_APPLE)
#include "content/public/test/test_image_transport_factory.h"
#endif
#if defined(USE_AURA)
#include "content/browser/renderer_host/render_widget_host_view_aura.h"
#include "content/common/input/events_helper.h"
#include "ui/aura/test/test_screen.h"
#include "ui/events/event.h"
#endif
WebGestureDevice;
WebGestureEvent;
WebInputEvent;
WebKeyboardEvent;
WebMouseEvent;
WebMouseWheelEvent;
WebTouchEvent;
_;
Return;
namespace content {
namespace {
class RenderWidgetHostProcess : public MockRenderProcessHost { … };
class TestView : public TestRenderWidgetHostView { … };
class MockRenderViewHostDelegateView : public RenderViewHostDelegateView { … };
class FakeRenderFrameMetadataObserver
: public cc::mojom::RenderFrameMetadataObserver { … };
FakeRenderFrameMetadataObserver::FakeRenderFrameMetadataObserver(
mojo::PendingReceiver<cc::mojom::RenderFrameMetadataObserver> receiver,
mojo::PendingRemote<cc::mojom::RenderFrameMetadataObserverClient>
client_remote)
: … { … }
class MockInputEventObserver : public RenderWidgetHost::InputEventObserver { … };
class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { … };
class MockRenderWidgetHostOwnerDelegate
: public StubRenderWidgetHostOwnerDelegate { … };
class RenderWidgetHostTest : public testing::Test { … };
class RenderWidgetHostWithSourceTest
: public RenderWidgetHostTest,
public testing::WithParamInterface<WebGestureDevice> { … };
}
TEST_F(RenderWidgetHostTest, DoNotAcceptPopupBoundsUntilScreenRectsAcked) { … }
TEST_F(RenderWidgetHostTest, SynchronizeVisualProperties) { … }
TEST_F(RenderWidgetHostTest, ResizeScreenInfo) { … }
TEST_F(RenderWidgetHostTest, ScreenSizeInFullscreen) { … }
TEST_F(RenderWidgetHostTest, RootViewportSegments) { … }
TEST_F(RenderWidgetHostTest, ReceiveFrameTokenFromCrashedRenderer) { … }
TEST_F(RenderWidgetHostTest, ReceiveFrameTokenFromDeletedRenderWidget) { … }
TEST_F(RenderWidgetHostTest, Background) { … }
TEST_F(RenderWidgetHostTest, HideShowMessages) { … }
TEST_F(RenderWidgetHostTest, IgnoreKeyEventsHandledByRenderer) { … }
TEST_F(RenderWidgetHostTest, SendEditCommandsBeforeKeyEvent) { … }
TEST_F(RenderWidgetHostTest, PreHandleRawKeyDownEvent) { … }
TEST_F(RenderWidgetHostTest, RawKeyDownShortcutEvent) { … }
TEST_F(RenderWidgetHostTest, UnhandledWheelEvent) { … }
TEST_F(RenderWidgetHostTest, HandleWheelEvent) { … }
TEST_F(RenderWidgetHostTest, EventsCausingFocus) { … }
TEST_F(RenderWidgetHostTest, UnhandledGestureEvent) { … }
TEST_F(RenderWidgetHostTest, DontPostponeInputEventAckTimeout) { … }
TEST_F(RenderWidgetHostTest, StopAndStartInputEventAckTimeout) { … }
TEST_F(RenderWidgetHostTest, InputEventAckTimeoutDisabledForInputWhenHidden) { … }
TEST_F(RenderWidgetHostTest, MultipleInputEvents) { … }
TEST_F(RenderWidgetHostTest, IgnoreInputEvent) { … }
TEST_F(RenderWidgetHostTest, KeyboardListenerIgnoresEvent) { … }
TEST_F(RenderWidgetHostTest, KeyboardListenerSuppressFollowingEvents) { … }
TEST_F(RenderWidgetHostTest, MouseEventCallbackCanHandleEvent) { … }
TEST_F(RenderWidgetHostTest, InputRouterReceivesHasTouchEventHandlers) { … }
void CheckLatencyInfoComponentInMessage(
MockWidgetInputHandler::MessageVector& dispatched_events,
WebInputEvent::Type expected_type) { … }
void CheckLatencyInfoComponentInGestureScrollUpdate(
MockWidgetInputHandler::MessageVector& dispatched_events) { … }
TEST_F(RenderWidgetHostTest, InputEventRWHLatencyComponent) { … }
TEST_F(RenderWidgetHostTest, RendererExitedResetsInputRouter) { … }
TEST_F(RenderWidgetHostTest, DestroyingRenderWidgetResetsInputRouter) { … }
TEST_F(RenderWidgetHostTest, RendererExitedResetsScreenRectsAck) { … }
TEST_F(RenderWidgetHostTest, DestroyingRenderWidgetResetsScreenRectsAck) { … }
TEST_F(RenderWidgetHostTest, RendererExitedResetsIsHidden) { … }
TEST_F(RenderWidgetHostTest, VisualProperties) { … }
TEST_F(RenderWidgetHostTest, RendererExitedNoDrag) { … }
class RenderWidgetHostInitialSizeTest : public RenderWidgetHostTest { … };
TEST_F(RenderWidgetHostInitialSizeTest, InitialSize) { … }
TEST_F(RenderWidgetHostTest, HideUnthrottlesResize) { … }
TEST_F(RenderWidgetHostTest, EventDispatchPostDetach) { … }
TEST_F(RenderWidgetHostTest, NavigateInBackgroundShowsBlank) { … }
TEST_F(RenderWidgetHostTest, PendingUserActivationTimeout) { … }
TEST_F(RenderWidgetHostTest, NoFlingEventsWhenLastScrollEventConsumed) { … }
TEST_F(RenderWidgetHostTest, FlingEventsWhenSomeScrollEventsConsumed) { … }
TEST_F(RenderWidgetHostTest, AddAndRemoveInputEventObserver) { … }
TEST_F(RenderWidgetHostTest, ScopedObservationWithInputEventObserver) { … }
#if BUILDFLAG(IS_ANDROID)
TEST_F(RenderWidgetHostTest, AddAndRemoveImeInputEventObserver) {
MockInputEventObserver observer;
host_->AddImeInputEventObserver(&observer);
EXPECT_CALL(observer, OnImeFinishComposingTextEvent()).Times(1);
host_->ImeFinishComposingText(true);
host_->RemoveImeInputEventObserver(&observer);
EXPECT_CALL(observer, OnImeFinishComposingTextEvent()).Times(0);
host_->ImeFinishComposingText(true);
}
#endif
TEST_F(RenderWidgetHostTest, OnVerticalScrollDirectionChanged) { … }
TEST_F(RenderWidgetHostTest, SetCursorWithBitmap) { … }
}