| Index: content/browser/renderer_host/input/gesture_event_queue_unittest.cc
|
| diff --git a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc
|
| index 1336fd8eb4443dc070de6646450185184dc669c9..412dae9255619583f8cf8e9b56e01177c44a7eee 100644
|
| --- a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc
|
| +++ b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc
|
| @@ -34,7 +34,7 @@
|
|
|
| // testing::Test
|
| virtual void SetUp() OVERRIDE {
|
| - queue_.reset(new GestureEventQueue(this, this, DefaultConfig()));
|
| + queue_.reset(new GestureEventQueue(this, this));
|
| }
|
|
|
| virtual void TearDown() OVERRIDE {
|
| @@ -68,13 +68,6 @@
|
| }
|
|
|
| protected:
|
| - static GestureEventQueue::Config DefaultConfig() {
|
| - return GestureEventQueue::Config();
|
| - }
|
| -
|
| - void SetUpForDebounce(int interval_ms) {
|
| - queue()->set_debounce_interval_time_ms_for_testing(interval_ms);
|
| - }
|
|
|
| // Returns the result of |GestureEventQueue::ShouldForward()|.
|
| bool SimulateGestureEvent(const WebGestureEvent& gesture) {
|
| @@ -144,6 +137,14 @@
|
| return last_acked_event_;
|
| }
|
|
|
| + void DisableDebounce() {
|
| + queue()->set_debounce_enabled_for_testing(false);
|
| + }
|
| +
|
| + void set_debounce_interval_time_ms(int ms) {
|
| + queue()->set_debounce_interval_time_ms_for_testing(ms);
|
| + }
|
| +
|
| void set_synchronous_ack(InputEventAckState ack_result) {
|
| sync_ack_result_.reset(new InputEventAckState(ack_result));
|
| }
|
| @@ -210,6 +211,9 @@
|
| #endif // GTEST_HAS_PARAM_TEST
|
|
|
| TEST_F(GestureEventQueueTest, CoalescesScrollGestureEvents) {
|
| + // Turn off debounce handling for test isolation.
|
| + DisableDebounce();
|
| +
|
| // Test coalescing of only GestureScrollUpdate events.
|
| // Simulate gesture events.
|
|
|
| @@ -285,6 +289,9 @@
|
|
|
| TEST_F(GestureEventQueueTest,
|
| DoesNotCoalesceScrollGestureEventsFromDifferentDevices) {
|
| + // Turn off debounce handling for test isolation.
|
| + DisableDebounce();
|
| +
|
| // Test that GestureScrollUpdate events from Touchscreen and Touchpad do not
|
| // coalesce.
|
|
|
| @@ -329,6 +336,9 @@
|
| }
|
|
|
| TEST_F(GestureEventQueueTest, CoalescesScrollAndPinchEvents) {
|
| + // Turn off debounce handling for test isolation.
|
| + DisableDebounce();
|
| +
|
| // Test coalescing of only GestureScrollUpdate events.
|
| // Simulate gesture events.
|
|
|
| @@ -561,6 +571,9 @@
|
| }
|
|
|
| TEST_F(GestureEventQueueTest, CoalescesMultiplePinchEventSequences) {
|
| + // Turn off debounce handling for test isolation.
|
| + DisableDebounce();
|
| +
|
| // Simulate a pinch sequence.
|
| SimulateGestureEvent(WebInputEvent::GestureScrollBegin,
|
| WebGestureEvent::Touchscreen);
|
| @@ -651,6 +664,9 @@
|
| }
|
|
|
| TEST_F(GestureEventQueueTest, CoalescesPinchSequencesWithEarlyAck) {
|
| + // Turn off debounce handling for test isolation.
|
| + DisableDebounce();
|
| +
|
| SimulateGestureEvent(WebInputEvent::GestureScrollBegin,
|
| WebGestureEvent::Touchscreen);
|
| SendInputEventACK(WebInputEvent::GestureScrollBegin,
|
| @@ -714,6 +730,9 @@
|
|
|
| TEST_F(GestureEventQueueTest,
|
| DoesNotCoalescePinchGestureEventsWithDifferentModifiers) {
|
| + // Turn off debounce handling for test isolation.
|
| + DisableDebounce();
|
| +
|
| // Insert an event to force queueing of gestures.
|
| SimulateGestureEvent(WebInputEvent::GestureTapCancel,
|
| WebGestureEvent::Touchscreen);
|
| @@ -777,6 +796,9 @@
|
| }
|
|
|
| TEST_F(GestureEventQueueTest, CoalescesScrollAndPinchEventsIdentity) {
|
| + // Turn off debounce handling for test isolation.
|
| + DisableDebounce();
|
| +
|
| // Insert an event to force queueing of gestures.
|
| SimulateGestureEvent(WebInputEvent::GestureTapCancel,
|
| WebGestureEvent::Touchscreen);
|
| @@ -891,6 +913,9 @@
|
|
|
| // Tests an event with an async ack followed by an event with a sync ack.
|
| TEST_F(GestureEventQueueTest, AsyncThenSyncAck) {
|
| + // Turn off debounce handling for test isolation.
|
| + DisableDebounce();
|
| +
|
| SimulateGestureEvent(WebInputEvent::GestureTapDown,
|
| WebGestureEvent::Touchscreen);
|
|
|
| @@ -913,6 +938,9 @@
|
| }
|
|
|
| TEST_F(GestureEventQueueTest, CoalescesScrollAndPinchEventWithSyncAck) {
|
| + // Turn off debounce handling for test isolation.
|
| + DisableDebounce();
|
| +
|
| // Simulate a pinch sequence.
|
| SimulateGestureEvent(WebInputEvent::GestureScrollBegin,
|
| WebGestureEvent::Touchscreen);
|
| @@ -959,6 +987,8 @@
|
| TEST_P(GestureEventQueueWithSourceTest, GestureFlingCancelsFiltered) {
|
| WebGestureEvent::SourceDevice source_device = GetParam();
|
|
|
| + // Turn off debounce handling for test isolation.
|
| + DisableDebounce();
|
| // GFC without previous GFS is dropped.
|
| SimulateGestureEvent(WebInputEvent::GestureFlingCancel, source_device);
|
| EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
|
| @@ -1054,7 +1084,7 @@
|
| // debounce interval, that Scrolls are not and that the deferred events are
|
| // sent after that timer fires.
|
| TEST_F(GestureEventQueueTest, DebounceDefersFollowingGestureEvents) {
|
| - SetUpForDebounce(3);
|
| + set_debounce_interval_time_ms(3);
|
|
|
| SimulateGestureEvent(WebInputEvent::GestureScrollUpdate,
|
| WebGestureEvent::Touchscreen);
|
| @@ -1117,8 +1147,7 @@
|
| // interval and are discarded if a GestureScrollUpdate event arrives before the
|
| // interval end.
|
| TEST_F(GestureEventQueueTest, DebounceDropsDeferredEvents) {
|
| - SetUpForDebounce(3);
|
| -
|
| + set_debounce_interval_time_ms(3);
|
| EXPECT_FALSE(ScrollingInProgress());
|
|
|
| SimulateGestureEvent(WebInputEvent::GestureScrollUpdate,
|
|
|