diff options
author | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-27 21:42:02 +0000 |
---|---|---|
committer | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-27 21:42:02 +0000 |
commit | 73d632d4106e990cfc085f53877cb1d93067e837 (patch) | |
tree | 86bccced20202b2b35ee4bf747c960b6f1fd30b2 /ash/drag_drop/drag_drop_controller_unittest.cc | |
parent | f0901a25d3f19c9a3f1fccc0d6479ce2ba5ac377 (diff) | |
download | chromium_src-73d632d4106e990cfc085f53877cb1d93067e837.zip chromium_src-73d632d4106e990cfc085f53877cb1d93067e837.tar.gz chromium_src-73d632d4106e990cfc085f53877cb1d93067e837.tar.bz2 |
ash: Stop propagation of gesture events when drag drop is in progress.
BUG=236493
Review URL: https://chromiumcodereview.appspot.com/15889009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202467 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/drag_drop/drag_drop_controller_unittest.cc')
-rw-r--r-- | ash/drag_drop/drag_drop_controller_unittest.cc | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc index 822dede..91cb67c 100644 --- a/ash/drag_drop/drag_drop_controller_unittest.cc +++ b/ash/drag_drop/drag_drop_controller_unittest.cc @@ -286,6 +286,32 @@ void DispatchGesture(ui::EventType gesture_type, gfx::Point location) { Shell::GetPrimaryRootWindow()->DispatchGestureEvent(&gesture_event); } +bool IsGestureEventType(ui::EventType type) { + switch (type) { + case ui::ET_GESTURE_SCROLL_BEGIN: + case ui::ET_GESTURE_SCROLL_END: + case ui::ET_GESTURE_SCROLL_UPDATE: + case ui::ET_GESTURE_TAP: + case ui::ET_GESTURE_TAP_CANCEL: + case ui::ET_GESTURE_TAP_DOWN: + case ui::ET_GESTURE_BEGIN: + case ui::ET_GESTURE_END: + case ui::ET_GESTURE_TWO_FINGER_TAP: + case ui::ET_GESTURE_PINCH_BEGIN: + case ui::ET_GESTURE_PINCH_END: + case ui::ET_GESTURE_PINCH_UPDATE: + case ui::ET_GESTURE_LONG_PRESS: + case ui::ET_GESTURE_LONG_TAP: + case ui::ET_GESTURE_MULTIFINGER_SWIPE: + case ui::ET_SCROLL_FLING_CANCEL: + case ui::ET_SCROLL_FLING_START: + return true; + default: + break; + } + return false; +} + } // namespace class DragDropControllerTest : public AshTestBase { @@ -1148,7 +1174,29 @@ TEST_F(DragDropControllerTest, gesture_location.Offset(1, 0); handler.Reset(); DispatchGesture(ui::ET_GESTURE_SCROLL_UPDATE, gesture_location); - EXPECT_TRUE(handler.handled_event_received()); + EXPECT_FALSE(handler.handled_event_received()); + EXPECT_FALSE(handler.unhandled_event_received()); + + // Execute any scheduled draws to process deferred mouse events. + RunAllPendingInMessageLoop(); + } + + // Handler should not receive any other gestures that DragDropController + // does not care about. + std::set<ui::EventType> drag_drop_gestures; + drag_drop_gestures.insert(ui::ET_GESTURE_SCROLL_UPDATE); + drag_drop_gestures.insert(ui::ET_GESTURE_SCROLL_END); + drag_drop_gestures.insert(ui::ET_GESTURE_LONG_TAP); + drag_drop_gestures.insert(ui::ET_SCROLL_FLING_START); + for (ui::EventType type = ui::ET_UNKNOWN; type < ui::ET_LAST; + type = static_cast<ui::EventType>(type + 1)) { + if (!IsGestureEventType(type) || + drag_drop_gestures.find(type) != drag_drop_gestures.end()) + continue; + + handler.Reset(); + DispatchGesture(ui::ET_GESTURE_SCROLL_UPDATE, gesture_location); + EXPECT_FALSE(handler.handled_event_received()); EXPECT_FALSE(handler.unhandled_event_received()); // Execute any scheduled draws to process deferred mouse events. |