Chromium Code Reviews| 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 // Simulate gesture events. | |
|
tdresser
2016/05/02 13:27:15
The previous line doesn't add much information.
dtapuska
2016/05/02 13:57:25
Done.
| |
| 1162 | |
| 1163 SimulateGestureEvent(WebInputEvent::GestureScrollUpdate, | |
| 1164 blink::WebGestureDeviceTouchpad); | |
| 1165 EXPECT_EQ(1U, GetAndResetSentGestureEventCount()); | |
| 1166 EXPECT_EQ(1U, GestureEventQueueSize()); | |
| 1167 | |
| 1168 WebGestureEvent synthetic_end = SyntheticWebGestureEventBuilder::Build( | |
| 1169 WebInputEvent::GestureScrollEnd, blink::WebGestureDeviceTouchpad); | |
| 1170 synthetic_end.data.scrollEnd.synthetic = true; | |
| 1171 | |
| 1172 SimulateGestureEvent(synthetic_end); | |
| 1173 EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); | |
| 1174 EXPECT_EQ(2U, GestureEventQueueSize()); | |
| 1175 | |
| 1176 // Synthetic begin will remove the unsent synthetic end. | |
| 1177 WebGestureEvent synthetic_begin = SyntheticWebGestureEventBuilder::Build( | |
| 1178 WebInputEvent::GestureScrollBegin, blink::WebGestureDeviceTouchpad); | |
| 1179 synthetic_begin.data.scrollBegin.synthetic = true; | |
| 1180 | |
| 1181 SimulateGestureEvent(synthetic_begin); | |
| 1182 EXPECT_EQ(0U, GetAndResetSentGestureEventCount()); | |
| 1183 EXPECT_EQ(1U, GestureEventQueueSize()); | |
| 1184 } | |
| 1185 | |
| 1159 } // namespace content | 1186 } // namespace content |
| OLD | NEW |