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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 | 409 |
410 static void RunTasksAndWait(base::TimeDelta delay) { | 410 static void RunTasksAndWait(base::TimeDelta delay) { |
411 base::MessageLoop::current()->PostDelayedTask( | 411 base::MessageLoop::current()->PostDelayedTask( |
412 FROM_HERE, base::MessageLoop::QuitClosure(), delay); | 412 FROM_HERE, base::MessageLoop::QuitClosure(), delay); |
413 base::MessageLoop::current()->Run(); | 413 base::MessageLoop::current()->Run(); |
414 } | 414 } |
415 | 415 |
416 std::vector<GestureEventData> gestures_; | 416 std::vector<GestureEventData> gestures_; |
417 scoped_ptr<GestureProvider> gesture_provider_; | 417 scoped_ptr<GestureProvider> gesture_provider_; |
418 scoped_ptr<GestureEventData> active_scroll_begin_event_; | 418 scoped_ptr<GestureEventData> active_scroll_begin_event_; |
419 base::MessageLoopForUI message_loop_; | |
420 }; | 419 }; |
421 | 420 |
422 // Verify that a DOWN followed shortly by an UP will trigger a single tap. | 421 // Verify that a DOWN followed shortly by an UP will trigger a single tap. |
423 TEST_F(GestureProviderTest, GestureTap) { | 422 TEST_F(GestureProviderTest, GestureTap) { |
424 base::TimeTicks event_time = base::TimeTicks::Now(); | 423 base::TimeTicks event_time = base::TimeTicks::Now(); |
425 int motion_event_id = 6; | 424 int motion_event_id = 6; |
426 int motion_event_flags = EF_CONTROL_DOWN | EF_ALT_DOWN; | 425 int motion_event_flags = EF_CONTROL_DOWN | EF_ALT_DOWN; |
427 | 426 |
428 gesture_provider_->SetDoubleTapSupportForPlatformEnabled(false); | 427 gesture_provider_->SetDoubleTapSupportForPlatformEnabled(false); |
429 | 428 |
(...skipping 2204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2634 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN, kFakeCoordX, | 2633 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN, kFakeCoordX, |
2635 kFakeCoordY + GetTouchSlop() / 2); | 2634 kFakeCoordY + GetTouchSlop() / 2); |
2636 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 2635 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
2637 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_UP); | 2636 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_UP); |
2638 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 2637 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
2639 EXPECT_EQ(ET_GESTURE_TAP, GetMostRecentGestureEventType()); | 2638 EXPECT_EQ(ET_GESTURE_TAP, GetMostRecentGestureEventType()); |
2640 EXPECT_EQ(1, GetMostRecentGestureEvent().details.tap_count()); | 2639 EXPECT_EQ(1, GetMostRecentGestureEvent().details.tap_count()); |
2641 } | 2640 } |
2642 | 2641 |
2643 } // namespace ui | 2642 } // namespace ui |
OLD | NEW |