chromium/components/input/fling_controller_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/fling_controller.h"

#include "base/rand_util.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/blink/fling_booster.h"
#include "ui/events/gestures/physics_based_fling_curve.h"

WebGestureEvent;
WebInputEvent;
WebMouseWheelEvent;
PhysicsBasedFlingCurve;

namespace {
constexpr double kFrameDelta =;
}  // namespace

namespace input {

class FakeFlingController : public FlingController {};

class FlingControllerTest : public FlingControllerEventSenderClient,
                            public FlingControllerSchedulerClient,
                            public testing::TestWithParam<bool> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(FlingControllerTest,
       ControllerSendsWheelEndOnTouchpadFlingWithZeroVelocity) {}

TEST_P(FlingControllerTest,
       ControllerSendsGSEOnTouchscreenFlingWithZeroVelocity) {}

TEST_P(FlingControllerTest, ControllerHandlesTouchpadGestureFling) {}

// Ensure that the start time of a fling is measured from the last received
// GSU. This ensures that the first progress fling during FlingStart should
// send significant delta. If we're using the FlingStart as the start time, we
// would send none or very little delta.
TEST_P(FlingControllerTest, FlingStartsAtLastScrollUpdate) {}

// Tests that when a fling is interrupted (e.g. by having reached the end of
// the content), a subsequent fling isn't boosted. An example here would be an
// infinite scroller that loads more content after hitting the scroll extent.
TEST_P(FlingControllerTest, InterruptedFlingIsntBoosted) {}

TEST_P(FlingControllerTest, ControllerHandlesTouchscreenGestureFling) {}

TEST_P(FlingControllerTest, ControllerSendsWheelEndWhenTouchpadFlingIsOver) {}

TEST_P(FlingControllerTest, ControllerSendsGSEWhenTouchscreenFlingIsOver) {}

TEST_P(FlingControllerTest, EarlyTouchpadFlingCancelationOnFlingStop) {}

TEST_P(FlingControllerTest, EarlyTouchscreenFlingCancelationOnFlingStop) {}

TEST_P(FlingControllerTest, GestureFlingCancelOutsideFling) {}

TEST_P(FlingControllerTest, GestureFlingNotCancelledBySmallTimeDelta) {}

TEST_P(FlingControllerTest, GestureFlingWithNegativeTimeDelta) {}

// Regression test for https://crbug.com/924279
TEST_P(FlingControllerTest, TouchpadFlingWithOldEvent) {}

TEST_P(FlingControllerTest, ControllerBoostsTouchpadFling) {}

TEST_P(FlingControllerTest, ControllerBoostsTouchscreenFling) {}

// Ensure that once a fling finishes, the next fling doesn't get boosted.
TEST_P(FlingControllerTest, ControllerDoesntBoostFinishedFling) {}

TEST_P(FlingControllerTest, ControllerNotifiesTheClientAfterFlingStart) {}

TEST_P(FlingControllerTest, MiddleClickAutoScrollFling) {}

// Ensure that the fling controller does not start a fling if the last touchpad
// wheel event was consumed.
TEST_P(FlingControllerTest, NoFlingStartAfterWheelEventConsumed) {}

class FlingControllerWithPhysicsBasedFlingTest : public FlingControllerTest {};

INSTANTIATE_TEST_SUITE_P();

// Ensure the bounding distance for boosted physics based flings is increased
// by a factor of the boost_multiplier and default multiplier
TEST_P(FlingControllerWithPhysicsBasedFlingTest,
       ControllerBoostsTouchscreenFling) {}

// Ensure that once a fling finishes, the next fling has a boost_multiplier of 1
TEST_P(FlingControllerWithPhysicsBasedFlingTest,
       ControllerDoesntBoostFinishedFling) {}

}  // namespace input