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

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

Issue 1402543002: Don't use base::MessageLoop::{Quit,QuitClosure} in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « ui/aura/window_tree_host_win.cc ('k') | 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 "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
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
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
OLDNEW
« no previous file with comments | « ui/aura/window_tree_host_win.cc ('k') | ui/events/platform/platform_event_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698