From 8d568b12722f02dbb2ec358ce4600b96a673c481 Mon Sep 17 00:00:00 2001 From: sigbjornf Date: Wed, 24 Feb 2016 13:29:47 -0800 Subject: Have EventSender mouseups unwind better on cancellation during dragover. Follow up on changes brought by r376733 and check if handling of dragover cancelled our ongoing drag. Leave early, if so. R=dcheng,rbyers BUG=589426 Review URL: https://codereview.chromium.org/1728353002 Cr-Commit-Position: refs/heads/master@{#377392} --- components/test_runner/event_sender.cc | 18 +++++++++++------- ...rag-nested-eventSender-on-dragover-expected.txt | 9 +++++++++ .../drag-nested-eventSender-on-dragover.html | 22 ++++++++++++++++++++++ 3 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 third_party/WebKit/LayoutTests/fast/events/drag-nested-eventSender-on-dragover-expected.txt create mode 100644 third_party/WebKit/LayoutTests/fast/events/drag-nested-eventSender-on-dragover.html diff --git a/components/test_runner/event_sender.cc b/components/test_runner/event_sender.cc index 6e1df4f..31867c9 100644 --- a/components/test_runner/event_sender.cc +++ b/components/test_runner/event_sender.cc @@ -2594,13 +2594,17 @@ void EventSender::DoMouseUp(const WebMouseEvent& e) { WebPoint client_point(e.x, e.y); WebPoint screen_point(e.globalX, e.globalY); - FinishDragAndDrop( - e, - view_->dragTargetDragOver( - client_point, - screen_point, - current_drag_effects_allowed_, - e.modifiers)); + blink::WebDragOperation drag_effect = view_->dragTargetDragOver( + client_point, + screen_point, + current_drag_effects_allowed_, + e.modifiers); + + // Bail if dragover caused cancellation. + if (current_drag_data_.isNull()) + return; + + FinishDragAndDrop(e, drag_effect); } void EventSender::DoMouseMove(const WebMouseEvent& e) { diff --git a/third_party/WebKit/LayoutTests/fast/events/drag-nested-eventSender-on-dragover-expected.txt b/third_party/WebKit/LayoutTests/fast/events/drag-nested-eventSender-on-dragover-expected.txt new file mode 100644 index 0000000..a4f7be6 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/events/drag-nested-eventSender-on-dragover-expected.txt @@ -0,0 +1,9 @@ +Test that nested use of eventSender.beginDragWithFiles() from within |dragover| is handled without crashing. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/third_party/WebKit/LayoutTests/fast/events/drag-nested-eventSender-on-dragover.html b/third_party/WebKit/LayoutTests/fast/events/drag-nested-eventSender-on-dragover.html new file mode 100644 index 0000000..1eb5c9f --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/events/drag-nested-eventSender-on-dragover.html @@ -0,0 +1,22 @@ + + + + + + -- cgit v1.1