Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: content/browser/renderer_host/input/gesture_event_queue_unittest.cc

Issue 628763003: Support InputRouter recycling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, RecycleDropsAllPendingEvents) {
1160 SetUpForDebounce(3);
1161
1162 ASSERT_EQ(0U, GestureEventQueueSize());
1163
1164 SimulateGestureEvent(WebInputEvent::GestureScrollUpdate,
1165 blink::WebGestureDeviceTouchscreen);
1166 EXPECT_EQ(1U, GetAndResetSentGestureEventCount());
1167 EXPECT_EQ(1U, GestureEventQueueSize());
1168 EXPECT_EQ(0U, GestureEventDebouncingQueueSize());
1169 EXPECT_TRUE(ScrollingInProgress());
1170
1171 SimulateGestureEvent(WebInputEvent::GestureScrollEnd,
1172 blink::WebGestureDeviceTouchscreen);
1173 EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
1174 EXPECT_EQ(1U, GestureEventQueueSize());
1175 EXPECT_EQ(1U, GestureEventDebouncingQueueSize());
1176
1177 // Recycling the queue should clear all pending events and reset the state.
1178 queue()->Recycle();
1179 EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
1180 EXPECT_EQ(0U, GestureEventQueueSize());
1181 EXPECT_EQ(0U, GestureEventDebouncingQueueSize());
1182 EXPECT_FALSE(ScrollingInProgress());
1183
1184 // Subsequent events should work properly.
1185 SimulateGestureEvent(WebInputEvent::GestureScrollUpdate,
1186 blink::WebGestureDeviceTouchscreen);
1187 EXPECT_EQ(1U, GetAndResetSentGestureEventCount());
1188 EXPECT_EQ(1U, GestureEventQueueSize());
1189 EXPECT_EQ(0U, GestureEventDebouncingQueueSize());
1190 EXPECT_TRUE(ScrollingInProgress());
1191 }
1192
1159 } // namespace content 1193 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698