#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "base/memory/raw_ptr.h"
#include "cc/trees/layer_tree_host.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/weak_ptr.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "cc/animation/animation_host.h"
#include "cc/base/completion_event.h"
#include "cc/base/features.h"
#include "cc/input/browser_controls_offset_manager.h"
#include "cc/input/main_thread_scrolling_reason.h"
#include "cc/input/scroll_elasticity_helper.h"
#include "cc/layers/layer.h"
#include "cc/layers/layer_impl.h"
#include "cc/layers/picture_layer.h"
#include "cc/test/fake_content_layer_client.h"
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/fake_picture_layer.h"
#include "cc/test/fake_picture_layer_impl.h"
#include "cc/test/layer_tree_test.h"
#include "cc/test/test_task_graph_runner.h"
#include "cc/test/test_ukm_recorder_factory.h"
#include "cc/trees/clip_node.h"
#include "cc/trees/effect_node.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/proxy_impl.h"
#include "cc/trees/scroll_node.h"
#include "cc/trees/single_thread_proxy.h"
#include "cc/trees/transform_node.h"
#include "components/viz/common/frame_sinks/begin_frame_source.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/events/types/scroll_input_type.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/geometry/test/geometry_util.h"
#include "ui/gfx/geometry/vector2d_conversions.h"
Mock;
ScrollThread;
namespace cc {
namespace {
std::unique_ptr<ScrollState> BeginState(const gfx::Point& point,
const gfx::Vector2dF& delta_hint) { … }
ScrollState UpdateState(const gfx::Point& point, const gfx::Vector2dF& delta) { … }
class LayerTreeHostScrollTest : public LayerTreeTest, public ScrollCallbacks { … };
class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollSimple);
class LayerTreeHostScrollTestScrollMultipleRedraw
: public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollMultipleRedraw);
class LayerTreeHostScrollTestScrollAbortedCommit
: public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommit);
class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(LayerTreeHostScrollTestFractionalScroll);
class LayerTreeHostScrollTestScrollSnapping : public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollSnapping);
class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { … };
#if defined(ADDRESS_SANITIZER) || defined(IS_LINUX)
#define MAYBE_DeviceScaleFactor1_ScrollChild …
#else
#define MAYBE_DeviceScaleFactor1_ScrollChild …
#endif
TEST_F(LayerTreeHostScrollTestCaseWithChild,
MAYBE_DeviceScaleFactor1_ScrollChild) { … }
#if defined(ADDRESS_SANITIZER) || defined(IS_LINUX)
#define MAYBE_DeviceScaleFactor15_ScrollChild …
#else
#define MAYBE_DeviceScaleFactor15_ScrollChild …
#endif
TEST_F(LayerTreeHostScrollTestCaseWithChild,
MAYBE_DeviceScaleFactor15_ScrollChild) { … }
#if defined(ADDRESS_SANITIZER) || defined(IS_LINUX)
#define MAYBE_DeviceScaleFactor2_ScrollChild …
#else
#define MAYBE_DeviceScaleFactor2_ScrollChild …
#endif
TEST_F(LayerTreeHostScrollTestCaseWithChild,
MAYBE_DeviceScaleFactor2_ScrollChild) { … }
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
defined(ADDRESS_SANITIZER)
#define MAYBE_DeviceScaleFactor1_ScrollRootScrollLayer …
#else
#define MAYBE_DeviceScaleFactor1_ScrollRootScrollLayer …
#endif
TEST_F(LayerTreeHostScrollTestCaseWithChild,
MAYBE_DeviceScaleFactor1_ScrollRootScrollLayer) { … }
#if defined(ADDRESS_SANITIZER) || defined(IS_LINUX)
#define MAYBE_DeviceScaleFactor15_ScrollRootScrollLayer …
#else
#define MAYBE_DeviceScaleFactor15_ScrollRootScrollLayer …
#endif
TEST_F(LayerTreeHostScrollTestCaseWithChild,
MAYBE_DeviceScaleFactor15_ScrollRootScrollLayer) { … }
#if defined(ADDRESS_SANITIZER) || defined(IS_LINUX)
#define MAYBE_DeviceScaleFactor2_ScrollRootScrollLayer …
#else
#define MAYBE_DeviceScaleFactor2_ScrollRootScrollLayer …
#endif
TEST_F(LayerTreeHostScrollTestCaseWithChild,
MAYBE_DeviceScaleFactor2_ScrollRootScrollLayer) { … }
class LayerTreeHostScrollTestSimple : public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(LayerTreeHostScrollTestSimple);
class LayerTreeHostScrollTestImplOnlyScroll : public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(LayerTreeHostScrollTestImplOnlyScroll);
#if !BUILDFLAG(IS_MAC)
class SmoothScrollAnimationEndNotification : public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(SmoothScrollAnimationEndNotification);
#endif
void DoGestureScroll(LayerTreeHostImpl* host_impl,
const scoped_refptr<Layer>& scroller,
gfx::Vector2dF offset,
ElementId scroller_element_id) { … }
class LayerTreeHostScrollTestImplOnlyScrollSnap
: public LayerTreeHostScrollTest { … };
#if !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_CHROMEOS) && \
!BUILDFLAG(IS_LINUX) && \
!((BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)) && defined(ADDRESS_SANITIZER))
MULTI_THREAD_TEST_F(LayerTreeHostScrollTestImplOnlyScrollSnap);
#endif
class LayerTreeHostScrollTestImplOnlyMultipleScrollSnap
: public LayerTreeHostScrollTest { … };
#if !BUILDFLAG(IS_CHROMEOS)
MULTI_THREAD_TEST_F(LayerTreeHostScrollTestImplOnlyMultipleScrollSnap);
#endif
class LayerTreeHostScrollTestScrollZeroMaxScrollOffset
: public LayerTreeHostScrollTest { … };
SINGLE_AND_MULTI_THREAD_TEST_F(
LayerTreeHostScrollTestScrollZeroMaxScrollOffset);
class LayerTreeHostScrollTestScrollNonDrawnLayer
: public LayerTreeHostScrollTest { … };
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollNonDrawnLayer);
class LayerTreeHostScrollTestImplScrollUnderMainThreadScrollingParent
: public LayerTreeHostScrollTest { … };
#if BUILDFLAG(IS_CHROMEOS)
MULTI_THREAD_TEST_F(
LayerTreeHostScrollTestImplScrollUnderMainThreadScrollingParent);
#else
SINGLE_AND_MULTI_THREAD_TEST_F(
LayerTreeHostScrollTestImplScrollUnderMainThreadScrollingParent);
#endif
class ThreadCheckingInputHandlerClient : public InputHandlerClient { … };
class LayerTreeHostScrollTestLayerStructureChange
: public LayerTreeHostScrollTest { … };
TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyLayer) { … }
TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { … }
class LayerTreeHostScrollTestScrollMFBA : public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollMFBA);
class LayerTreeHostScrollTestScrollAbortedCommitMFBA
: public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommitMFBA);
class MockInputHandlerClient : public InputHandlerClient { … };
class LayerTreeHostScrollTestElasticOverscroll
: public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(LayerTreeHostScrollTestElasticOverscroll);
class LayerTreeHostScrollTestPropertyTreeUpdate
: public LayerTreeHostScrollTest { … };
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostScrollTestPropertyTreeUpdate);
class LayerTreeHostScrollTestImplSideInvalidation
: public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(LayerTreeHostScrollTestImplSideInvalidation);
class LayerTreeHostRasterPriorityTest : public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(LayerTreeHostRasterPriorityTest);
class NonScrollingMainThreadScrollHitTestRegion
: public LayerTreeHostScrollTest { … };
SINGLE_THREAD_TEST_F(NonScrollingMainThreadScrollHitTestRegion);
class UnifiedScrollingRepaintOnScroll : public LayerTreeTest { … };
MULTI_THREAD_TEST_F(UnifiedScrollingRepaintOnScroll);
class LayerTreeHostScrollTestViewportAbortedCommit
: public LayerTreeHostScrollTest { … };
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostScrollTestViewportAbortedCommit);
class PreventRecreatingTilingDuringScroll : public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(PreventRecreatingTilingDuringScroll);
class CommitWithoutSynchronizingScrollOffsets : public LayerTreeHostScrollTest { … };
MULTI_THREAD_TEST_F(CommitWithoutSynchronizingScrollOffsets);
}
}