| 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 "content/browser/renderer_host/input/gesture_event_queue.h" | 5 #include "content/browser/renderer_host/input/gesture_event_queue.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 | 1085 |
| 1086 SimulateGestureEvent(WebInputEvent::GestureTapDown, | 1086 SimulateGestureEvent(WebInputEvent::GestureTapDown, |
| 1087 blink::WebGestureDeviceTouchscreen); | 1087 blink::WebGestureDeviceTouchscreen); |
| 1088 EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); | 1088 EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); |
| 1089 EXPECT_EQ(2U, GestureEventQueueSize()); | 1089 EXPECT_EQ(2U, GestureEventQueueSize()); |
| 1090 EXPECT_EQ(3U, GestureEventDebouncingQueueSize()); | 1090 EXPECT_EQ(3U, GestureEventDebouncingQueueSize()); |
| 1091 | 1091 |
| 1092 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1092 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 1093 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 1093 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
| 1094 TimeDelta::FromMilliseconds(5)); | 1094 TimeDelta::FromMilliseconds(5)); |
| 1095 base::MessageLoop::current()->Run(); | 1095 base::RunLoop().Run(); |
| 1096 | 1096 |
| 1097 // The deferred events are correctly queued in coalescing queue. | 1097 // The deferred events are correctly queued in coalescing queue. |
| 1098 EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); | 1098 EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); |
| 1099 EXPECT_EQ(5U, GestureEventQueueSize()); | 1099 EXPECT_EQ(5U, GestureEventQueueSize()); |
| 1100 EXPECT_EQ(0U, GestureEventDebouncingQueueSize()); | 1100 EXPECT_EQ(0U, GestureEventDebouncingQueueSize()); |
| 1101 EXPECT_FALSE(ScrollingInProgress()); | 1101 EXPECT_FALSE(ScrollingInProgress()); |
| 1102 | 1102 |
| 1103 // Verify that the coalescing queue contains the correct events. | 1103 // Verify that the coalescing queue contains the correct events. |
| 1104 WebInputEvent::Type expected[] = { | 1104 WebInputEvent::Type expected[] = { |
| 1105 WebInputEvent::GestureScrollUpdate, | 1105 WebInputEvent::GestureScrollUpdate, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 WebGestureEvent synthetic_begin = SyntheticWebGestureEventBuilder::Build( | 1174 WebGestureEvent synthetic_begin = SyntheticWebGestureEventBuilder::Build( |
| 1175 WebInputEvent::GestureScrollBegin, blink::WebGestureDeviceTouchpad); | 1175 WebInputEvent::GestureScrollBegin, blink::WebGestureDeviceTouchpad); |
| 1176 synthetic_begin.data.scrollBegin.synthetic = true; | 1176 synthetic_begin.data.scrollBegin.synthetic = true; |
| 1177 | 1177 |
| 1178 SimulateGestureEvent(synthetic_begin); | 1178 SimulateGestureEvent(synthetic_begin); |
| 1179 EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); | 1179 EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); |
| 1180 EXPECT_EQ(1U, GestureEventQueueSize()); | 1180 EXPECT_EQ(1U, GestureEventQueueSize()); |
| 1181 } | 1181 } |
| 1182 | 1182 |
| 1183 } // namespace content | 1183 } // namespace content |
| OLD | NEW |