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

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

Issue 2058723003: Slop region check for multi-finger scroll (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 2558 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 delegate->events(), ui::ET_GESTURE_BEGIN, ui::ET_GESTURE_TAP_DOWN); 2569 delegate->events(), ui::ET_GESTURE_BEGIN, ui::ET_GESTURE_TAP_DOWN);
2570 2570
2571 delegate->Reset(); 2571 delegate->Reset();
2572 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201), 2572 ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
2573 kTouchId2, tes.Now()); 2573 kTouchId2, tes.Now());
2574 DispatchEventUsingWindowDispatcher(&press2); 2574 DispatchEventUsingWindowDispatcher(&press2);
2575 EXPECT_2_EVENTS( 2575 EXPECT_2_EVENTS(
2576 delegate->events(), ui::ET_GESTURE_TAP_CANCEL, ui::ET_GESTURE_BEGIN); 2576 delegate->events(), ui::ET_GESTURE_TAP_CANCEL, ui::ET_GESTURE_BEGIN);
2577 2577
2578 // Little bit of touch move should not affect our state. 2578 // Little bit of touch move should not affect our state.
2579 // Moving within slop region doesn't cause scrolling.
2579 delegate->Reset(); 2580 delegate->Reset();
2580 ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(102, 202), 2581 ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(102, 202),
2581 kTouchId1, tes.Now()); 2582 kTouchId1, tes.Now());
2582 DispatchEventUsingWindowDispatcher(&move1); 2583 DispatchEventUsingWindowDispatcher(&move1);
2583 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(131, 202), 2584 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(131, 202),
2584 kTouchId2, tes.Now()); 2585 kTouchId2, tes.Now());
2585 DispatchEventUsingWindowDispatcher(&move2); 2586 DispatchEventUsingWindowDispatcher(&move2);
2586 EXPECT_3_EVENTS(delegate->events(), ui::ET_GESTURE_SCROLL_BEGIN, 2587 EXPECT_0_EVENTS(delegate->events());
2587 ui::ET_GESTURE_SCROLL_UPDATE, ui::ET_GESTURE_SCROLL_UPDATE);
2588 2588
2589 // Make sure there is enough delay before the touch is released so that it is 2589 // Make sure there is enough delay before the touch is released so that it is
2590 // recognized as a tap. 2590 // recognized as a tap.
2591 delegate->Reset(); 2591 delegate->Reset();
2592 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201), 2592 ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
2593 kTouchId1, tes.LeapForward(50)); 2593 kTouchId1, tes.LeapForward(50));
2594 2594
2595 DispatchEventUsingWindowDispatcher(&release1); 2595 DispatchEventUsingWindowDispatcher(&release1);
2596 EXPECT_2_EVENTS( 2596 EXPECT_2_EVENTS(
2597 delegate->events(), ui::ET_GESTURE_TWO_FINGER_TAP, ui::ET_GESTURE_END); 2597 delegate->events(), ui::ET_GESTURE_TWO_FINGER_TAP, ui::ET_GESTURE_END);
2598 2598
2599 // Lift second finger. 2599 // Lift second finger.
2600 // Make sure there is enough delay before the touch is released so that it is 2600 // Two fingers have been down at some point during the current touch,
2601 // recognized as a tap. 2601 // single tap doesn't happen while releasing the second finger.
2602 delegate->Reset(); 2602 delegate->Reset();
2603 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201), 2603 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201),
2604 kTouchId2, tes.LeapForward(50)); 2604 kTouchId2, tes.LeapForward(50));
2605 2605
2606 DispatchEventUsingWindowDispatcher(&release2); 2606 DispatchEventUsingWindowDispatcher(&release2);
2607 EXPECT_2_EVENTS( 2607 EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_END);
2608 delegate->events(), ui::ET_GESTURE_SCROLL_END, ui::ET_GESTURE_END);
2609 } 2608 }
2610 2609
2611 TEST_F(GestureRecognizerTest, TwoFingerTapExpired) { 2610 TEST_F(GestureRecognizerTest, TwoFingerTapExpired) {
2612 std::unique_ptr<GestureEventConsumeDelegate> delegate( 2611 std::unique_ptr<GestureEventConsumeDelegate> delegate(
2613 new GestureEventConsumeDelegate()); 2612 new GestureEventConsumeDelegate());
2614 const int kWindowWidth = 123; 2613 const int kWindowWidth = 123;
2615 const int kWindowHeight = 45; 2614 const int kWindowHeight = 45;
2616 const int kTouchId1 = 2; 2615 const int kTouchId1 = 2;
2617 const int kTouchId2 = 3; 2616 const int kTouchId2 = 3;
2618 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); 2617 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight);
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after
4442 EXPECT_FALSE(queued_delegate2->long_press()); 4441 EXPECT_FALSE(queued_delegate2->long_press());
4443 4442
4444 queued_delegate->Reset(); 4443 queued_delegate->Reset();
4445 queued_delegate->WaitUntilReceivedGesture(ui::ET_GESTURE_SHOW_PRESS); 4444 queued_delegate->WaitUntilReceivedGesture(ui::ET_GESTURE_SHOW_PRESS);
4446 EXPECT_TRUE(queued_delegate->show_press()); 4445 EXPECT_TRUE(queued_delegate->show_press());
4447 EXPECT_FALSE(queued_delegate->tap_down()); 4446 EXPECT_FALSE(queued_delegate->tap_down());
4448 } 4447 }
4449 4448
4450 } // namespace test 4449 } // namespace test
4451 } // namespace aura 4450 } // namespace aura
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/stylus_text_selector.cc ('k') | ui/events/gesture_detection/gesture_detector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698