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

Unified Diff: ash/drag_drop/drag_drop_controller_unittest.cc

Issue 15889009: ash: Stop propagation of gesture events when drag drop is in progress. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 7 months 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 | « ash/drag_drop/drag_drop_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/drag_drop/drag_drop_controller_unittest.cc
diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc
index 822dedee07c1731e0fce4a3ba087f77042e53786..91cb67cd99234df83a791375717d5a5c7ec0325d 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.
« no previous file with comments | « ash/drag_drop/drag_drop_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698