chromium/third_party/blink/renderer/core/scroll/scroll_test.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/scroll/scroll_animator.h"

#include "base/test/bind.h"
#include "cc/base/features.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/renderer/core/css/css_style_declaration.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/root_frame_viewport.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/geometry/dom_rect.h"
#include "third_party/blink/renderer/core/layout/layout_box.h"
#include "third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/scroll/scroll_animator_base.h"
#include "third_party/blink/renderer/core/scroll/scrollable_area.h"
#include "third_party/blink/renderer/core/testing/sim/sim_request.h"
#include "third_party/blink/renderer/core/testing/sim/sim_test.h"
#include "third_party/blink/renderer/platform/testing/paint_test_configurations.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"

namespace blink {

namespace {
double ScrollAnimationDuration() {}
}  // namespace

class FractionalScrollSimTest : public SimTest, public PaintTestConfigurations {};

INSTANTIATE_PAINT_TEST_SUITE_P();

TEST_P(FractionalScrollSimTest, GetBoundingClientRectAtFractional) {}

TEST_P(FractionalScrollSimTest, NoRepaintOnScrollFromSubpixel) {}

// Verifies that the sticky constraints are correctly computed when the scroll
// offset is fractional. Ensures any kind of layout unit snapping is
// consistent.
TEST_P(FractionalScrollSimTest, StickyDoesntOscillate) {}

class ScrollAnimatorSimTest : public SimTest, public PaintTestConfigurations {};

INSTANTIATE_PAINT_TEST_SUITE_P();

// Test that the callback of user scroll will be executed when the animation
// finishes at ScrollAnimator::TickAnimation for root frame user scroll at the
// layout viewport.
TEST_P(ScrollAnimatorSimTest, TestRootFrameLayoutViewportUserScrollCallBack) {}

// Test that the callback of user scroll will be executed when the animation
// finishes at ScrollAnimator::TickAnimation for root frame user scroll at the
// visual viewport.
TEST_P(ScrollAnimatorSimTest, TestRootFrameVisualViewporUserScrollCallBack) {}

// Test that the callback of user scroll will be executed when the animation
// finishes at ScrollAnimator::TickAnimation for root frame user scroll at both
// the layout and visual viewport.
TEST_P(ScrollAnimatorSimTest, TestRootFrameBothViewportsUserScrollCallBack) {}

// Test that the callback of user scroll will be executed when the animation
// finishes at ScrollAnimator::TickAnimation for div user scroll.
TEST_P(ScrollAnimatorSimTest, TestDivUserScrollCallBack) {}

// Test that the callback of user scroll will be executed in
// ScrollAnimatorBase::UserScroll when animation is disabled.
TEST_P(ScrollAnimatorSimTest, TestUserScrollCallBackAnimatorDisabled) {}

// Test that the callback of user scroll will be executed when the animation is
// canceled because performing a programmatic scroll in the middle of a user
// scroll will cancel the animation.
TEST_P(ScrollAnimatorSimTest, TestRootFrameUserScrollCallBackCancelAnimation) {}

class ScrollInfacesUseCounterSimTest : public SimTest,
                                       public PaintTestConfigurations {};

INSTANTIATE_PAINT_TEST_SUITE_P();

struct TestCase {};

TEST_P(ScrollInfacesUseCounterSimTest, ScrollTestAll) {}

class ScrollPositionsInNonDefaultWritingModeSimTest
    : public SimTest,
      public PaintTestConfigurations {};

INSTANTIATE_PAINT_TEST_SUITE_P();

// Verify that scrollIntoView() does not trigger the use counter
// kElementWithLeftwardOrUpwardOverflowDirection_ScrollLeftOrTopSetPositive
// and can be used to feature detect the convention of scroll coordinates.
TEST_P(ScrollPositionsInNonDefaultWritingModeSimTest,
       ScrollIntoViewAndCounters) {}

}  // namespace blink