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