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

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

Issue 10834283: gesture recognizer: Some cleanup and workaround for a crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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/base/gestures/gesture_recognizer_impl.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 4328cf63b11aa9a1c4d241e56294a2244e9b7c79..406b79c0b4637861d7f32bf890764cb1d4080ef4 100644
--- a/ui/aura/gestures/gesture_recognizer_unittest.cc
+++ b/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -1878,7 +1878,7 @@ TEST_F(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) {
EXPECT_FALSE(delegate->tap());
}
-TEST_F(GestureRecognizerTest, CaptureSendsTapUp) {
+TEST_F(GestureRecognizerTest, CaptureSendsGestureEnd) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
TestGestureRecognizer* gesture_recognizer =
@@ -1903,6 +1903,33 @@ TEST_F(GestureRecognizerTest, CaptureSendsTapUp) {
EXPECT_TRUE(delegate->end());
}
+TEST_F(GestureRecognizerTest, PressDoesNotCrash) {
+ scoped_ptr<GestureEventConsumeDelegate> delegate(
+ new GestureEventConsumeDelegate());
+ TestGestureRecognizer* gesture_recognizer =
+ new TestGestureRecognizer(root_window());
+ root_window()->SetGestureRecognizerForTesting(gesture_recognizer);
+
+ scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
+ delegate.get(), -1234, gfx::Rect(10, 10, 300, 300), NULL));
+
+ ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(45, 45), 7, GetTime());
+ press.set_radius_x(40);
+ root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ EXPECT_TRUE(delegate->tap_down());
+ EXPECT_EQ(gfx::Rect(5, 5, 80, 80).ToString(),
+ delegate->bounding_box().ToString());
+ delegate->Reset();
+
+ ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(55, 45), 7, GetTime());
+ root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+
+ // This new press should not generate a tap-down.
+ EXPECT_FALSE(delegate->begin());
+ EXPECT_FALSE(delegate->tap_down());
+ EXPECT_FALSE(delegate->scroll_begin());
+}
+
TEST_F(GestureRecognizerTest, TwoFingerTap) {
scoped_ptr<GestureEventConsumeDelegate> delegate(
new GestureEventConsumeDelegate());
« no previous file with comments | « no previous file | ui/base/gestures/gesture_recognizer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698