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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/events/blink/input_handler_proxy.h" 5 #include "ui/events/blink/input_handler_proxy.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 3069 matching lines...) Expand 10 before | Expand all | Expand 10 after
3080 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); 3080 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
3081 histogram_tester.ExpectUniqueSample(kContinuousHeadQueueingTimeHistogram, 140, 3081 histogram_tester.ExpectUniqueSample(kContinuousHeadQueueingTimeHistogram, 140,
3082 1); 3082 1);
3083 histogram_tester.ExpectUniqueSample(kContinuousTailQueueingTimeHistogram, 80, 3083 histogram_tester.ExpectUniqueSample(kContinuousTailQueueingTimeHistogram, 80,
3084 1); 3084 1);
3085 histogram_tester.ExpectBucketCount(kNonContinuousQueueingTimeHistogram, 0, 1); 3085 histogram_tester.ExpectBucketCount(kNonContinuousQueueingTimeHistogram, 0, 1);
3086 histogram_tester.ExpectBucketCount(kNonContinuousQueueingTimeHistogram, 70, 3086 histogram_tester.ExpectBucketCount(kNonContinuousQueueingTimeHistogram, 70,
3087 1); 3087 1);
3088 } 3088 }
3089 3089
3090 TEST_F(InputHandlerProxyEventQueueTest, VSyncAlignedCoalesceScrollAndPinch) {
3091 // Start scroll in the first frame.
3092 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
3093 .WillOnce(testing::Return(kImplThreadScrollState));
3094 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()).Times(1);
3095
3096 // GSUs and GPUs in one sequence should be coalesced into 1 GSU and 1 GPU.
3097 HandleGestureEvent(WebInputEvent::GestureScrollBegin);
3098 HandleGestureEvent(WebInputEvent::GestureScrollUpdate, -20);
3099 HandleGestureEvent(WebInputEvent::GestureScrollUpdate, -7);
3100 HandleGestureEvent(WebInputEvent::GesturePinchUpdate, 2.0f, 13, 10);
3101 HandleGestureEvent(WebInputEvent::GestureScrollUpdate, -10);
3102 HandleGestureEvent(WebInputEvent::GestureScrollUpdate, -6);
3103 HandleGestureEvent(WebInputEvent::GestureScrollEnd);
3104 HandleGestureEvent(WebInputEvent::GesturePinchBegin);
3105 HandleGestureEvent(WebInputEvent::GesturePinchUpdate, 0.2f, 2, 20);
3106 HandleGestureEvent(WebInputEvent::GesturePinchUpdate, 10.0f, 1, 10);
3107 HandleGestureEvent(WebInputEvent::GestureScrollUpdate, -30);
3108 HandleGestureEvent(WebInputEvent::GesturePinchUpdate, 0.25f, 3, 30);
3109 HandleGestureEvent(WebInputEvent::GestureScrollUpdate, -10);
3110 HandleGestureEvent(WebInputEvent::GesturePinchEnd);
3111
3112 // Only the first GSB was dispatched.
3113 EXPECT_EQ(7ul, event_queue().size());
3114 EXPECT_EQ(1ul, event_disposition_recorder_.size());
3115
3116 EXPECT_EQ(WebInputEvent::GestureScrollUpdate,
3117 event_queue()[0]->ToWebGestureEvent().type);
3118 EXPECT_EQ(-35,
3119 event_queue()[0]->ToWebGestureEvent().data.scrollUpdate.deltaY);
3120 EXPECT_EQ(WebInputEvent::GesturePinchUpdate,
3121 event_queue()[1]->ToWebGestureEvent().type);
3122 EXPECT_EQ(2.0f, event_queue()[1]->ToWebGestureEvent().data.pinchUpdate.scale);
3123 EXPECT_EQ(WebInputEvent::GestureScrollEnd,
3124 event_queue()[2]->ToWebGestureEvent().type);
3125 EXPECT_EQ(WebInputEvent::GesturePinchBegin,
3126 event_queue()[3]->ToWebGestureEvent().type);
3127 EXPECT_EQ(WebInputEvent::GestureScrollUpdate,
3128 event_queue()[4]->ToWebGestureEvent().type);
3129 EXPECT_EQ(-85,
3130 event_queue()[4]->ToWebGestureEvent().data.scrollUpdate.deltaY);
3131 EXPECT_EQ(WebInputEvent::GesturePinchUpdate,
3132 event_queue()[5]->ToWebGestureEvent().type);
3133 EXPECT_EQ(0.5f, event_queue()[5]->ToWebGestureEvent().data.pinchUpdate.scale);
3134 EXPECT_EQ(WebInputEvent::GesturePinchEnd,
3135 event_queue()[6]->ToWebGestureEvent().type);
3136 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
3137 }
3138
3090 INSTANTIATE_TEST_CASE_P(AnimateInput, 3139 INSTANTIATE_TEST_CASE_P(AnimateInput,
3091 InputHandlerProxyTest, 3140 InputHandlerProxyTest,
3092 testing::ValuesIn(test_types)); 3141 testing::ValuesIn(test_types));
3093 3142
3094 } // namespace test 3143 } // namespace test
3095 } // namespace ui 3144 } // namespace ui
OLDNEW
« 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