Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5307)

Unified Diff: chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc

Issue 2577553002: Wait for mousemove DOM event, before simulating mousedown for dragstart tests. (Closed)
Patch Set: Expanded a comment as suggested by lfg@ (to refer to bug 647378). Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/drag_and_drop/image_source.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc
diff --git a/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc b/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc
index 1b18839666aaf3bdd3c2653f9c0a9f2128fbd857..03a456cc1e7c6eaeb957d51b8c54131138d36206 100644
--- a/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc
+++ b/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc
@@ -579,8 +579,27 @@ class DragAndDropBrowserTest : public InProcessBrowserTest,
bool SimulateMouseDownAndDragStartInLeftFrame() {
AssertTestPageIsLoaded();
- if (!SimulateMouseMove(kMiddleOfLeftFrame) || !SimulateMouseDown() ||
- !SimulateMouseMove(expected_location_of_drag_start_in_left_frame()))
+
+ // Waiting until the mousemove and mousedown events reach the right renderer
+ // is needed to avoid flakiness reported in https://crbug.com/671445 (which
+ // has its root cause in https://crbug.com/647378). Once the latter bug
+ // is fixed, we should no longer need to wait for these events (because
+ // fixing https://crbug.com/647378 should guarantee that events arrive
+ // to the renderer in the right order).
+ DOMDragEventWaiter mouse_move_event_waiter("mousemove", left_frame());
+ DOMDragEventWaiter mouse_down_event_waiter("mousedown", left_frame());
+
+ if (!SimulateMouseMove(kMiddleOfLeftFrame))
+ return false;
+ if (!mouse_move_event_waiter.WaitForNextMatchingEvent(nullptr))
+ return false;
+
+ if (!SimulateMouseDown())
+ return false;
+ if (!mouse_down_event_waiter.WaitForNextMatchingEvent(nullptr))
+ return false;
+
+ if (!SimulateMouseMove(expected_location_of_drag_start_in_left_frame()))
return false;
return true;
« no previous file with comments | « no previous file | chrome/test/data/drag_and_drop/image_source.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698