| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 bool HasDownEvent() const { return gesture_provider_->current_down_event(); } | 276 bool HasDownEvent() const { return gesture_provider_->current_down_event(); } |
| 277 | 277 |
| 278 protected: | 278 protected: |
| 279 void CheckScrollEventSequenceForEndActionType( | 279 void CheckScrollEventSequenceForEndActionType( |
| 280 MotionEvent::Action end_action_type) { | 280 MotionEvent::Action end_action_type) { |
| 281 base::TimeTicks event_time = base::TimeTicks::Now(); | 281 base::TimeTicks event_time = base::TimeTicks::Now(); |
| 282 const float scroll_to_x = kFakeCoordX + 100; | 282 const float scroll_to_x = kFakeCoordX + 100; |
| 283 const float scroll_to_y = kFakeCoordY + 100; | 283 const float scroll_to_y = kFakeCoordY + 100; |
| 284 int motion_event_id = 3; | 284 int motion_event_id = 3; |
| 285 int motion_event_flags = EF_SHIFT_DOWN | EF_CAPS_LOCK_DOWN; | 285 int motion_event_flags = EF_SHIFT_DOWN | EF_CAPS_LOCK_ON; |
| 286 | 286 |
| 287 MockMotionEvent event = | 287 MockMotionEvent event = |
| 288 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); | 288 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); |
| 289 event.SetPrimaryPointerId(motion_event_id); | 289 event.SetPrimaryPointerId(motion_event_id); |
| 290 event.set_flags(motion_event_flags); | 290 event.set_flags(motion_event_flags); |
| 291 | 291 |
| 292 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 292 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
| 293 EXPECT_EQ(motion_event_flags, GetMostRecentGestureEvent().flags); | 293 EXPECT_EQ(motion_event_flags, GetMostRecentGestureEvent().flags); |
| 294 | 294 |
| 295 event = ObtainMotionEvent(event_time + kOneSecond, | 295 event = ObtainMotionEvent(event_time + kOneSecond, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points()); | 460 EXPECT_EQ(1, GetMostRecentGestureEvent().details.touch_points()); |
| 461 EXPECT_EQ(BoundsForSingleMockTouchAtLocation(kFakeCoordX, kFakeCoordY), | 461 EXPECT_EQ(BoundsForSingleMockTouchAtLocation(kFakeCoordX, kFakeCoordY), |
| 462 GetMostRecentGestureEvent().details.bounding_box_f()); | 462 GetMostRecentGestureEvent().details.bounding_box_f()); |
| 463 } | 463 } |
| 464 | 464 |
| 465 // Verify that a DOWN followed shortly by an UP will trigger | 465 // Verify that a DOWN followed shortly by an UP will trigger |
| 466 // a ET_GESTURE_TAP_UNCONFIRMED event if double-tap is enabled. | 466 // a ET_GESTURE_TAP_UNCONFIRMED event if double-tap is enabled. |
| 467 TEST_F(GestureProviderTest, GestureTapWithDelay) { | 467 TEST_F(GestureProviderTest, GestureTapWithDelay) { |
| 468 base::TimeTicks event_time = base::TimeTicks::Now(); | 468 base::TimeTicks event_time = base::TimeTicks::Now(); |
| 469 int motion_event_id = 6; | 469 int motion_event_id = 6; |
| 470 int motion_event_flags = EF_CONTROL_DOWN | EF_ALT_DOWN | EF_CAPS_LOCK_DOWN; | 470 int motion_event_flags = EF_CONTROL_DOWN | EF_ALT_DOWN | EF_CAPS_LOCK_ON; |
| 471 | 471 |
| 472 gesture_provider_->SetDoubleTapSupportForPlatformEnabled(true); | 472 gesture_provider_->SetDoubleTapSupportForPlatformEnabled(true); |
| 473 | 473 |
| 474 MockMotionEvent event = | 474 MockMotionEvent event = |
| 475 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); | 475 ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN); |
| 476 event.SetPrimaryPointerId(motion_event_id); | 476 event.SetPrimaryPointerId(motion_event_id); |
| 477 event.set_flags(motion_event_flags); | 477 event.set_flags(motion_event_flags); |
| 478 | 478 |
| 479 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 479 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
| 480 EXPECT_EQ(ET_GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); | 480 EXPECT_EQ(ET_GESTURE_TAP_DOWN, GetMostRecentGestureEventType()); |
| (...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2635 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN, kFakeCoordX, | 2635 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN, kFakeCoordX, |
| 2636 kFakeCoordY + GetTouchSlop() / 2); | 2636 kFakeCoordY + GetTouchSlop() / 2); |
| 2637 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 2637 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
| 2638 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_UP); | 2638 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_UP); |
| 2639 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 2639 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
| 2640 EXPECT_EQ(ET_GESTURE_TAP, GetMostRecentGestureEventType()); | 2640 EXPECT_EQ(ET_GESTURE_TAP, GetMostRecentGestureEventType()); |
| 2641 EXPECT_EQ(1, GetMostRecentGestureEvent().details.tap_count()); | 2641 EXPECT_EQ(1, GetMostRecentGestureEvent().details.tap_count()); |
| 2642 } | 2642 } |
| 2643 | 2643 |
| 2644 } // namespace ui | 2644 } // namespace ui |
| OLD | NEW |