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

Unified Diff: ui/events/blink/input_handler_proxy_unittest.cc

Issue 2552853002: [Compositor event queue] Coalesce gesture scroll&pinch of the same sequence (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/blink/input_handler_proxy_unittest.cc
diff --git a/ui/events/blink/input_handler_proxy_unittest.cc b/ui/events/blink/input_handler_proxy_unittest.cc
index 8a0f7e1c902b6cd7be803ed3ac26761ffb1038e8..2fb0050c28ef7bf3d8140db192657702181b6e47 100644
--- a/ui/events/blink/input_handler_proxy_unittest.cc
+++ b/ui/events/blink/input_handler_proxy_unittest.cc
@@ -3087,6 +3087,55 @@ TEST_F(InputHandlerProxyEventQueueTest, VSyncAlignedQueueingTime) {
1);
}
+TEST_F(InputHandlerProxyEventQueueTest, VSyncAlignedCoalesceScrollAndPinch) {
+ // Start scroll in the first frame.
+ EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(kImplThreadScrollState));
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()).Times(1);
+
+ // GSUs and GPUs in one sequence should be coalesced into 1 GSU and 1 GPU.
+ HandleGestureEvent(WebInputEvent::GestureScrollBegin);
+ HandleGestureEvent(WebInputEvent::GestureScrollUpdate, -20);
+ HandleGestureEvent(WebInputEvent::GestureScrollUpdate, -7);
+ HandleGestureEvent(WebInputEvent::GesturePinchUpdate, 2.0f, 13, 10);
+ HandleGestureEvent(WebInputEvent::GestureScrollUpdate, -10);
+ HandleGestureEvent(WebInputEvent::GestureScrollUpdate, -6);
+ HandleGestureEvent(WebInputEvent::GestureScrollEnd);
+ HandleGestureEvent(WebInputEvent::GesturePinchBegin);
+ HandleGestureEvent(WebInputEvent::GesturePinchUpdate, 0.2f, 2, 20);
+ HandleGestureEvent(WebInputEvent::GesturePinchUpdate, 10.0f, 1, 10);
+ HandleGestureEvent(WebInputEvent::GestureScrollUpdate, -30);
+ HandleGestureEvent(WebInputEvent::GesturePinchUpdate, 0.25f, 3, 30);
+ HandleGestureEvent(WebInputEvent::GestureScrollUpdate, -10);
+ HandleGestureEvent(WebInputEvent::GesturePinchEnd);
+
+ // Only the first GSB was dispatched.
+ EXPECT_EQ(7ul, event_queue().size());
+ EXPECT_EQ(1ul, event_disposition_recorder_.size());
+
+ EXPECT_EQ(WebInputEvent::GestureScrollUpdate,
+ event_queue()[0]->ToWebGestureEvent().type);
+ EXPECT_EQ(-35,
+ event_queue()[0]->ToWebGestureEvent().data.scrollUpdate.deltaY);
+ EXPECT_EQ(WebInputEvent::GesturePinchUpdate,
+ event_queue()[1]->ToWebGestureEvent().type);
+ EXPECT_EQ(2.0f, event_queue()[1]->ToWebGestureEvent().data.pinchUpdate.scale);
+ EXPECT_EQ(WebInputEvent::GestureScrollEnd,
+ event_queue()[2]->ToWebGestureEvent().type);
+ EXPECT_EQ(WebInputEvent::GesturePinchBegin,
+ event_queue()[3]->ToWebGestureEvent().type);
+ EXPECT_EQ(WebInputEvent::GestureScrollUpdate,
+ event_queue()[4]->ToWebGestureEvent().type);
+ EXPECT_EQ(-85,
+ event_queue()[4]->ToWebGestureEvent().data.scrollUpdate.deltaY);
+ EXPECT_EQ(WebInputEvent::GesturePinchUpdate,
+ event_queue()[5]->ToWebGestureEvent().type);
+ EXPECT_EQ(0.5f, event_queue()[5]->ToWebGestureEvent().data.pinchUpdate.scale);
+ EXPECT_EQ(WebInputEvent::GesturePinchEnd,
+ event_queue()[6]->ToWebGestureEvent().type);
+ testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
+}
+
INSTANTIATE_TEST_CASE_P(AnimateInput,
InputHandlerProxyTest,
testing::ValuesIn(test_types));
« ui/events/blink/event_with_callback.h ('K') | « ui/events/blink/event_with_callback.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698