chromium/components/input/touch_action_filter_unittest.cc

// Copyright 2013 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/touch_action_filter.h"

#include "components/input/event_with_latency_info.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 "third_party/blink/public/mojom/input/input_event_result.mojom-shared.h"
#include "ui/events/blink/blink_features.h"

SyntheticWebGestureEventBuilder;
WebGestureEvent;
WebInputEvent;

namespace input {
namespace {

const blink::WebGestureDevice kSourceDevice =;

}  // namespace

class TouchActionFilterTest : public testing::Test {};

TEST_F(TouchActionFilterTest, SimpleFilter) {}

TEST_F(TouchActionFilterTest, PanLeft) {}

TEST_F(TouchActionFilterTest, PanRight) {}

TEST_F(TouchActionFilterTest, PanX) {}

TEST_F(TouchActionFilterTest, PanUp) {}

TEST_F(TouchActionFilterTest, PanDown) {}

TEST_F(TouchActionFilterTest, PanY) {}

TEST_F(TouchActionFilterTest, PanXY) {}

TEST_F(TouchActionFilterTest, BitMath) {}

TEST_F(TouchActionFilterTest, MultiTouch) {}

class TouchActionFilterPinchTest : public testing::Test {};

TEST_F(TouchActionFilterPinchTest, Pinch) {}

// Enables force enable zoom will override touch-action except for
// touch-action: none.
TEST_F(TouchActionFilterPinchTest, ForceEnableZoom) {}

TEST_F(TouchActionFilterTest, DoubleTapWithTouchActionAuto) {}

TEST_F(TouchActionFilterTest, DoubleTap) {}

TEST_F(TouchActionFilterTest, SingleTapWithTouchActionAuto) {}

TEST_F(TouchActionFilterTest, SingleTap) {}

TEST_F(TouchActionFilterTest, TouchActionResetsOnResetTouchAction) {}

TEST_F(TouchActionFilterTest, TouchActionResetMidSequence) {}

// This test makes sure that we do not reset scrolling touch action in the
// middle of a gesture sequence.
TEST_F(TouchActionFilterTest, TouchActionNotResetWithinGestureSequence) {}

// The following 3 tests ensures that when the IPC message
// OnHasTouchEventHandlers is received in the middle of a gesture sequence, the
// touch action is not reset.
TEST_F(TouchActionFilterTest, OnHasTouchEventHandlersReceivedDuringTap) {}

TEST_F(TouchActionFilterTest, OnHasTouchEventHandlersReceivedDuringDoubleTap) {}

TEST_F(TouchActionFilterTest, OnHasTouchEventHandlersReceivedDuringScroll) {}

// If OnHasTouchEventHandlers IPC is received after LongTap or TwoFingerTap,
// the touch action should be reset.
TEST_F(TouchActionFilterTest,
       OnHasTouchEventHandlersReceivedAfterLongTapOrTwoFingerTap) {}

TEST_F(TouchActionFilterTest, OnHasTouchEventHandlersReceivedAfterTouchStart) {}

TEST_F(TouchActionFilterTest, ResetTouchActionWithActiveTouch) {}

// If the renderer is busy, the gesture event might have come before the
// OnHasTouchEventHanlders IPC is received. In this case, we should allow all
// the gestures.
TEST_F(TouchActionFilterTest, GestureArrivesBeforeHasHandlerSet) {}

TEST_F(TouchActionFilterTest,
       PinchGesturesAllowedByCompositorAllowedTouchAction) {}

// Test gesture event filtering with compositor allowed touch action. It should
// test all 3 kinds of results: Allowed / Dropped / Delayed.
TEST_F(TouchActionFilterTest, FilterWithCompositorAllowedListedTouchAction) {}

TEST_F(TouchActionFilterTest, CompositorAllowedTouchActionResetToAuto) {}

TEST_F(TouchActionFilterTest, CompositorAllowedTouchActionAutoNoHasHandlers) {}

TEST_F(TouchActionFilterTest, ResetBeforeHasHandlerSet) {}

TEST_F(TouchActionFilterTest,
       CompositorAllowedTouchActionNotResetAtGestureScrollEnd) {}

// Having a gesture scroll begin without tap down should assume touch action is
// auto;
TEST_F(TouchActionFilterTest, ScrollBeginWithoutTapDown) {}

// This tests a gesture tap down with |num_of_active_touches_| == 0
TEST_F(TouchActionFilterTest, TapDownWithZeroNumOfActiveTouches) {}

// Regression test for crbug.com/771330. One can start one finger panning y, and
// add another finger to pinch zooming. The pinch zooming should not be allowed
// if the allowed touch action doesn't allow it.
TEST_F(TouchActionFilterTest, PinchZoomStartsWithOneFingerPanDisallowed) {}

TEST_F(TouchActionFilterTest, ScrollBeginWithoutTapDownWithKnownTouchAction) {}

TEST_F(TouchActionFilterTest, TouchpadScroll) {}

}  // namespace input