Chromium Code Reviews| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 402 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
| 403 | 403 |
| 404 event = ObtainMotionEvent(event_time + 2 * kDeltaTimeForFlingSequences, | 404 event = ObtainMotionEvent(event_time + 2 * kDeltaTimeForFlingSequences, |
| 405 MotionEvent::ACTION_POINTER_UP, | 405 MotionEvent::ACTION_POINTER_UP, |
| 406 positions); | 406 positions); |
| 407 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 407 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
| 408 } | 408 } |
| 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::QuitWhenIdleClosure(), delay); |
| 413 base::MessageLoop::current()->Run(); | 413 base::MessageLoop::current()->Run(); |
|
sadrul
2015/10/09 20:48:25
This could be a non-static method that uses messag
ki.stfu
2015/10/09 21:25:37
Yes in theory, bug I'm not sure base::MessageLoop:
ki.stfu
2015/10/12 19:18:30
BTW, seems like an unused field at all. I made a n
| |
| 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_; | 419 base::MessageLoopForUI message_loop_; |
| 420 }; | 420 }; |
| 421 | 421 |
| 422 // Verify that a DOWN followed shortly by an UP will trigger a single tap. | 422 // Verify that a DOWN followed shortly by an UP will trigger a single tap. |
| 423 TEST_F(GestureProviderTest, GestureTap) { | 423 TEST_F(GestureProviderTest, GestureTap) { |
| (...skipping 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2634 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN, kFakeCoordX, | 2634 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN, kFakeCoordX, |
| 2635 kFakeCoordY + GetTouchSlop() / 2); | 2635 kFakeCoordY + GetTouchSlop() / 2); |
| 2636 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 2636 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
| 2637 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_UP); | 2637 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_UP); |
| 2638 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); | 2638 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); |
| 2639 EXPECT_EQ(ET_GESTURE_TAP, GetMostRecentGestureEventType()); | 2639 EXPECT_EQ(ET_GESTURE_TAP, GetMostRecentGestureEventType()); |
| 2640 EXPECT_EQ(1, GetMostRecentGestureEvent().details.tap_count()); | 2640 EXPECT_EQ(1, GetMostRecentGestureEvent().details.tap_count()); |
| 2641 } | 2641 } |
| 2642 | 2642 |
| 2643 } // namespace ui | 2643 } // namespace ui |
| OLD | NEW |