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

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

Issue 2049493004: Remove use of deprecated MessageLoop methods in ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
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/logging.h" 12 #include "base/logging.h"
12 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/single_thread_task_runner.h"
15 #include "base/threading/thread_task_runner_handle.h"
13 #include "base/time/time.h" 16 #include "base/time/time.h"
14 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
15 #include "ui/events/event_constants.h" 18 #include "ui/events/event_constants.h"
16 #include "ui/events/gesture_detection/gesture_event_data.h" 19 #include "ui/events/gesture_detection/gesture_event_data.h"
17 #include "ui/events/gesture_detection/motion_event.h" 20 #include "ui/events/gesture_detection/motion_event.h"
18 #include "ui/events/test/motion_event_test_utils.h" 21 #include "ui/events/test/motion_event_test_utils.h"
19 #include "ui/gfx/geometry/point_f.h" 22 #include "ui/gfx/geometry/point_f.h"
20 23
21 using base::TimeDelta; 24 using base::TimeDelta;
22 using base::TimeTicks; 25 using base::TimeTicks;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 positions); 409 positions);
407 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 410 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
408 411
409 event = ObtainMotionEvent(event_time + 2 * kDeltaTimeForFlingSequences, 412 event = ObtainMotionEvent(event_time + 2 * kDeltaTimeForFlingSequences,
410 MotionEvent::ACTION_POINTER_UP, 413 MotionEvent::ACTION_POINTER_UP,
411 positions); 414 positions);
412 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 415 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
413 } 416 }
414 417
415 static void RunTasksAndWait(base::TimeDelta delay) { 418 static void RunTasksAndWait(base::TimeDelta delay) {
416 base::MessageLoop::current()->PostDelayedTask( 419 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
417 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), delay); 420 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), delay);
418 base::MessageLoop::current()->Run(); 421 base::MessageLoop::current()->Run();
419 } 422 }
420 423
421 std::vector<GestureEventData> gestures_; 424 std::vector<GestureEventData> gestures_;
422 std::unique_ptr<GestureProvider> gesture_provider_; 425 std::unique_ptr<GestureProvider> gesture_provider_;
423 std::unique_ptr<GestureEventData> active_scroll_begin_event_; 426 std::unique_ptr<GestureEventData> active_scroll_begin_event_;
424 base::MessageLoopForUI message_loop_; 427 base::MessageLoopForUI message_loop_;
425 }; 428 };
426 429
(...skipping 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2639 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN, kFakeCoordX, 2642 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_DOWN, kFakeCoordX,
2640 kFakeCoordY + GetTouchSlop() / 2); 2643 kFakeCoordY + GetTouchSlop() / 2);
2641 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 2644 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
2642 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_UP); 2645 event = ObtainMotionEvent(event_time, MotionEvent::ACTION_UP);
2643 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event)); 2646 EXPECT_TRUE(gesture_provider_->OnTouchEvent(event));
2644 EXPECT_EQ(ET_GESTURE_TAP, GetMostRecentGestureEventType()); 2647 EXPECT_EQ(ET_GESTURE_TAP, GetMostRecentGestureEventType());
2645 EXPECT_EQ(1, GetMostRecentGestureEvent().details.tap_count()); 2648 EXPECT_EQ(1, GetMostRecentGestureEvent().details.tap_count());
2646 } 2649 }
2647 2650
2648 } // namespace ui 2651 } // namespace ui
OLDNEW
« no previous file with comments | « ui/display/chromeos/test/test_native_display_delegate.cc ('k') | ui/events/test/platform_event_waiter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698