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

Unified Diff: ui/aura/gestures/gesture_recognizer_unittest.cc

Issue 489213003: Prevent double acking of ignored touches (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switch to calling StopPropagation on ignored events. Created 6 years, 4 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 | « no previous file | ui/aura/window_event_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/gestures/gesture_recognizer_unittest.cc
diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc
index 0aeed63963f366d54f322002aa9acff468715461..7f86bfe7e98ea4d3cd82e1f17bbbb87a4922b004 100644
--- a/ui/aura/gestures/gesture_recognizer_unittest.cc
+++ b/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -4214,5 +4214,54 @@ TEST_F(GestureRecognizerTest, EagerGestureDetection) {
EXPECT_FALSE(delegate->long_press());
}
+// This tests crbug.com/405519, in which events which the gesture detector
+// ignores cause future events to also be thrown away.
+TEST_F(GestureRecognizerTest, IgnoredEventsDontPreventFutureEvents) {
+ scoped_ptr<QueueTouchEventDelegate> delegate(
+ new QueueTouchEventDelegate(host()->dispatcher()));
+ TimedEvents tes;
+ const int kWindowWidth = 300;
+ const int kWindowHeight = 400;
+ const int kTouchId1 = 3;
+ gfx::Rect bounds(5, 5, kWindowWidth, kWindowHeight);
+ scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
+ delegate.get(), -1234, bounds, root_window()));
+ delegate->set_window(window.get());
+
+ ui::TouchEvent press1(
+ ui::ET_TOUCH_PRESSED, gfx::Point(101, 301), kTouchId1, tes.Now());
+ DispatchEventUsingWindowDispatcher(&press1);
+ delegate->ReceivedAck();
+
+ EXPECT_2_EVENTS(
+ delegate->events(), ui::ET_GESTURE_BEGIN, ui::ET_GESTURE_TAP_DOWN);
+
+ // Move the first finger.
+ delegate->Reset();
+ ui::TouchEvent move1(
+ ui::ET_TOUCH_MOVED, gfx::Point(65, 201), kTouchId1, tes.Now());
+ DispatchEventUsingWindowDispatcher(&move1);
+ delegate->ReceivedAck();
+
+ EXPECT_3_EVENTS(delegate->events(),
+ ui::ET_GESTURE_TAP_CANCEL,
+ ui::ET_GESTURE_SCROLL_BEGIN,
+ ui::ET_GESTURE_SCROLL_UPDATE);
+
+ delegate->Reset();
+ ui::TouchEvent move2(
+ ui::ET_TOUCH_MOVED, gfx::Point(65, 202), kTouchId1, tes.Now());
+ DispatchEventUsingWindowDispatcher(&move2);
+
+ // Send a touchmove event at the same location as the previous touchmove
+ // event. This shouldn't do anything.
+ ui::TouchEvent move3(
+ ui::ET_TOUCH_MOVED, gfx::Point(65, 202), kTouchId1, tes.Now());
+ DispatchEventUsingWindowDispatcher(&move3);
+
+ delegate->ReceivedAck();
+ EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE);
+}
+
} // namespace test
} // namespace aura
« no previous file with comments | « no previous file | ui/aura/window_event_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698