// 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 "content/browser/renderer_host/overscroll_controller.h" #include <memory> #include "base/containers/queue.h" #include "base/test/scoped_feature_list.h" #include "content/browser/renderer_host/overscroll_controller_delegate.h" #include "content/common/features.h" #include "content/public/browser/overscroll_configuration.h" #include "content/public/test/scoped_overscroll_modes.h" #include "content/test/test_overscroll_delegate.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" namespace content { class OverscrollControllerTest : public ::testing::Test { … }; // Tests that if a mouse-wheel is consumed by content before overscroll is // initiated, overscroll will not initiate anymore. TEST_F(OverscrollControllerTest, MouseWheelConsumedPreventsOverscroll) { … } // Verifying the inertial scroll event completes overscroll. After that we will // ignore the following inertial scroll events until new sequence start. TEST_F(OverscrollControllerTest, InertialGestureScrollUpdateCompletesOverscroll) { … } // Ensure inertial gesture scroll update can not start overscroll. TEST_F(OverscrollControllerTest, InertialGSUsDoNotStartOverscroll) { … } // After 300ms inertial gesture scroll updates, overscroll must get cancelled // if not completed. TEST_F(OverscrollControllerTest, OnlyProcessLimitedInertialGSUEvents) { … } // Verifies that when pull-to-refresh is disabled, it is not triggered for // neither touchpad nor touchscreen. TEST_F(OverscrollControllerTest, PullToRefreshDisabled) { … } // Verifies that when pull-to-refresh is enabled, it is triggered for both // touchpad and touchscreen. TEST_F(OverscrollControllerTest, PullToRefreshEnabled) { … } // Verifies that when pull-to-refresh is enabled only for touchscreen, it is // triggered for touchscreen but not for touchpad. TEST_F(OverscrollControllerTest, PullToRefreshEnabledTouchscreen) { … } // Ensure disabling kTouchpadOverscrollHistoryNavigation will prevent overscroll // from touchpad. TEST_F(OverscrollControllerTest, DisableTouchpadOverscrollHistoryNavigation) { … } // Verifies that if an overscroll happens before cool off period after a page // scroll, it does not trigger pull-to-refresh. Verifies following sequence of // scrolls: // 1) Page scroll; // 2) Scroll before cool off -> PTR not triggered; // 3) Scroll before cool off -> PTR not triggered; // 4) Scroll after cool off -> PTR triggered; // 5) Scroll before cool off -> PTR triggered. TEST_F(OverscrollControllerTest, PullToRefreshBeforeCoolOff) { … } // Verifies that if an overscroll happens after cool off period after a page // scroll, it triggers pull-to-refresh. Verifies the following sequence of // scrolls: // 1) Page scroll; // 2) Scroll after cool off -> PTR triggered; // 3) Scroll before cool off -> PTR triggered; TEST_F(OverscrollControllerTest, PullToRefreshAfterCoolOff) { … } } // namespace content