chromium/components/input/passthrough_touch_event_queue_unittest.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/input/passthrough_touch_event_queue.h"

#include <stddef.h>

#include <memory>
#include <utility>

#include "base/check_op.h"
#include "base/containers/circular_deque.h"
#include "base/location.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "components/input/timeout_monitor.h"
#include "components/input/web_touch_event_traits.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/events/base_event_utils.h"

SyntheticWebTouchEvent;
WebGestureEvent;
WebInputEvent;
WebTouchEvent;
WebTouchPoint;

namespace input {
namespace {

const double kMinSecondsBetweenThrottledTouchmoves =;
const float kSlopLengthDips =;
const float kHalfSlopLengthDips =;

base::TimeDelta DefaultTouchTimeoutDelay() {}
}  // namespace

class PassthroughTouchEventQueueTest : public testing::Test,
                                       public PassthroughTouchEventQueueClient {};

// Tests that touch-events are queued properly.
TEST_F(PassthroughTouchEventQueueTest, Basic) {}

// Tests that touch-events with multiple points are queued properly.
TEST_F(PassthroughTouchEventQueueTest, BasicMultiTouch) {}

// Tests that the touch-queue continues delivering events for an active touch
// sequence after all handlers are removed.
TEST_F(PassthroughTouchEventQueueTest,
       TouchesForwardedIfHandlerRemovedDuringSequence) {}

// Tests that addition of a touch handler during a touch sequence will continue
// forwarding events.
TEST_F(PassthroughTouchEventQueueTest,
       ActiveSequenceStillForwardedWhenHandlersAdded) {}

// Tests that removal of a touch handler during a touch sequence will not
// prevent the remaining sequence from being forwarded, even if another touch
// handler is registered during the same touch sequence.
TEST_F(PassthroughTouchEventQueueTest,
       ActiveSequenceDroppedWhenHandlersRemoved) {}

// Tests that removal/addition of a touch handler without any intervening
// touch activity has no affect on touch forwarding.
TEST_F(PassthroughTouchEventQueueTest,
       ActiveSequenceUnaffectedByRepeatedHandlerRemovalAndAddition) {}

// Tests that the touch-event queue is robust to redundant acks.
TEST_F(PassthroughTouchEventQueueTest, SpuriousAcksIgnored) {}

// Tests that touch-move events are not sent to the renderer even if the
// preceding touch-press event did not have a consumer.
TEST_F(PassthroughTouchEventQueueTest, NoConsumer) {}

TEST_F(PassthroughTouchEventQueueTest, AckTouchEventInReverse) {}

// Tests that touch-event's enqueued via a touch ack are properly handled.
TEST_F(PassthroughTouchEventQueueTest, AckWithFollowupEvents) {}

// Tests that touch-events can be synchronously ack'ed.
TEST_F(PassthroughTouchEventQueueTest, SynchronousAcks) {}

// Tests that touch-events acks are in order even with synchronous acks.
TEST_F(PassthroughTouchEventQueueTest, SynchronousAcksInOrder) {}

// Tests that followup events triggered by an immediate ack from
// TouchEventQueue::QueueEvent() are properly handled.
TEST_F(PassthroughTouchEventQueueTest, ImmediateAckWithFollowupEvents) {}

// Tests that basic TouchEvent forwarding suppression has been disabled.
TEST_F(PassthroughTouchEventQueueTest, NoTouchBasic) {}

// Tests that IsTouchStartPendingAck works correctly.
TEST_F(PassthroughTouchEventQueueTest, PendingStart) {}

// Tests that the touch timeout is started when sending certain touch types.
TEST_F(PassthroughTouchEventQueueTest, 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(PassthroughTouchEventQueueTest, TouchTimeoutBasic) {}

// Tests that the timeout is never started if the renderer consumes
// a TouchEvent from the current touch sequence.
TEST_F(PassthroughTouchEventQueueTest,
       NoTouchTimeoutIfRendererIsConsumingGesture) {}

// Tests that the timeout is never started if the renderer consumes
// a TouchEvent from the current touch sequence.
TEST_F(PassthroughTouchEventQueueTest,
       NoTouchTimeoutIfDisabledAfterTouchStart) {}

// Tests that the timeout is never started if the ack is synchronous.
TEST_F(PassthroughTouchEventQueueTest, NoTouchTimeoutIfAckIsSynchronous) {}

// Tests that the timeout does not fire if explicitly disabled while an event
// is in-flight.
TEST_F(PassthroughTouchEventQueueTest,
       NoTouchTimeoutIfDisabledWhileTimerIsActive) {}

// Tests that the timeout does not fire if the delay is zero.
TEST_F(PassthroughTouchEventQueueTest, NoTouchTimeoutIfTimeoutDelayIsZero) {}

// Tests that timeout delays for mobile sites take effect when appropriate.
TEST_F(PassthroughTouchEventQueueTest, TouchTimeoutConfiguredForMobile) {}

// Tests that a TouchCancel timeout plays nice when the timed out touch stream
// turns into a scroll gesture sequence.
TEST_F(PassthroughTouchEventQueueTest, 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(PassthroughTouchEventQueueTest,
       TouchTimeoutWithFollowupGestureAndDelayedAck) {}

// Tests that a delayed TouchEvent ack will not trigger a TouchCancel timeout if
// the timed-out event had no consumer.
TEST_F(PassthroughTouchEventQueueTest, NoCancelOnTouchTimeoutWithoutConsumer) {}

// Tests that TouchMove's movedBeyondSlopRegion is set to false if within the
// boundary-inclusive slop region for an unconsumed TouchStart.
TEST_F(PassthroughTouchEventQueueTest, TouchMovedBeyondSlopRegionCheck) {}

// Tests that even very small TouchMove's movedBeyondSlopRegion is set to true
// when the slop region's dimension is 0.
TEST_F(PassthroughTouchEventQueueTest,
       MovedBeyondSlopRegionAlwaysTrueIfDimensionZero) {}

// Tests that secondary touch points can be forwarded even if the primary touch
// point had no consumer.
TEST_F(PassthroughTouchEventQueueTest,
       SecondaryTouchForwardedAfterPrimaryHadNoConsumer) {}

// Tests that secondary touch points can be forwarded after scrolling begins
// while first touch point has no consumer.
TEST_F(PassthroughTouchEventQueueTest,
       NoForwardingAfterScrollWithNoTouchConsumers) {}

TEST_F(PassthroughTouchEventQueueTest, TouchAbsorptionWithConsumedFirstMove) {}

TEST_F(PassthroughTouchEventQueueTest, TouchStartCancelableDuringScroll) {}

TEST_F(PassthroughTouchEventQueueTest, UnseenTouchPointerIdsNotForwarded) {}

// Tests that touch points states are correct in TouchMove events.
TEST_F(PassthroughTouchEventQueueTest, PointerStatesInTouchMove) {}

// Tests that touch point state is correct in TouchMove events
// when point properties other than position changed.
TEST_F(PassthroughTouchEventQueueTest,
       PointerStatesWhenOtherThanPositionChanged) {}

// Tests that TouchMoves are filtered when none of the points are changed.
TEST_F(PassthroughTouchEventQueueTest, FilterTouchMovesWhenNoPointerChanged) {}

// Tests that touch-scroll-notification is queued normally.
TEST_F(PassthroughTouchEventQueueTest,
       TouchScrollNotificationOrder_EmptyQueue) {}

// Tests touch-scroll-notification firing is appended to the tail of sent
// events since all events are sent right away.
TEST_F(PassthroughTouchEventQueueTest,
       TouchScrollNotificationOrder_EndOfQueue) {}

// Tests that if touchStartOrFirstTouchMove is correctly set up for touch
// events.
TEST_F(PassthroughTouchEventQueueTest, TouchStartOrFirstTouchMove) {}

TEST_F(PassthroughTouchEventQueueTest, TouchScrollStartedUnfiltered) {}

TEST_F(PassthroughTouchEventQueueTest,
       TouchStartWithoutPageHandlersUnfiltered) {}

TEST_F(PassthroughTouchEventQueueTest, TouchStartWithPageHandlersUnfiltered) {}

TEST_F(PassthroughTouchEventQueueTest, TouchMoveFilteredAfterTimeout) {}

TEST_F(PassthroughTouchEventQueueTest, TouchMoveWithoutPageHandlersUnfiltered) {}

TEST_F(PassthroughTouchEventQueueTest, StationaryTouchMoveFiltered) {}

TEST_F(PassthroughTouchEventQueueTest,
       StationaryTouchMoveWithActualTouchMoveUnfiltered) {}

TEST_F(PassthroughTouchEventQueueTest, NonTouchMoveUnfiltered) {}

TEST_F(PassthroughTouchEventQueueTest, TouchMoveWithNonTouchMoveUnfiltered) {}

TEST_F(PassthroughTouchEventQueueTest,
       TouchMoveWithoutSequenceHandlerUnfiltered) {}

TEST_F(PassthroughTouchEventQueueTest,
       TouchStartUnfilteredWithForwardDiscrete) {}

TEST_F(PassthroughTouchEventQueueTest, TouchMoveFilteredWithForwardDiscrete) {}

TEST_F(PassthroughTouchEventQueueTest, TouchStartUnfilteredWithForwardAll) {}

TEST_F(PassthroughTouchEventQueueTest, TouchMoveUnfilteredWithForwardAll) {}

}  // namespace input