Commit fe1387c3 authored by W. James MacLean's avatar W. James MacLean Committed by Commit Bot

Add input event observer to generate stack trace in flakey test.

This CL temporarily adds an InputEventObserver for TouchMoves on
RenderWidgetHost to try and detect the source of spurious TouchMove
events in the Windows flakes of
SitePerProcessEmulatedTouchBrowserTest.EmulatedTouchShowPressHasTouchID.

Bug: 833380
Change-Id: Ia3d6f75013acbbc9ed1a823c799741e2c64d2253
Reviewed-on: https://chromium-review.googlesource.com/1188876Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Commit-Queue: James MacLean <wjmaclean@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586018}
parent 1530edb9
...@@ -57,6 +57,10 @@ ...@@ -57,6 +57,10 @@
#include "content/test/mock_overscroll_refresh_handler_android.h" #include "content/test/mock_overscroll_refresh_handler_android.h"
#endif #endif
#if defined(OS_WIN)
#include "base/debug/stack_trace.h"
#endif
namespace content { namespace content {
namespace { namespace {
...@@ -1200,6 +1204,36 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessHitTestBrowserTest, ...@@ -1200,6 +1204,36 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessHitTestBrowserTest,
root_scroll_begin_observer.Wait(); root_scroll_begin_observer.Wait();
} }
#if defined(OS_WIN)
// Add temporary TouchMove event observer to detect spurious TouchMove events
// leading to test flake.
// https://crbug.com/833380.
class EmulatedTouchTouchMoveInputObserver
: public RenderWidgetHost::InputEventObserver {
public:
explicit EmulatedTouchTouchMoveInputObserver(RenderWidgetHost* host)
: host_(host), first_touch_move_seen_(false) {
host_->AddInputEventObserver(this);
}
~EmulatedTouchTouchMoveInputObserver() override {
host_->RemoveInputEventObserver(this);
}
void OnInputEvent(const blink::WebInputEvent& event) override {
if (event.GetType() != blink::WebInputEvent::kTouchMove ||
first_touch_move_seen_) {
return;
}
first_touch_move_seen_ = true;
base::debug::StackTrace().Print();
}
private:
RenderWidgetHost* host_;
bool first_touch_move_seen_;
};
#endif
class SitePerProcessEmulatedTouchBrowserTest class SitePerProcessEmulatedTouchBrowserTest
: public SitePerProcessHitTestBrowserTest { : public SitePerProcessHitTestBrowserTest {
public: public:
...@@ -1349,6 +1383,17 @@ class SitePerProcessEmulatedTouchBrowserTest ...@@ -1349,6 +1383,17 @@ class SitePerProcessEmulatedTouchBrowserTest
simulated_event_time += simulated_event_time_delta; simulated_event_time += simulated_event_time_delta;
mouse_up_event.SetTimeStamp(simulated_event_time); mouse_up_event.SetTimeStamp(simulated_event_time);
#if defined(OS_WIN)
// Add temporary TouchMove event observer to detect spurious TouchMove
// events leading to test flake.
// https://crbug.com/833380.
std::unique_ptr<EmulatedTouchTouchMoveInputObserver> touch_move_observer;
if (test_type == ShowPressHasTouchID) {
touch_move_observer.reset(new EmulatedTouchTouchMoveInputObserver(
child_rwhv->GetRenderWidgetHost()));
}
#endif
// Send mouse events and wait for GesturePinchBegin. // Send mouse events and wait for GesturePinchBegin.
router->RouteMouseEvent(root_rwhv, &mouse_move_event, ui::LatencyInfo()); router->RouteMouseEvent(root_rwhv, &mouse_move_event, ui::LatencyInfo());
router->RouteMouseEvent(root_rwhv, &mouse_down_event, ui::LatencyInfo()); router->RouteMouseEvent(root_rwhv, &mouse_down_event, ui::LatencyInfo());
...@@ -1356,6 +1401,9 @@ class SitePerProcessEmulatedTouchBrowserTest ...@@ -1356,6 +1401,9 @@ class SitePerProcessEmulatedTouchBrowserTest
// Wait for child to receive GestureShowPress. If this test fails, it // Wait for child to receive GestureShowPress. If this test fails, it
// will either DCHECK or time out. // will either DCHECK or time out.
child_gesture_event_observer.Wait(); child_gesture_event_observer.Wait();
#if defined(OS_WIN)
touch_move_observer.reset();
#endif
return; return;
} }
router->RouteMouseEvent(root_rwhv, &mouse_drag_event, ui::LatencyInfo()); router->RouteMouseEvent(root_rwhv, &mouse_drag_event, ui::LatencyInfo());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment