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

Side by Side Diff: content/browser/renderer_host/input/gesture_event_queue_unittest.cc

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 <vector> 5 #include <vector>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/location.h"
9 #include "base/logging.h" 8 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
12 #include "base/single_thread_task_runner.h"
13 #include "base/thread_task_runner_handle.h"
14 #include "base/time/time.h" 11 #include "base/time/time.h"
15 #include "content/browser/renderer_host/input/gesture_event_queue.h" 12 #include "content/browser/renderer_host/input/gesture_event_queue.h"
16 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h" 13 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h"
17 #include "content/common/input/input_event_ack_state.h" 14 #include "content/common/input/input_event_ack_state.h"
18 #include "content/common/input/synthetic_web_input_event_builders.h" 15 #include "content/common/input/synthetic_web_input_event_builders.h"
19 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
20 #include "third_party/WebKit/public/web/WebInputEvent.h" 17 #include "third_party/WebKit/public/web/WebInputEvent.h"
21 18
22 using base::TimeDelta; 19 using base::TimeDelta;
23 using blink::WebGestureDevice; 20 using blink::WebGestureDevice;
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); 1076 EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
1080 EXPECT_EQ(2U, GestureEventQueueSize()); 1077 EXPECT_EQ(2U, GestureEventQueueSize());
1081 EXPECT_EQ(2U, GestureEventDebouncingQueueSize()); 1078 EXPECT_EQ(2U, GestureEventDebouncingQueueSize());
1082 1079
1083 SimulateGestureEvent(WebInputEvent::GestureTapDown, 1080 SimulateGestureEvent(WebInputEvent::GestureTapDown,
1084 blink::WebGestureDeviceTouchscreen); 1081 blink::WebGestureDeviceTouchscreen);
1085 EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); 1082 EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
1086 EXPECT_EQ(2U, GestureEventQueueSize()); 1083 EXPECT_EQ(2U, GestureEventQueueSize());
1087 EXPECT_EQ(3U, GestureEventDebouncingQueueSize()); 1084 EXPECT_EQ(3U, GestureEventDebouncingQueueSize());
1088 1085
1089 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1086 base::MessageLoop::current()->PostDelayedTask(
1090 FROM_HERE, base::MessageLoop::QuitClosure(), 1087 FROM_HERE,
1088 base::MessageLoop::QuitClosure(),
1091 TimeDelta::FromMilliseconds(5)); 1089 TimeDelta::FromMilliseconds(5));
1092 base::MessageLoop::current()->Run(); 1090 base::MessageLoop::current()->Run();
1093 1091
1094 // The deferred events are correctly queued in coalescing queue. 1092 // The deferred events are correctly queued in coalescing queue.
1095 EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); 1093 EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
1096 EXPECT_EQ(5U, GestureEventQueueSize()); 1094 EXPECT_EQ(5U, GestureEventQueueSize());
1097 EXPECT_EQ(0U, GestureEventDebouncingQueueSize()); 1095 EXPECT_EQ(0U, GestureEventDebouncingQueueSize());
1098 EXPECT_FALSE(ScrollingInProgress()); 1096 EXPECT_FALSE(ScrollingInProgress());
1099 1097
1100 // Verify that the coalescing queue contains the correct events. 1098 // Verify that the coalescing queue contains the correct events.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 WebInputEvent::GestureScrollUpdate}; 1144 WebInputEvent::GestureScrollUpdate};
1147 1145
1148 for (unsigned i = 0; i < sizeof(expected) / sizeof(WebInputEvent::Type); 1146 for (unsigned i = 0; i < sizeof(expected) / sizeof(WebInputEvent::Type);
1149 i++) { 1147 i++) {
1150 WebGestureEvent merged_event = GestureEventQueueEventAt(i); 1148 WebGestureEvent merged_event = GestureEventQueueEventAt(i);
1151 EXPECT_EQ(expected[i], merged_event.type); 1149 EXPECT_EQ(expected[i], merged_event.type);
1152 } 1150 }
1153 } 1151 }
1154 1152
1155 } // namespace content 1153 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698