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

Side by Side Diff: ui/aura/gestures/gesture_recognizer_unittest.cc

Issue 189583007: Ensure Multi-finger tap generates both GestureScrollBegin and GestureScrollEnd. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Factor out scroll start logic. Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/events/gestures/gesture_sequence.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after
2655 // Make sure there is enough delay before the touch is released so that it is 2655 // Make sure there is enough delay before the touch is released so that it is
2656 // recognized as a tap. 2656 // recognized as a tap.
2657 delegate->Reset(); 2657 delegate->Reset();
2658 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), 2658 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
2659 kTouchId1, tes.LeapForward(50)); 2659 kTouchId1, tes.LeapForward(50));
2660 2660
2661 DispatchEventUsingWindowDispatcher(&release1); 2661 DispatchEventUsingWindowDispatcher(&release1);
2662 EXPECT_FALSE(delegate->tap()); 2662 EXPECT_FALSE(delegate->tap());
2663 EXPECT_FALSE(delegate->tap_down()); 2663 EXPECT_FALSE(delegate->tap_down());
2664 EXPECT_FALSE(delegate->tap_cancel()); 2664 EXPECT_FALSE(delegate->tap_cancel());
2665 EXPECT_FALSE(delegate->scroll_begin()); 2665 EXPECT_TRUE(delegate->scroll_begin());
2666 EXPECT_FALSE(delegate->scroll_update()); 2666 EXPECT_FALSE(delegate->scroll_update());
2667 EXPECT_FALSE(delegate->scroll_end()); 2667 EXPECT_FALSE(delegate->scroll_end());
2668 EXPECT_TRUE(delegate->two_finger_tap()); 2668 EXPECT_TRUE(delegate->two_finger_tap());
2669 2669
2670 // Lift second finger. 2670 // Lift second finger.
2671 // Make sure there is enough delay before the touch is released so that it is 2671 // Make sure there is enough delay before the touch is released so that it is
2672 // recognized as a tap. 2672 // recognized as a tap.
2673 delegate->Reset(); 2673 delegate->Reset();
2674 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201), 2674 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201),
2675 kTouchId2, tes.LeapForward(50)); 2675 kTouchId2, tes.LeapForward(50));
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
3227 kTouchId1, tes.Now()); 3227 kTouchId1, tes.Now());
3228 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201), 3228 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201),
3229 kTouchId2, tes.Now()); 3229 kTouchId2, tes.Now());
3230 DispatchEventUsingWindowDispatcher(&release1); 3230 DispatchEventUsingWindowDispatcher(&release1);
3231 DispatchEventUsingWindowDispatcher(&release2); 3231 DispatchEventUsingWindowDispatcher(&release2);
3232 3232
3233 EXPECT_FALSE(delegate->tap()); 3233 EXPECT_FALSE(delegate->tap());
3234 // Touch release is not consumed, so we still see two finger tap. 3234 // Touch release is not consumed, so we still see two finger tap.
3235 EXPECT_TRUE(delegate->two_finger_tap()); 3235 EXPECT_TRUE(delegate->two_finger_tap());
3236 3236
3237 // Should not see PinchEnd & ScrollEnd. 3237 // Should not see PinchEnd.
3238 EXPECT_FALSE(delegate->scroll_begin()); 3238 EXPECT_TRUE(delegate->scroll_begin());
3239 EXPECT_FALSE(delegate->scroll_update()); 3239 EXPECT_FALSE(delegate->scroll_update());
3240 EXPECT_FALSE(delegate->scroll_end()); 3240 EXPECT_FALSE(delegate->scroll_end());
3241 EXPECT_TRUE(delegate->fling());
3241 3242
3242 EXPECT_FALSE(delegate->pinch_begin()); 3243 EXPECT_FALSE(delegate->pinch_begin());
3243 EXPECT_FALSE(delegate->pinch_update()); 3244 EXPECT_FALSE(delegate->pinch_update());
3244 EXPECT_FALSE(delegate->pinch_end()); 3245 EXPECT_FALSE(delegate->pinch_end());
3245 } 3246 }
3246 3247
3247 // Like as GestureEventTouchMoveConsumed but tests the different behavior 3248 // Like as GestureEventTouchMoveConsumed but tests the different behavior
3248 // depending on whether the events were consumed before or after the scroll 3249 // depending on whether the events were consumed before or after the scroll
3249 // started. 3250 // started.
3250 TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) { 3251 TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
4090 DispatchEventUsingWindowDispatcher(&move3); 4091 DispatchEventUsingWindowDispatcher(&move3);
4091 delegate->ReceivedAckPreventDefaulted(); 4092 delegate->ReceivedAckPreventDefaulted();
4092 EXPECT_FALSE(delegate->scroll_begin()); 4093 EXPECT_FALSE(delegate->scroll_begin());
4093 EXPECT_FALSE(delegate->scroll_update()); 4094 EXPECT_FALSE(delegate->scroll_update());
4094 delegate->Reset(); 4095 delegate->Reset();
4095 } 4096 }
4096 } 4097 }
4097 4098
4098 } // namespace test 4099 } // namespace test
4099 } // namespace aura 4100 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ui/events/gestures/gesture_sequence.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698