| Index: content/browser/renderer_host/input/legacy_touch_event_queue_unittest.cc
|
| diff --git a/content/browser/renderer_host/input/touch_event_queue_unittest.cc b/content/browser/renderer_host/input/legacy_touch_event_queue_unittest.cc
|
| similarity index 95%
|
| copy from content/browser/renderer_host/input/touch_event_queue_unittest.cc
|
| copy to content/browser/renderer_host/input/legacy_touch_event_queue_unittest.cc
|
| index b20f692127df31e16d458d601004a5bfbefca442..7f391d2b42087380e5f419226398d1a58e0f0cff 100644
|
| --- a/content/browser/renderer_host/input/touch_event_queue_unittest.cc
|
| +++ b/content/browser/renderer_host/input/legacy_touch_event_queue_unittest.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "content/browser/renderer_host/input/touch_event_queue.h"
|
| +#include "content/browser/renderer_host/input/legacy_touch_event_queue.h"
|
|
|
| #include <stddef.h>
|
|
|
| @@ -15,7 +15,6 @@
|
| #include "base/run_loop.h"
|
| #include "base/single_thread_task_runner.h"
|
| #include "base/threading/thread_task_runner_handle.h"
|
| -#include "content/browser/renderer_host/input/legacy_touch_event_queue.h"
|
| #include "content/browser/renderer_host/input/timeout_monitor.h"
|
| #include "content/common/input/synthetic_web_input_event_builders.h"
|
| #include "content/common/input/web_touch_event_traits.h"
|
| @@ -40,15 +39,15 @@ base::TimeDelta DefaultTouchTimeoutDelay() {
|
| }
|
| } // namespace
|
|
|
| -class TouchEventQueueTest : public testing::Test,
|
| - public TouchEventQueueClient {
|
| +class LegacyTouchEventQueueTest : public testing::Test,
|
| + public TouchEventQueueClient {
|
| public:
|
| - TouchEventQueueTest()
|
| + LegacyTouchEventQueueTest()
|
| : acked_event_count_(0),
|
| last_acked_event_state_(INPUT_EVENT_ACK_STATE_UNKNOWN),
|
| slop_length_dips_(0) {}
|
|
|
| - ~TouchEventQueueTest() override {}
|
| + ~LegacyTouchEventQueueTest() override {}
|
|
|
| // testing::Test
|
| void SetUp() override {
|
| @@ -82,9 +81,8 @@ class TouchEventQueueTest : public testing::Test,
|
| if (followup_gesture_event_) {
|
| std::unique_ptr<WebGestureEvent> followup_gesture_event =
|
| std::move(followup_gesture_event_);
|
| - queue_->OnGestureScrollEvent(
|
| - GestureEventWithLatencyInfo(*followup_gesture_event,
|
| - ui::LatencyInfo()));
|
| + queue_->OnGestureScrollEvent(GestureEventWithLatencyInfo(
|
| + *followup_gesture_event, ui::LatencyInfo()));
|
| }
|
| }
|
|
|
| @@ -247,9 +245,7 @@ class TouchEventQueueTest : public testing::Test,
|
| touch_event_.setTimeStampSeconds(touch_event_.timeStampSeconds() + seconds);
|
| }
|
|
|
| - void ResetTouchEvent() {
|
| - touch_event_ = SyntheticWebTouchEvent();
|
| - }
|
| + void ResetTouchEvent() { touch_event_ = SyntheticWebTouchEvent(); }
|
|
|
| size_t GetAndResetAckedEventCount() {
|
| size_t count = acked_event_count_;
|
| @@ -283,17 +279,13 @@ class TouchEventQueueTest : public testing::Test,
|
| return queue_->HasPendingAsyncTouchMoveForTesting();
|
| }
|
|
|
| - size_t queued_event_count() const {
|
| - return queue_->size();
|
| - }
|
| + size_t queued_event_count() const { return queue_->size(); }
|
|
|
| const WebTouchEvent& latest_event() const {
|
| return queue_->GetLatestEventForTesting().event;
|
| }
|
|
|
| - const WebTouchEvent& acked_event() const {
|
| - return last_acked_event_;
|
| - }
|
| + const WebTouchEvent& acked_event() const { return last_acked_event_; }
|
|
|
| const WebTouchEvent& sent_event() const {
|
| DCHECK(!sent_events_.empty());
|
| @@ -346,9 +338,8 @@ class TouchEventQueueTest : public testing::Test,
|
| std::deque<int> sent_events_ids_;
|
| };
|
|
|
| -
|
| // Tests that touch-events are queued properly.
|
| -TEST_F(TouchEventQueueTest, Basic) {
|
| +TEST_F(LegacyTouchEventQueueTest, Basic) {
|
| PressTouchPoint(1, 1);
|
| EXPECT_EQ(1U, queued_event_count());
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| @@ -376,7 +367,7 @@ TEST_F(TouchEventQueueTest, Basic) {
|
| }
|
|
|
| // Tests that touch-events with multiple points are queued properly.
|
| -TEST_F(TouchEventQueueTest, BasicMultiTouch) {
|
| +TEST_F(LegacyTouchEventQueueTest, BasicMultiTouch) {
|
| const size_t kPointerCount = 10;
|
| for (float i = 0; i < kPointerCount; ++i)
|
| PressTouchPoint(i, i);
|
| @@ -422,7 +413,8 @@ TEST_F(TouchEventQueueTest, BasicMultiTouch) {
|
|
|
| // Tests that the touch-queue continues delivering events for an active touch
|
| // sequence after all handlers are removed.
|
| -TEST_F(TouchEventQueueTest, TouchesForwardedIfHandlerRemovedDuringSequence) {
|
| +TEST_F(LegacyTouchEventQueueTest,
|
| + TouchesForwardedIfHandlerRemovedDuringSequence) {
|
| OnHasTouchEventHandlers(true);
|
| EXPECT_EQ(0U, queued_event_count());
|
| EXPECT_EQ(0U, GetAndResetSentEventCount());
|
| @@ -485,7 +477,7 @@ TEST_F(TouchEventQueueTest, TouchesForwardedIfHandlerRemovedDuringSequence) {
|
|
|
| // Tests that addition of a touch handler during a touch sequence will not cause
|
| // the remaining sequence to be forwarded.
|
| -TEST_F(TouchEventQueueTest, ActiveSequenceNotForwardedWhenHandlersAdded) {
|
| +TEST_F(LegacyTouchEventQueueTest, ActiveSequenceNotForwardedWhenHandlersAdded) {
|
| OnHasTouchEventHandlers(false);
|
|
|
| // Send a touch-press event while there is no handler.
|
| @@ -512,7 +504,7 @@ TEST_F(TouchEventQueueTest, ActiveSequenceNotForwardedWhenHandlersAdded) {
|
| // Tests that removal of a touch handler during a touch sequence will prevent
|
| // the remaining sequence from being forwarded, even if another touch handler is
|
| // registered during the same touch sequence.
|
| -TEST_F(TouchEventQueueTest, ActiveSequenceDroppedWhenHandlersRemoved) {
|
| +TEST_F(LegacyTouchEventQueueTest, ActiveSequenceDroppedWhenHandlersRemoved) {
|
| // Send a touch-press event.
|
| PressTouchPoint(1, 1);
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| @@ -566,7 +558,7 @@ TEST_F(TouchEventQueueTest, ActiveSequenceDroppedWhenHandlersRemoved) {
|
|
|
| // Tests that removal/addition of a touch handler without any intervening
|
| // touch activity has no affect on touch forwarding.
|
| -TEST_F(TouchEventQueueTest,
|
| +TEST_F(LegacyTouchEventQueueTest,
|
| ActiveSequenceUnaffectedByRepeatedHandlerRemovalAndAddition) {
|
| // Send a touch-press event.
|
| PressTouchPoint(1, 1);
|
| @@ -593,7 +585,7 @@ TEST_F(TouchEventQueueTest,
|
| }
|
|
|
| // Tests that touch-events are coalesced properly in the queue.
|
| -TEST_F(TouchEventQueueTest, Coalesce) {
|
| +TEST_F(LegacyTouchEventQueueTest, Coalesce) {
|
| // Send a touch-press event.
|
| PressTouchPoint(1, 1);
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| @@ -633,7 +625,7 @@ TEST_F(TouchEventQueueTest, Coalesce) {
|
|
|
| // Tests that an event that has already been sent but hasn't been ack'ed yet
|
| // doesn't get coalesced with newer events.
|
| -TEST_F(TouchEventQueueTest, SentTouchEventDoesNotCoalesce) {
|
| +TEST_F(LegacyTouchEventQueueTest, SentTouchEventDoesNotCoalesce) {
|
| // Send a touch-press event.
|
| PressTouchPoint(1, 1);
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| @@ -660,7 +652,7 @@ TEST_F(TouchEventQueueTest, SentTouchEventDoesNotCoalesce) {
|
| }
|
|
|
| // Tests that coalescing works correctly for multi-touch events.
|
| -TEST_F(TouchEventQueueTest, MultiTouch) {
|
| +TEST_F(LegacyTouchEventQueueTest, MultiTouch) {
|
| // Press the first finger.
|
| PressTouchPoint(1, 1);
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| @@ -694,7 +686,7 @@ TEST_F(TouchEventQueueTest, MultiTouch) {
|
| }
|
|
|
| // Tests that the touch-event queue is robust to redundant acks.
|
| -TEST_F(TouchEventQueueTest, SpuriousAcksIgnored) {
|
| +TEST_F(LegacyTouchEventQueueTest, SpuriousAcksIgnored) {
|
| // Trigger a spurious ack.
|
| SendTouchEventAckWithID(INPUT_EVENT_ACK_STATE_CONSUMED, 0);
|
| EXPECT_EQ(0U, GetAndResetAckedEventCount());
|
| @@ -717,7 +709,7 @@ TEST_F(TouchEventQueueTest, SpuriousAcksIgnored) {
|
| // main thread in the renderer). Also tests that all queued/coalesced touch
|
| // events are flushed immediately when the ACK for the touch-press comes back
|
| // with NO_CONSUMER status.
|
| -TEST_F(TouchEventQueueTest, NoConsumer) {
|
| +TEST_F(LegacyTouchEventQueueTest, NoConsumer) {
|
| // The first touch-press should reach the renderer.
|
| PressTouchPoint(1, 1);
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| @@ -781,7 +773,7 @@ TEST_F(TouchEventQueueTest, NoConsumer) {
|
| EXPECT_EQ(1U, GetAndResetAckedEventCount());
|
| }
|
|
|
| -TEST_F(TouchEventQueueTest, ConsumerIgnoreMultiFinger) {
|
| +TEST_F(LegacyTouchEventQueueTest, ConsumerIgnoreMultiFinger) {
|
| // Interleave three pointer press, move and release events.
|
| PressTouchPoint(1, 1);
|
| MoveTouchPoint(0, 5, 5);
|
| @@ -835,7 +827,7 @@ TEST_F(TouchEventQueueTest, ConsumerIgnoreMultiFinger) {
|
| }
|
|
|
| // Tests that touch-event's enqueued via a touch ack are properly handled.
|
| -TEST_F(TouchEventQueueTest, AckWithFollowupEvents) {
|
| +TEST_F(LegacyTouchEventQueueTest, AckWithFollowupEvents) {
|
| // Queue a touch down.
|
| PressTouchPoint(1, 1);
|
| EXPECT_EQ(1U, queued_event_count());
|
| @@ -874,7 +866,7 @@ TEST_F(TouchEventQueueTest, AckWithFollowupEvents) {
|
| }
|
|
|
| // Tests that touch-events can be synchronously ack'ed.
|
| -TEST_F(TouchEventQueueTest, SynchronousAcks) {
|
| +TEST_F(LegacyTouchEventQueueTest, SynchronousAcks) {
|
| // TouchStart
|
| SetSyncAckResult(INPUT_EVENT_ACK_STATE_CONSUMED);
|
| PressTouchPoint(1, 1);
|
| @@ -912,7 +904,7 @@ TEST_F(TouchEventQueueTest, SynchronousAcks) {
|
|
|
| // Tests that followup events triggered by an immediate ack from
|
| // TouchEventQueue::QueueEvent() are properly handled.
|
| -TEST_F(TouchEventQueueTest, ImmediateAckWithFollowupEvents) {
|
| +TEST_F(LegacyTouchEventQueueTest, ImmediateAckWithFollowupEvents) {
|
| // Create a touch event that will be queued synchronously by a touch ack.
|
| WebTouchEvent followup_event(
|
| WebInputEvent::TouchStart, WebInputEvent::NoModifiers,
|
| @@ -942,7 +934,7 @@ TEST_F(TouchEventQueueTest, ImmediateAckWithFollowupEvents) {
|
| }
|
|
|
| // Tests basic TouchEvent forwarding suppression.
|
| -TEST_F(TouchEventQueueTest, NoTouchBasic) {
|
| +TEST_F(LegacyTouchEventQueueTest, NoTouchBasic) {
|
| // Disable TouchEvent forwarding.
|
| OnHasTouchEventHandlers(false);
|
| PressTouchPoint(30, 5);
|
| @@ -979,8 +971,7 @@ TEST_F(TouchEventQueueTest, NoTouchBasic) {
|
| }
|
|
|
| // Tests that IsTouchStartPendingAck works correctly.
|
| -TEST_F(TouchEventQueueTest, PendingStart) {
|
| -
|
| +TEST_F(LegacyTouchEventQueueTest, PendingStart) {
|
| EXPECT_FALSE(IsPendingAckTouchStart());
|
|
|
| // Send the touchstart for one point (#1).
|
| @@ -1025,7 +1016,7 @@ TEST_F(TouchEventQueueTest, PendingStart) {
|
| }
|
|
|
| // Tests that the touch timeout is started when sending certain touch types.
|
| -TEST_F(TouchEventQueueTest, TouchTimeoutTypes) {
|
| +TEST_F(LegacyTouchEventQueueTest, TouchTimeoutTypes) {
|
| SetUpForTimeoutTesting();
|
|
|
| // Sending a TouchStart will start the timeout.
|
| @@ -1059,7 +1050,7 @@ TEST_F(TouchEventQueueTest, TouchTimeoutTypes) {
|
| // Tests that a delayed TouchEvent ack will trigger a TouchCancel timeout,
|
| // disabling touch forwarding until the next TouchStart is received after
|
| // the timeout events are ack'ed.
|
| -TEST_F(TouchEventQueueTest, TouchTimeoutBasic) {
|
| +TEST_F(LegacyTouchEventQueueTest, TouchTimeoutBasic) {
|
| SetUpForTimeoutTesting();
|
|
|
| // Queue a TouchStart.
|
| @@ -1113,7 +1104,7 @@ TEST_F(TouchEventQueueTest, TouchTimeoutBasic) {
|
|
|
| // Tests that the timeout is never started if the renderer consumes
|
| // a TouchEvent from the current touch sequence.
|
| -TEST_F(TouchEventQueueTest, NoTouchTimeoutIfRendererIsConsumingGesture) {
|
| +TEST_F(LegacyTouchEventQueueTest, NoTouchTimeoutIfRendererIsConsumingGesture) {
|
| SetUpForTimeoutTesting();
|
|
|
| // Queue a TouchStart.
|
| @@ -1147,7 +1138,7 @@ TEST_F(TouchEventQueueTest, NoTouchTimeoutIfRendererIsConsumingGesture) {
|
|
|
| // Tests that the timeout is never started if the renderer consumes
|
| // a TouchEvent from the current touch sequence.
|
| -TEST_F(TouchEventQueueTest, NoTouchTimeoutIfDisabledAfterTouchStart) {
|
| +TEST_F(LegacyTouchEventQueueTest, NoTouchTimeoutIfDisabledAfterTouchStart) {
|
| SetUpForTimeoutTesting();
|
|
|
| // Queue a TouchStart.
|
| @@ -1173,7 +1164,7 @@ TEST_F(TouchEventQueueTest, NoTouchTimeoutIfDisabledAfterTouchStart) {
|
| }
|
|
|
| // Tests that the timeout is never started if the ack is synchronous.
|
| -TEST_F(TouchEventQueueTest, NoTouchTimeoutIfAckIsSynchronous) {
|
| +TEST_F(LegacyTouchEventQueueTest, NoTouchTimeoutIfAckIsSynchronous) {
|
| SetUpForTimeoutTesting();
|
|
|
| // Queue a TouchStart.
|
| @@ -1185,7 +1176,7 @@ TEST_F(TouchEventQueueTest, NoTouchTimeoutIfAckIsSynchronous) {
|
|
|
| // Tests that the timeout does not fire if explicitly disabled while an event
|
| // is in-flight.
|
| -TEST_F(TouchEventQueueTest, NoTouchTimeoutIfDisabledWhileTimerIsActive) {
|
| +TEST_F(LegacyTouchEventQueueTest, NoTouchTimeoutIfDisabledWhileTimerIsActive) {
|
| SetUpForTimeoutTesting();
|
|
|
| // Queue a TouchStart.
|
| @@ -1200,7 +1191,7 @@ TEST_F(TouchEventQueueTest, NoTouchTimeoutIfDisabledWhileTimerIsActive) {
|
| }
|
|
|
| // Tests that the timeout does not fire if the delay is zero.
|
| -TEST_F(TouchEventQueueTest, NoTouchTimeoutIfTimeoutDelayIsZero) {
|
| +TEST_F(LegacyTouchEventQueueTest, NoTouchTimeoutIfTimeoutDelayIsZero) {
|
| SetUpForTimeoutTesting(base::TimeDelta(), base::TimeDelta());
|
|
|
| // As the delay is zero, timeout behavior should be disabled.
|
| @@ -1211,7 +1202,7 @@ TEST_F(TouchEventQueueTest, NoTouchTimeoutIfTimeoutDelayIsZero) {
|
| }
|
|
|
| // Tests that timeout delays for mobile sites take effect when appropriate.
|
| -TEST_F(TouchEventQueueTest, TouchTimeoutConfiguredForMobile) {
|
| +TEST_F(LegacyTouchEventQueueTest, TouchTimeoutConfiguredForMobile) {
|
| base::TimeDelta desktop_delay = DefaultTouchTimeoutDelay();
|
| base::TimeDelta mobile_delay = base::TimeDelta();
|
| SetUpForTimeoutTesting(desktop_delay, mobile_delay);
|
| @@ -1238,7 +1229,7 @@ TEST_F(TouchEventQueueTest, TouchTimeoutConfiguredForMobile) {
|
|
|
| // Tests that a TouchCancel timeout plays nice when the timed out touch stream
|
| // turns into a scroll gesture sequence.
|
| -TEST_F(TouchEventQueueTest, TouchTimeoutWithFollowupGesture) {
|
| +TEST_F(LegacyTouchEventQueueTest, TouchTimeoutWithFollowupGesture) {
|
| SetUpForTimeoutTesting();
|
|
|
| // Queue a TouchStart.
|
| @@ -1294,7 +1285,8 @@ TEST_F(TouchEventQueueTest, TouchTimeoutWithFollowupGesture) {
|
| // Tests that a TouchCancel timeout plays nice when the timed out touch stream
|
| // turns into a scroll gesture sequence, but the original event acks are
|
| // significantly delayed.
|
| -TEST_F(TouchEventQueueTest, TouchTimeoutWithFollowupGestureAndDelayedAck) {
|
| +TEST_F(LegacyTouchEventQueueTest,
|
| + TouchTimeoutWithFollowupGestureAndDelayedAck) {
|
| SetUpForTimeoutTesting();
|
|
|
| // Queue a TouchStart.
|
| @@ -1351,7 +1343,7 @@ TEST_F(TouchEventQueueTest, TouchTimeoutWithFollowupGestureAndDelayedAck) {
|
|
|
| // Tests that a delayed TouchEvent ack will not trigger a TouchCancel timeout if
|
| // the timed-out event had no consumer.
|
| -TEST_F(TouchEventQueueTest, NoCancelOnTouchTimeoutWithoutConsumer) {
|
| +TEST_F(LegacyTouchEventQueueTest, NoCancelOnTouchTimeoutWithoutConsumer) {
|
| SetUpForTimeoutTesting();
|
|
|
| // Queue a TouchStart.
|
| @@ -1390,7 +1382,7 @@ TEST_F(TouchEventQueueTest, NoCancelOnTouchTimeoutWithoutConsumer) {
|
|
|
| // Tests that TouchMove's movedBeyondSlopRegion is set to false if within the
|
| // boundary-inclusive slop region for an unconsumed TouchStart.
|
| -TEST_F(TouchEventQueueTest, TouchMovedBeyondSlopRegionCheck) {
|
| +TEST_F(LegacyTouchEventQueueTest, TouchMovedBeyondSlopRegionCheck) {
|
| SetUpForTouchMoveSlopTesting(kSlopLengthDips);
|
|
|
| // Queue a TouchStart.
|
| @@ -1440,7 +1432,7 @@ TEST_F(TouchEventQueueTest, TouchMovedBeyondSlopRegionCheck) {
|
| const float kFortyFiveDegreeSlopLengthXY =
|
| kSlopLengthDips * std::sqrt(2.f) / 2;
|
| MoveTouchPoint(0, kFortyFiveDegreeSlopLengthXY + .2f,
|
| - kFortyFiveDegreeSlopLengthXY + .2f);
|
| + kFortyFiveDegreeSlopLengthXY + .2f);
|
| EXPECT_EQ(1U, queued_event_count());
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| EXPECT_EQ(0U, GetAndResetAckedEventCount());
|
| @@ -1451,7 +1443,8 @@ TEST_F(TouchEventQueueTest, TouchMovedBeyondSlopRegionCheck) {
|
|
|
| // Tests that even very small TouchMove's movedBeyondSlopRegion is set to true
|
| // when the slop region's dimension is 0.
|
| -TEST_F(TouchEventQueueTest, MovedBeyondSlopRegionAlwaysTrueIfDimensionZero) {
|
| +TEST_F(LegacyTouchEventQueueTest,
|
| + MovedBeyondSlopRegionAlwaysTrueIfDimensionZero) {
|
| // Queue a TouchStart.
|
| PressTouchPoint(0, 0);
|
| SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -1470,7 +1463,8 @@ TEST_F(TouchEventQueueTest, MovedBeyondSlopRegionAlwaysTrueIfDimensionZero) {
|
|
|
| // Tests that secondary touch points can be forwarded even if the primary touch
|
| // point had no consumer.
|
| -TEST_F(TouchEventQueueTest, SecondaryTouchForwardedAfterPrimaryHadNoConsumer) {
|
| +TEST_F(LegacyTouchEventQueueTest,
|
| + SecondaryTouchForwardedAfterPrimaryHadNoConsumer) {
|
| // Queue a TouchStart.
|
| PressTouchPoint(0, 0);
|
| SendTouchEventAck(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS);
|
| @@ -1499,7 +1493,7 @@ TEST_F(TouchEventQueueTest, SecondaryTouchForwardedAfterPrimaryHadNoConsumer) {
|
|
|
| // Tests that secondary touch points can be forwarded after scrolling begins
|
| // while first touch point has no consumer.
|
| -TEST_F(TouchEventQueueTest, NoForwardingAfterScrollWithNoTouchConsumers) {
|
| +TEST_F(LegacyTouchEventQueueTest, NoForwardingAfterScrollWithNoTouchConsumers) {
|
| // Queue a TouchStart.
|
| PressTouchPoint(0, 0);
|
| SendTouchEventAck(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS);
|
| @@ -1529,7 +1523,7 @@ TEST_F(TouchEventQueueTest, NoForwardingAfterScrollWithNoTouchConsumers) {
|
| EXPECT_EQ(1U, GetAndResetAckedEventCount());
|
| }
|
|
|
| -TEST_F(TouchEventQueueTest, AsyncTouch) {
|
| +TEST_F(LegacyTouchEventQueueTest, AsyncTouch) {
|
| // Queue a TouchStart.
|
| PressTouchPoint(0, 1);
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| @@ -1537,29 +1531,29 @@ TEST_F(TouchEventQueueTest, AsyncTouch) {
|
| EXPECT_EQ(1U, GetAndResetAckedEventCount());
|
|
|
| for (int i = 0; i < 3; ++i) {
|
| - SendGestureEventAck(WebInputEvent::GestureScrollUpdate,
|
| - INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| -
|
| - MoveTouchPoint(0, 10, 5+i);
|
| - SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| - EXPECT_FALSE(HasPendingAsyncTouchMove());
|
| - EXPECT_EQ(WebInputEvent::Blocking, sent_event().dispatchType);
|
| - EXPECT_EQ(0U, queued_event_count());
|
| - EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| -
|
| - // Consuming a scroll event will throttle subsequent touchmoves.
|
| - SendGestureEventAck(WebInputEvent::GestureScrollUpdate,
|
| - INPUT_EVENT_ACK_STATE_CONSUMED);
|
| - MoveTouchPoint(0, 10, 7+i);
|
| - EXPECT_TRUE(HasPendingAsyncTouchMove());
|
| - EXPECT_EQ(0U, queued_event_count());
|
| - EXPECT_EQ(0U, GetAndResetSentEventCount());
|
| + SendGestureEventAck(WebInputEvent::GestureScrollUpdate,
|
| + INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| +
|
| + MoveTouchPoint(0, 10, 5 + i);
|
| + SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| + EXPECT_FALSE(HasPendingAsyncTouchMove());
|
| + EXPECT_EQ(WebInputEvent::Blocking, sent_event().dispatchType);
|
| + EXPECT_EQ(0U, queued_event_count());
|
| + EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| +
|
| + // Consuming a scroll event will throttle subsequent touchmoves.
|
| + SendGestureEventAck(WebInputEvent::GestureScrollUpdate,
|
| + INPUT_EVENT_ACK_STATE_CONSUMED);
|
| + MoveTouchPoint(0, 10, 7 + i);
|
| + EXPECT_TRUE(HasPendingAsyncTouchMove());
|
| + EXPECT_EQ(0U, queued_event_count());
|
| + EXPECT_EQ(0U, GetAndResetSentEventCount());
|
| }
|
| }
|
|
|
| // Ensure that touchmove's are appropriately throttled during a typical
|
| // scroll sequences that transitions between scrolls consumed and unconsumed.
|
| -TEST_F(TouchEventQueueTest, AsyncTouchThrottledAfterScroll) {
|
| +TEST_F(LegacyTouchEventQueueTest, AsyncTouchThrottledAfterScroll) {
|
| // Process a TouchStart
|
| PressTouchPoint(0, 1);
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| @@ -1746,7 +1740,7 @@ TEST_F(TouchEventQueueTest, AsyncTouchThrottledAfterScroll) {
|
| EXPECT_EQ(1U, GetAndResetAckedEventCount());
|
| }
|
|
|
| -TEST_F(TouchEventQueueTest, AsyncTouchFlushedByTouchEnd) {
|
| +TEST_F(LegacyTouchEventQueueTest, AsyncTouchFlushedByTouchEnd) {
|
| PressTouchPoint(0, 0);
|
| SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| @@ -1802,7 +1796,7 @@ TEST_F(TouchEventQueueTest, AsyncTouchFlushedByTouchEnd) {
|
|
|
| // Ensure that async touch dispatch and touch ack timeout interactions work
|
| // appropriately.
|
| -TEST_F(TouchEventQueueTest, AsyncTouchWithAckTimeout) {
|
| +TEST_F(LegacyTouchEventQueueTest, AsyncTouchWithAckTimeout) {
|
| SetUpForTimeoutTesting();
|
|
|
| // The touchstart should start the timeout.
|
| @@ -1884,7 +1878,7 @@ TEST_F(TouchEventQueueTest, AsyncTouchWithAckTimeout) {
|
|
|
| // Ensure that if the touch ack for an async touchmove triggers a follow-up
|
| // touch event, that follow-up touch will be forwarded appropriately.
|
| -TEST_F(TouchEventQueueTest, AsyncTouchWithTouchCancelAfterAck) {
|
| +TEST_F(LegacyTouchEventQueueTest, AsyncTouchWithTouchCancelAfterAck) {
|
| PressTouchPoint(0, 0);
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -1935,7 +1929,7 @@ TEST_F(TouchEventQueueTest, AsyncTouchWithTouchCancelAfterAck) {
|
|
|
| // Ensure that the async touch is fully reset if the touch sequence restarts
|
| // without properly terminating.
|
| -TEST_F(TouchEventQueueTest, AsyncTouchWithHardTouchStartReset) {
|
| +TEST_F(LegacyTouchEventQueueTest, AsyncTouchWithHardTouchStartReset) {
|
| PressTouchPoint(0, 0);
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -1976,7 +1970,7 @@ TEST_F(TouchEventQueueTest, AsyncTouchWithHardTouchStartReset) {
|
| // Ensure that even when the interval expires, we still need to wait for the
|
| // ack sent back from render to send the next async touchmove once the scroll
|
| // starts.
|
| -TEST_F(TouchEventQueueTest, SendNextThrottledAsyncTouchMoveAfterAck) {
|
| +TEST_F(LegacyTouchEventQueueTest, SendNextThrottledAsyncTouchMoveAfterAck) {
|
| // Process a TouchStart
|
| PressTouchPoint(0, 1);
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| @@ -2038,7 +2032,7 @@ TEST_F(TouchEventQueueTest, SendNextThrottledAsyncTouchMoveAfterAck) {
|
| // Ensure that even when we receive the ack from render, we still need to wait
|
| // for the interval expires to send the next async touchmove once the scroll
|
| // starts.
|
| -TEST_F(TouchEventQueueTest, SendNextAsyncTouchMoveAfterAckAndTimeExpire) {
|
| +TEST_F(LegacyTouchEventQueueTest, SendNextAsyncTouchMoveAfterAckAndTimeExpire) {
|
| // Process a TouchStart
|
| PressTouchPoint(0, 1);
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| @@ -2097,7 +2091,7 @@ TEST_F(TouchEventQueueTest, SendNextAsyncTouchMoveAfterAckAndTimeExpire) {
|
| EXPECT_EQ(1U, uncancelable_touch_moves_pending_ack_count());
|
| }
|
|
|
| -TEST_F(TouchEventQueueTest, AsyncTouchFlushedByNonTouchMove) {
|
| +TEST_F(LegacyTouchEventQueueTest, AsyncTouchFlushedByNonTouchMove) {
|
| // Process a TouchStart
|
| PressTouchPoint(0, 1);
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| @@ -2212,7 +2206,7 @@ TEST_F(TouchEventQueueTest, AsyncTouchFlushedByNonTouchMove) {
|
| // Ensure that even when we receive the ack from render, we still need to wait
|
| // for the interval expires to send the next async touchmove once the scroll
|
| // starts.
|
| -TEST_F(TouchEventQueueTest, DoNotIncreaseIfClientConsumeAsyncTouchMove) {
|
| +TEST_F(LegacyTouchEventQueueTest, DoNotIncreaseIfClientConsumeAsyncTouchMove) {
|
| // Process a TouchStart
|
| PressTouchPoint(0, 1);
|
| EXPECT_EQ(1U, GetAndResetSentEventCount());
|
| @@ -2274,7 +2268,7 @@ TEST_F(TouchEventQueueTest, DoNotIncreaseIfClientConsumeAsyncTouchMove) {
|
| EXPECT_EQ(0U, uncancelable_touch_moves_pending_ack_count());
|
| }
|
|
|
| -TEST_F(TouchEventQueueTest, TouchAbsorptionWithConsumedFirstMove) {
|
| +TEST_F(LegacyTouchEventQueueTest, TouchAbsorptionWithConsumedFirstMove) {
|
| // Queue a TouchStart.
|
| PressTouchPoint(0, 1);
|
| SendTouchEventAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -2313,7 +2307,7 @@ TEST_F(TouchEventQueueTest, TouchAbsorptionWithConsumedFirstMove) {
|
| EXPECT_EQ(0U, GetAndResetSentEventCount());
|
| }
|
|
|
| -TEST_F(TouchEventQueueTest, TouchStartCancelableDuringScroll) {
|
| +TEST_F(LegacyTouchEventQueueTest, TouchStartCancelableDuringScroll) {
|
| // Queue a touchstart and touchmove that go unconsumed, transitioning to an
|
| // active scroll sequence.
|
| PressTouchPoint(0, 1);
|
| @@ -2372,7 +2366,7 @@ TEST_F(TouchEventQueueTest, TouchStartCancelableDuringScroll) {
|
| ASSERT_EQ(1U, GetAndResetSentEventCount());
|
| }
|
|
|
| -TEST_F(TouchEventQueueTest, UnseenTouchPointerIdsNotForwarded) {
|
| +TEST_F(LegacyTouchEventQueueTest, UnseenTouchPointerIdsNotForwarded) {
|
| SyntheticWebTouchEvent event;
|
| event.PressPoint(0, 0);
|
| SendTouchEvent(event);
|
| @@ -2411,7 +2405,7 @@ TEST_F(TouchEventQueueTest, UnseenTouchPointerIdsNotForwarded) {
|
| }
|
|
|
| // Tests that touch points states are correct in TouchMove events.
|
| -TEST_F(TouchEventQueueTest, PointerStatesInTouchMove) {
|
| +TEST_F(LegacyTouchEventQueueTest, PointerStatesInTouchMove) {
|
| PressTouchPoint(1, 1);
|
| PressTouchPoint(2, 2);
|
| PressTouchPoint(3, 3);
|
| @@ -2468,7 +2462,7 @@ TEST_F(TouchEventQueueTest, PointerStatesInTouchMove) {
|
|
|
| // Tests that touch point state is correct in TouchMove events
|
| // when point properties other than position changed.
|
| -TEST_F(TouchEventQueueTest, PointerStatesWhenOtherThanPositionChanged) {
|
| +TEST_F(LegacyTouchEventQueueTest, PointerStatesWhenOtherThanPositionChanged) {
|
| PressTouchPoint(1, 1);
|
| SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED);
|
|
|
| @@ -2509,7 +2503,7 @@ TEST_F(TouchEventQueueTest, PointerStatesWhenOtherThanPositionChanged) {
|
| }
|
|
|
| // Tests that TouchMoves are filtered when none of the points are changed.
|
| -TEST_F(TouchEventQueueTest, FilterTouchMovesWhenNoPointerChanged) {
|
| +TEST_F(LegacyTouchEventQueueTest, FilterTouchMovesWhenNoPointerChanged) {
|
| PressTouchPoint(1, 1);
|
| PressTouchPoint(2, 2);
|
| SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED);
|
| @@ -2562,7 +2556,7 @@ TEST_F(TouchEventQueueTest, FilterTouchMovesWhenNoPointerChanged) {
|
| }
|
|
|
| // Tests that touch-scroll-notification is not pushed into an empty queue.
|
| -TEST_F(TouchEventQueueTest, TouchScrollNotificationOrder_EmptyQueue) {
|
| +TEST_F(LegacyTouchEventQueueTest, TouchScrollNotificationOrder_EmptyQueue) {
|
| PrependTouchScrollNotification();
|
|
|
| EXPECT_EQ(0U, GetAndResetAckedEventCount());
|
| @@ -2572,7 +2566,7 @@ TEST_F(TouchEventQueueTest, TouchScrollNotificationOrder_EmptyQueue) {
|
|
|
| // Tests touch-scroll-notification firing order when the event is placed at the
|
| // end of touch queue because of a pending ack for the head of the queue.
|
| -TEST_F(TouchEventQueueTest, TouchScrollNotificationOrder_EndOfQueue) {
|
| +TEST_F(LegacyTouchEventQueueTest, TouchScrollNotificationOrder_EndOfQueue) {
|
| PressTouchPoint(1, 1);
|
|
|
| EXPECT_EQ(0U, GetAndResetAckedEventCount());
|
| @@ -2604,7 +2598,7 @@ TEST_F(TouchEventQueueTest, TouchScrollNotificationOrder_EndOfQueue) {
|
|
|
| // Tests touch-scroll-notification firing order when the event is placed in the
|
| // 2nd position in the touch queue between two events.
|
| -TEST_F(TouchEventQueueTest, TouchScrollNotificationOrder_SecondPosition) {
|
| +TEST_F(LegacyTouchEventQueueTest, TouchScrollNotificationOrder_SecondPosition) {
|
| PressTouchPoint(1, 1);
|
| MoveTouchPoint(0, 5, 5);
|
| ReleaseTouchPoint(0);
|
| @@ -2654,7 +2648,7 @@ TEST_F(TouchEventQueueTest, TouchScrollNotificationOrder_SecondPosition) {
|
|
|
| // Tests that if touchStartOrFirstTouchMove is correctly set up for touch
|
| // events.
|
| -TEST_F(TouchEventQueueTest, TouchStartOrFirstTouchMove) {
|
| +TEST_F(LegacyTouchEventQueueTest, TouchStartOrFirstTouchMove) {
|
| PressTouchPoint(1, 1);
|
| SendTouchEventAck(INPUT_EVENT_ACK_STATE_CONSUMED);
|
| EXPECT_EQ(WebInputEvent::TouchStart, sent_event().type());
|
|
|