#include "ui/events/gesture_detection/gesture_provider.h"
#include <stddef.h>
#include <memory>
#include "base/check.h"
#include "base/location.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/event_constants.h"
#include "ui/events/gesture_detection/gesture_event_data.h"
#include "ui/events/test/motion_event_test_utils.h"
#include "ui/events/types/event_type.h"
#include "ui/events/velocity_tracker/motion_event.h"
#include "ui/gfx/geometry/point_f.h"
TimeTicks;
MockMotionEvent;
namespace ui {
namespace {
const float kFakeCoordX = …;
const float kFakeCoordY = …;
const base::TimeDelta kOneSecond = …;
const base::TimeDelta kOneMicrosecond = …;
const base::TimeDelta kDeltaTimeForFlingSequences = …;
const float kMockTouchRadius = …;
const float kMaxTwoFingerTapSeparation = …;
GestureProvider::Config CreateDefaultConfig() { … }
gfx::RectF BoundsForSingleMockTouchAtLocation(float x, float y) { … }
}
class GestureProviderTest : public testing::Test, public GestureProviderClient { … };
TEST_F(GestureProviderTest, GestureTapPrimaryUniqueTouchEventId) { … }
TEST_F(GestureProviderTest, GestureTap) { … }
TEST_F(GestureProviderTest, GestureTapWithDelay) { … }
TEST_F(GestureProviderTest, GestureFlingAndCancelLongPress) { … }
TEST_F(GestureProviderTest, ScrollEventActionUpSequence) { … }
TEST_F(GestureProviderTest, ScrollEventActionCancelSequence) { … }
TEST_F(GestureProviderTest, FlingEventSequence) { … }
TEST_F(GestureProviderTest, GestureCancelledOnCancelEvent) { … }
TEST_F(GestureProviderTest, GestureCancelledOnDetectionReset) { … }
TEST_F(GestureProviderTest, TapPendingConfirmationCancelledOnCancelEvent) { … }
TEST_F(GestureProviderTest, NoTapAfterScrollBegins) { … }
TEST_F(GestureProviderTest, DoubleTap) { … }
TEST_F(GestureProviderTest, DoubleTapDragZoomBasic) { … }
TEST_F(GestureProviderTest, ScrollUpdateValues) { … }
TEST_F(GestureProviderTest, FractionalScroll) { … }
TEST_F(GestureProviderTest, ScrollBeginValues) { … }
TEST_F(GestureProviderTest, SlopRegionCheckOnOneFingerScroll) { … }
TEST_F(GestureProviderTest, SlopRegionCheckOnTwoFingerScroll) { … }
TEST_F(GestureProviderTest, SlopRegionCheckOnMissingSecondaryPointerDownEvent) { … }
TEST_F(GestureProviderTest, NoSlopRegionCheckOnThreeFingerScroll) { … }
TEST_F(GestureProviderTest, ScrollStartWithSecondaryPointer) { … }
TEST_F(GestureProviderTest, NoFlingBeforeExeedingSlopRegion) { … }
TEST_F(GestureProviderTest, LongPressAndTapCancelledWhenScrollBegins) { … }
TEST_F(GestureProviderTest, GestureLongTap) { … }
TEST_F(GestureProviderTest, GestureLongPressDoesNotPreventScrolling) { … }
TEST_F(GestureProviderTest, DeepPressAcceleratedLongPress) { … }
TEST_F(GestureProviderTest, StylusButtonCausesLongPress) { … }
TEST_F(GestureProviderTest, DisabledStylusButtonDoesNotCauseLongPress) { … }
TEST_F(GestureProviderTest, NoGestureLongPressDuringDoubleTap) { … }
TEST_F(GestureProviderTest, TouchSlopRemovedFromScroll) { … }
TEST_F(GestureProviderTest, NoTouchScrollWithinSlop) { … }
TEST_F(GestureProviderTest, NoStylusScrollWithinSlop) { … }
TEST_F(GestureProviderTest, SnapScrollWithStylusSlop) { … }
TEST_F(GestureProviderTest, NoDoubleTapWhenTooRapid) { … }
TEST_F(GestureProviderTest, NoDoubleTapWhenExplicitlyDisabled) { … }
TEST_F(GestureProviderTest, NoDoubleTapWhenConsumerDoesntWantIt) { … }
TEST_F(GestureProviderTest, NoDelayedTapWhenDoubleTapSupportToggled) { … }
TEST_F(GestureProviderTest, NoDoubleTapDragZoomWhenDisabledOnPlatform) { … }
TEST_F(GestureProviderTest, NoDoubleTapDragZoomWhenDisabledOnPage) { … }
TEST_F(GestureProviderTest, FixedPageScaleDuringDoubleTapDragZoom) { … }
TEST_F(GestureProviderTest, PinchZoom) { … }
TEST_F(GestureProviderTest, NoPinchZoomWithFatFinger) { … }
TEST_F(GestureProviderTest, MultiFingerSwipe) { … }
TEST_F(GestureProviderTest, GesturesCancelledAfterLongPressCausesLostFocus) { … }
TEST_F(GestureProviderTest, CancelActiveTouchSequence) { … }
TEST_F(GestureProviderTest, DoubleTapDragZoomCancelledOnSecondaryPointerDown) { … }
TEST_F(GestureProviderTest, GestureBeginAndEnd) { … }
TEST_F(GestureProviderTest, GestureBeginAndEndOnCancel) { … }
TEST_F(GestureProviderTest, TwoFingerTap) { … }
TEST_F(GestureProviderTest, TwoFingerTapCancelledByFingerMovement) { … }
TEST_F(GestureProviderTest, TwoFingerTapCancelledByDelay) { … }
TEST_F(GestureProviderTest, TwoFingerTapCancelledByDistanceBetweenPointers) { … }
TEST_F(GestureProviderTest, PinchExceedingSlopCausesUpdate) { … }
TEST_F(GestureProviderTest, PinchBelowMinSpanCausesUpdate) { … }
TEST_F(GestureProviderTest, PinchExceedingSlopWithinMinScale) { … }
TEST_F(GestureProviderTest, PinchZoomWithThreshold) { … }
TEST_F(GestureProviderTest, MinGestureBoundsLength) { … }
TEST_F(GestureProviderTest, MaxGestureBoundsLength) { … }
TEST_F(GestureProviderTest, ZeroRadiusBoundingBox) { … }
TEST_F(GestureProviderTest, NoMinOrMaxGestureBoundsLengthWithStylusOrMouse) { … }
#if BUILDFLAG(IS_MAC) && defined(ARCH_CPU_ARM64)
#define MAYBE_BoundingBoxForShowPressAndTapGesture …
#else
#define MAYBE_BoundingBoxForShowPressAndTapGesture …
#endif
TEST_F(GestureProviderTest, MAYBE_BoundingBoxForShowPressAndTapGesture) { … }
TEST_F(GestureProviderTest, SingleTapRepeat) { … }
TEST_F(GestureProviderTest, SingleTapRepeatLengthOfOne) { … }
TEST_F(GestureProviderTest, MaxDragDistanceHistogramsWithTap) { … }
TEST_F(GestureProviderTest, MaxDragDistanceHistogramsWithDrag) { … }
}