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

Side by Side Diff: ui/events/gesture_detection/gesture_provider_unittest.cc

Issue 2086093003: Remove calls to deprecated MessageLoop methods in ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | ui/events/platform/platform_event_source_unittest.cc » ('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 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 "ui/events/gesture_detection/gesture_provider.h" 5 #include "ui/events/gesture_detection/gesture_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h"
14 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
15 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
16 #include "base/time/time.h" 17 #include "base/time/time.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "ui/events/event_constants.h" 19 #include "ui/events/event_constants.h"
19 #include "ui/events/gesture_detection/gesture_event_data.h" 20 #include "ui/events/gesture_detection/gesture_event_data.h"
20 #include "ui/events/gesture_detection/motion_event.h" 21 #include "ui/events/gesture_detection/motion_event.h"
21 #include "ui/events/test/motion_event_test_utils.h" 22 #include "ui/events/test/motion_event_test_utils.h"
22 #include "ui/gfx/geometry/point_f.h" 23 #include "ui/gfx/geometry/point_f.h"
23 24
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 412
412 event = ObtainMotionEvent(event_time + 2 * kDeltaTimeForFlingSequences, 413 event = ObtainMotionEvent(event_time + 2 * kDeltaTimeForFlingSequences,
413 MotionEvent::ACTION_POINTER_UP, 414 MotionEvent::ACTION_POINTER_UP,
414 positions); 415 positions);
415 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 416 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
416 } 417 }
417 418
418 static void RunTasksAndWait(base::TimeDelta delay) { 419 static void RunTasksAndWait(base::TimeDelta delay) {
419 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 420 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
420 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), delay); 421 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), delay);
421 base::MessageLoop::current()->Run(); 422 base::RunLoop().Run();
422 } 423 }
423 424
424 std::vector<GestureEventData> gestures_; 425 std::vector<GestureEventData> gestures_;
425 std::unique_ptr<GestureProvider> gesture_provider_; 426 std::unique_ptr<GestureProvider> gesture_provider_;
426 std::unique_ptr<GestureEventData> active_scroll_begin_event_; 427 std::unique_ptr<GestureEventData> active_scroll_begin_event_;
427 base::MessageLoopForUI message_loop_; 428 base::MessageLoopForUI message_loop_;
428 }; 429 };
429 430
430 // Verify that a DOWN followed shortly by an UP will trigger a single tap. 431 // Verify that a DOWN followed shortly by an UP will trigger a single tap.
431 TEST_F(GestureProviderTest, GestureTap) { 432 TEST_F(GestureProviderTest, GestureTap) {
(...skipping 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2642 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN, kFakeCoordX, 2643 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN, kFakeCoordX,
2643 kFakeCoordY + GetTouchSlop() / 2); 2644 kFakeCoordY + GetTouchSlop() / 2);
2644 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 2645 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
2645 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_UP); 2646 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_UP);
2646 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 2647 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
2647 EXPECT_EQ(ET_GESTURE_TAP, GetMostRecentGestureEventType()); 2648 EXPECT_EQ(ET_GESTURE_TAP, GetMostRecentGestureEventType());
2648 EXPECT_EQ(1, GetMostRecentGestureEvent().details.tap_count()); 2649 EXPECT_EQ(1, GetMostRecentGestureEvent().details.tap_count());
2649 } 2650 }
2650 2651
2651 } // namespace ui 2652 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/events/platform/platform_event_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698