Create InputHandlerProxy in LayoutTests

In LayoutTests, the compositor is run in "single threaded" mode. This
means there is no compositor thread and the compositor runs on the same
thread as Blink.

Until now, input handling code would have branches based on whether we
have a compositor thread. If no compositor thread existed, we would
forward input directly to Blink by going through
RenderWidgetInputHandler. This never happens (for frames) in shipped
Chrome, where input always flows through InputHandlerProxy and, if it
requires handling on the main thread, is returned and potentially
queued for rAF before being dispatched to Blink from IHP.

In this CL, we create an InputHandlerProxy even if we're in single
threaded mode. In this case, we'll use the same "fallback to main" logic
that's used in production. This should provide more consistency in
behavior with how we operate in production. It will also allow us to
(in a future CL) test compositor-side input handling without having to
run layout tests in threaded mode, which is what we currently do for
input features that have a compositor-side implementation.

We still avoid using the cc input handler for non-frame RenderWidgets
like popups and plugins since they don't use a compositor. Input
handling is unchanged in these cases.

In single-thread/layout-test mode, this CL makes InputHandlerProxy
force all events to the main thread. In a future CL, we'll make this
parameterized based on which side of the divide tests want to operate on.

Finally, this CL changes behavior in some tests so we update the
expectations. Now that we take the "real" path to the main thread,
events get coalesced and scheduled based on event handler presence
as they would in the real world so this is expected.

Bug: 915926
Change-Id: Ic0e0f0c88b142f109dab31df1f9bac63d5597237
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1390330
Reviewed-by: Stefan Zager <[email protected]>
Reviewed-by: danakj <[email protected]>
Commit-Queue: David Bokan <[email protected]>
Cr-Commit-Position: refs/heads/master@{#640195}
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 87624c06..cf5c16da 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -566,9 +566,14 @@
         compositor_thread_scheduler->InputTaskRunner();
   }
 
+  // We only use an external input handler for frame RenderWidgets because only
+  // frames use the compositor for input handling. Other kinds of RenderWidgets
+  // (e.g.  popups, plugins) must forward their input directly through
+  // RenderWidgetInputHandler into Blink.
+  bool uses_input_handler = for_frame();
   widget_input_handler_manager_ = WidgetInputHandlerManager::Create(
       weak_ptr_factory_.GetWeakPtr(), std::move(compositor_input_task_runner),
-      main_thread_scheduler);
+      main_thread_scheduler, uses_input_handler);
 
   show_callback_ = std::move(show_callback);