| 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 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 WebInputEvent::GestureScrollUpdate, | 1147 WebInputEvent::GestureScrollUpdate, |
| 1148 WebInputEvent::GestureScrollUpdate}; | 1148 WebInputEvent::GestureScrollUpdate}; |
| 1149 | 1149 |
| 1150 for (unsigned i = 0; i < sizeof(expected) / sizeof(WebInputEvent::Type); | 1150 for (unsigned i = 0; i < sizeof(expected) / sizeof(WebInputEvent::Type); |
| 1151 i++) { | 1151 i++) { |
| 1152 WebGestureEvent merged_event = GestureEventQueueEventAt(i); | 1152 WebGestureEvent merged_event = GestureEventQueueEventAt(i); |
| 1153 EXPECT_EQ(expected[i], merged_event.type); | 1153 EXPECT_EQ(expected[i], merged_event.type); |
| 1154 } | 1154 } |
| 1155 } | 1155 } |
| 1156 | 1156 |
| 1157 TEST_F(GestureEventQueueTest, CoalescesSyntheticScrollBeginEndEvents) { |
| 1158 // Test coalescing of only GestureScrollBegin/End events. |
| 1159 SimulateGestureEvent(WebInputEvent::GestureScrollUpdate, |
| 1160 blink::WebGestureDeviceTouchpad); |
| 1161 EXPECT_EQ(1U, GetAndResetSentGestureEventCount()); |
| 1162 EXPECT_EQ(1U, GestureEventQueueSize()); |
| 1163 |
| 1164 WebGestureEvent synthetic_end = SyntheticWebGestureEventBuilder::Build( |
| 1165 WebInputEvent::GestureScrollEnd, blink::WebGestureDeviceTouchpad); |
| 1166 synthetic_end.data.scrollEnd.synthetic = true; |
| 1167 |
| 1168 SimulateGestureEvent(synthetic_end); |
| 1169 EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); |
| 1170 EXPECT_EQ(2U, GestureEventQueueSize()); |
| 1171 |
| 1172 // Synthetic begin will remove the unsent synthetic end. |
| 1173 WebGestureEvent synthetic_begin = SyntheticWebGestureEventBuilder::Build( |
| 1174 WebInputEvent::GestureScrollBegin, blink::WebGestureDeviceTouchpad); |
| 1175 synthetic_begin.data.scrollBegin.synthetic = true; |
| 1176 |
| 1177 SimulateGestureEvent(synthetic_begin); |
| 1178 EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); |
| 1179 EXPECT_EQ(1U, GestureEventQueueSize()); |
| 1180 } |
| 1181 |
| 1157 } // namespace content | 1182 } // namespace content |
| OLD | NEW |