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