// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifdef UNSAFE_BUFFERS_BUILD // TODO(crbug.com/351564777): Remove this and convert code to safer constructs. #pragma allow_unsafe_buffers #endif #include "third_party/blink/renderer/platform/widget/input/elastic_overscroll_controller_bezier.h" #include "build/build_config.h" #include "cc/input/input_handler.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/input/web_input_event.h" #include "third_party/blink/public/common/input/web_mouse_wheel_event.h" #include "ui/gfx/geometry/vector2d_conversions.h" namespace blink { Size; Vector2dF; PhaseState; class MockScrollElasticityHelper : public cc::ScrollElasticityHelper { … }; class ElasticOverscrollControllerBezierTest : public testing::Test { … }; // Tests that the scroller "stretches" as expected when an overscroll occurs // on a non-scrollable area. See ReconcileStretchAndScroll for an overscroll // stretch on scrollable areas. TEST_F(ElasticOverscrollControllerBezierTest, OverscrollStretch) { … } // Verify that synthetic gesture events do not trigger an overscroll. TEST_F(ElasticOverscrollControllerBezierTest, NoSyntheticEventsOverscroll) { … } // Verify that ReconcileStretchAndScroll reduces the overscrolled delta. TEST_F(ElasticOverscrollControllerBezierTest, ReconcileStretchAndScroll) { … } // Tests that momentum_animation_start_time_ doesn't get reset when the // overscroll animation is ticking and the scroller is diagonally overscrolled. TEST_F(ElasticOverscrollControllerBezierTest, VerifyInitialStretchDelta) { … } // Tests if the overscrolled delta maps correctly to the actual amount that the // scroller gets stretched. TEST_F(ElasticOverscrollControllerBezierTest, VerifyOverscrollBounceDistance) { … } // Tests that the bounce back animation ticks as expected. If the animation was // successfully created, the call to OverscrollBounceController::Animate should // tick the animation as expected. When the stretch amount is near 0, the // scroller should treat the bounce as "completed". TEST_F(ElasticOverscrollControllerBezierTest, VerifyBackwardAnimationTick) { … } // Tests that the bounce forward animation ticks as expected. TEST_F(ElasticOverscrollControllerBezierTest, VerifyForwardAnimationTick) { … } // Tests that the bounce forward animation is *not* played when the velocity is // less than kIgnoreForwardBounceVelocityThreshold. This can be verified by // checking bounce_forwards_distance_ (since it is a function of velocity) TEST_F(ElasticOverscrollControllerBezierTest, VerifyForwardAnimationIsNotPlayed) { … } // Tests initiating a scroll when a bounce back animation is in progress works // as expected. TEST_F(ElasticOverscrollControllerBezierTest, VerifyScrollDuringBounceBack) { … } // Tests that animation doesn't get created when unused_delta is 0. TEST_F(ElasticOverscrollControllerBezierTest, VerifyAnimationNotCreated) { … } } // namespace blink