#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "cc/trees/layer_tree_host_impl.h"
#include <stddef.h>
#include <cmath>
#include <memory>
#include <optional>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/memory_pressure_listener.h"
#include "base/memory/ptr_util.h"
#include "base/numerics/angle_conversions.h"
#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/gtest_util.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "cc/animation/animation.h"
#include "cc/animation/animation_host.h"
#include "cc/animation/animation_id_provider.h"
#include "cc/base/features.h"
#include "cc/base/histograms.h"
#include "cc/input/browser_controls_offset_manager.h"
#include "cc/input/input_handler.h"
#include "cc/input/main_thread_scrolling_reason.h"
#include "cc/input/page_scale_animation.h"
#include "cc/input/scroll_utils.h"
#include "cc/input/scrollbar_controller.h"
#include "cc/layers/append_quads_data.h"
#include "cc/layers/layer_impl.h"
#include "cc/layers/nine_patch_thumb_scrollbar_layer_impl.h"
#include "cc/layers/painted_scrollbar_layer_impl.h"
#include "cc/layers/render_surface_impl.h"
#include "cc/layers/solid_color_layer_impl.h"
#include "cc/layers/solid_color_scrollbar_layer_impl.h"
#include "cc/layers/surface_layer_impl.h"
#include "cc/layers/video_layer_impl.h"
#include "cc/layers/viewport.h"
#include "cc/resources/ui_resource_bitmap.h"
#include "cc/resources/ui_resource_manager.h"
#include "cc/test/animation_test_common.h"
#include "cc/test/fake_frame_info.h"
#include "cc/test/fake_impl_task_runner_provider.h"
#include "cc/test/fake_layer_tree_frame_sink.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_picture_layer_impl.h"
#include "cc/test/fake_raster_source.h"
#include "cc/test/fake_recording_source.h"
#include "cc/test/fake_video_frame_provider.h"
#include "cc/test/layer_test_common.h"
#include "cc/test/layer_tree_test.h"
#include "cc/test/mock_latency_info_swap_promise_monitor.h"
#include "cc/test/skia_common.h"
#include "cc/test/test_layer_tree_frame_sink.h"
#include "cc/test/test_paint_worklet_layer_painter.h"
#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/clip_node.h"
#include "cc/trees/compositor_commit_data.h"
#include "cc/trees/draw_property_utils.h"
#include "cc/trees/effect_node.h"
#include "cc/trees/latency_info_swap_promise.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/mutator_host.h"
#include "cc/trees/render_frame_metadata.h"
#include "cc/trees/render_frame_metadata_observer.h"
#include "cc/trees/scroll_node.h"
#include "cc/trees/transform_node.h"
#include "cc/view_transition/view_transition_request.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h"
#include "components/viz/common/frame_sinks/copy_output_request.h"
#include "components/viz/common/frame_sinks/copy_output_result.h"
#include "components/viz/common/frame_timing_details.h"
#include "components/viz/common/quads/compositor_frame_metadata.h"
#include "components/viz/common/quads/compositor_render_pass_draw_quad.h"
#include "components/viz/common/quads/solid_color_draw_quad.h"
#include "components/viz/common/quads/texture_draw_quad.h"
#include "components/viz/common/quads/tile_draw_quad.h"
#include "components/viz/common/surfaces/frame_sink_id.h"
#include "components/viz/common/surfaces/region_capture_bounds.h"
#include "components/viz/service/display/skia_output_surface.h"
#include "components/viz/test/begin_frame_args_test.h"
#include "components/viz/test/fake_output_surface.h"
#include "components/viz/test/fake_skia_output_surface.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "media/base/media.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkMallocPixelRef.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/transform_operations.h"
#include "ui/gfx/geometry/vector2d_conversions.h"
#include "ui/latency/latency_info.h"
#define EXPECT_SCOPED(statements) …
VideoFrame;
_;
AnyNumber;
AtLeast;
Mock;
Range;
Return;
StrictMock;
ScrollThread;
namespace cc {
namespace {
constexpr gfx::Size kDefaultLayerSize(100, 100);
viz::SurfaceId MakeSurfaceId(const viz::FrameSinkId& frame_sink_id,
uint32_t parent_id) { … }
struct TestFrameData : public LayerTreeHostImpl::FrameData { … };
void ClearMainThreadDeltasForTesting(LayerTreeHostImpl* host) { … }
}
class LayerTreeHostImplTestBase : public testing::Test,
public LayerTreeHostImplClient { … };
CommitToPendingTreeLayerTreeHostImplTest;
class CommitToActiveTreeLayerTreeHostImplTest
: public LayerTreeHostImplTestBase { … };
class LayerTreeHostImplTest : public LayerTreeHostImplTestBase,
public testing::WithParamInterface<bool> { … };
INSTANTIATE_COMMIT_TO_TREE_TEST_P(…);
class OccludedSurfaceThrottlingLayerTreeHostImplTest
: public LayerTreeHostImplTest { … };
INSTANTIATE_COMMIT_TO_TREE_TEST_P(…);
class LayerTreeHostImplTimelinesTest : public LayerTreeHostImplTest { … };
INSTANTIATE_COMMIT_TO_TREE_TEST_P(…);
class FluentOverlayScrollbarLayerTreeHostImplTest
: public CommitToPendingTreeLayerTreeHostImplTest { … };
class FluentOverlayScrollbarOpacityLayerTreeHostImplTest
: public FluentOverlayScrollbarLayerTreeHostImplTest,
public testing::WithParamInterface<int> { … };
class TestInputHandlerClient : public InputHandlerClient { … };
TEST_P(LayerTreeHostImplTest, LocalAndExternalPinchState) { … }
TEST_P(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { … }
TEST_P(LayerTreeHostImplTest, ResourcelessDrawWithEmptyViewport) { … }
TEST_P(LayerTreeHostImplTest, ScrollDeltaNoLayers) { … }
TEST_P(LayerTreeHostImplTest, ScrollDeltaTreeButNoChanges) { … }
TEST_F(CommitToActiveTreeLayerTreeHostImplTest, ScrollDeltaRepeatedScrolls) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest, SyncedScrollAbortedCommit) { … }
TEST_P(LayerTreeHostImplTest, ScrollBeforeRootLayerAttached) { … }
TEST_P(LayerTreeHostImplTest, ScrollUpdateAndEndNoOpWithoutBegin) { … }
TEST_P(LayerTreeHostImplTest, TargetMainThreadScroller) { … }
TEST_P(LayerTreeHostImplTest, ScrollRootCallsCommitAndRedraw) { … }
TEST_P(LayerTreeHostImplTest, ActivelyScrollingOnlyAfterScrollMovement) { … }
TEST_P(LayerTreeHostImplTest, ScrollWithoutRootLayer) { … }
TEST_P(LayerTreeHostImplTest, ScrollWithoutRenderer) { … }
TEST_P(LayerTreeHostImplTest, ReplaceTreeWhileScrolling) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
ActivateTreeScrollingNodeDisappeared) { … }
TEST_P(LayerTreeHostImplTest, ScrollBlocksOnWheelEventHandlers) { … }
TEST_P(LayerTreeHostImplTest, ScrollBlocksOnTouchEventHandlers) { … }
TEST_P(LayerTreeHostImplTest, ShouldScrollOnMainThread) { … }
TEST_P(LayerTreeHostImplTest, ScrollWithOverlappingNonScrollableLayer) { … }
TEST_P(LayerTreeHostImplTest,
ScrollWithOverlappingTransparentNonScrollableLayer) { … }
TEST_P(LayerTreeHostImplTest, ScrolledOverlappingDrawnScrollbarLayer) { … }
gfx::PresentationFeedback ExampleFeedback() { … }
class LayerTreeHostImplTestInvokePresentationCallbacks
: public LayerTreeHostImplTest { … };
INSTANTIATE_COMMIT_TO_TREE_TEST_P(…);
TEST_P(LayerTreeHostImplTestInvokePresentationCallbacks,
PresentationFeedbackCallbacksFire) { … }
TEST_P(LayerTreeHostImplTest, MainThreadScrollHitTestRegionBasic) { … }
TEST_P(LayerTreeHostImplTest, MainThreadScrollHitTestRegionInNonScrollingRoot) { … }
TEST_P(LayerTreeHostImplTest, MainThreadScrollHitTestRegionWithOffset) { … }
TEST_P(LayerTreeHostImplTest,
LayerOverlapsMainThreadScrollHitTestRegionInLayer) { … }
TEST_P(LayerTreeHostImplTest,
LayerOverlapsMainThreadScrollHitTestRegionInNonScrollAncestorLayer) { … }
TEST_P(LayerTreeHostImplTest,
FixedLayerOverlapsMainThreadScrollHitTestRegionInLayer) { … }
TEST_P(LayerTreeHostImplTest, FixedLayerOverNonFixedLayer) { … }
TEST_P(LayerTreeHostImplTest, ScrollHandlerNotPresent) { … }
TEST_P(LayerTreeHostImplTest, ScrollHandlerPresent) { … }
TEST_P(LayerTreeHostImplTest, ScrollUpdateReturnsCorrectValue) { … }
TEST_P(LayerTreeHostImplTest, ScrollSnapOnX) { … }
TEST_P(LayerTreeHostImplTest, ScrollSnapOnY) { … }
TEST_P(LayerTreeHostImplTest, ScrollSnapOnBoth) { … }
TEST_P(LayerTreeHostImplTest, SnapAfterEmptyScroll) { … }
TEST_P(LayerTreeHostImplTest, ScrollSnapAfterAnimatedScroll) { … }
TEST_P(LayerTreeHostImplTest, SnapAnimationTargetUpdated) { … }
TEST_P(LayerTreeHostImplTest, SnapAnimationCancelledByScroll) { … }
TEST_P(LayerTreeHostImplTest,
SnapAnimationShouldNotStartWhenScrollEndsAtSnapTarget) { … }
TEST_P(LayerTreeHostImplTest,
GetSnapFlingInfoAndSetAnimatingSnapTargetWhenZoomed) { … }
TEST_P(LayerTreeHostImplTest, SnapFlingAnimationEndWithoutFinishing) { … }
TEST_P(LayerTreeHostImplTest, NativeFlingInSnapArea) { … }
TEST_P(LayerTreeHostImplTest, OverscrollBehaviorPreventsPropagation) { … }
TEST_P(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) { … }
TEST_P(LayerTreeHostImplTest, ScrollNodeWithoutScrollLayer) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
AnimationSchedulingPendingTree) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
AnimationSchedulingActiveTree) { … }
TEST_F(CommitToActiveTreeLayerTreeHostImplTest,
AnimationSchedulingCommitToActiveTree) { … }
TEST_P(LayerTreeHostImplTest, AnimationSchedulingOnLayerDestruction) { … }
class MissingTilesLayer : public LayerImpl { … };
TEST_P(LayerTreeHostImplTest, ImplPinchZoom) { … }
TEST_P(LayerTreeHostImplTest, ViewportScrollbarGeometry) { … }
TEST_P(LayerTreeHostImplTest, ViewportScrollOrder) { … }
TEST_P(LayerTreeHostImplTest, ScrollViewportWithFractionalAmounts) { … }
TEST_P(LayerTreeHostImplTest, ScrollDuringPinchGesture) { … }
TEST_P(LayerTreeHostImplTest, PinchZoomSnapsToScreenEdge) { … }
TEST_P(LayerTreeHostImplTest, ImplPinchZoomWheelBubbleBetweenViewports) { … }
TEST_P(LayerTreeHostImplTest, ScrollWithSwapPromises) { … }
TEST_P(LayerTreeHostImplTest, ScrollDoesntBubble) { … }
TEST_P(LayerTreeHostImplTest, PinchGesture) { … }
TEST_P(LayerTreeHostImplTest, SyncSubpixelScrollDelta) { … }
TEST_P(LayerTreeHostImplTest, SyncSubpixelScrollFromFractionalActiveBase) { … }
TEST_P(LayerTreeHostImplTest, PinchZoomTriggersPageScaleAnimation) { … }
TEST_P(LayerTreeHostImplTest, PageScaleAnimation) { … }
TEST_P(LayerTreeHostImplTest, PageScaleAnimationNoOp) { … }
TEST_P(LayerTreeHostImplTest, PageScaleAnimationTransferedOnSyncTreeActivate) { … }
TEST_P(LayerTreeHostImplTest, PageScaleAnimationCompletedNotification) { … }
TEST_P(LayerTreeHostImplTest, MaxScrollOffsetAffectedByViewportBoundsDelta) { … }
TEST_P(LayerTreeHostImplTest, AnimatedGranularityCausesSmoothScroll) { … }
TEST_P(LayerTreeHostImplTest, NonAnimatedGranularityCausesInstantScroll) { … }
class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl { … };
class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { … };
INSTANTIATE_COMMIT_TO_TREE_TEST_P(…);
TEST_P(LayerTreeHostImplTestScrollbarAnimation, Android) { … }
TEST_P(LayerTreeHostImplTestScrollbarAnimation, AuraOverlay) { … }
TEST_P(LayerTreeHostImplTestScrollbarAnimation, NoAnimator) { … }
class LayerTreeHostImplTestScrollbarOpacity
: public CommitToPendingTreeLayerTreeHostImplTest { … };
TEST_F(LayerTreeHostImplTestScrollbarOpacity, Android) { … }
TEST_F(LayerTreeHostImplTestScrollbarOpacity, AuraOverlay) { … }
TEST_F(LayerTreeHostImplTestScrollbarOpacity, NoAnimator) { … }
class LayerTreeHostImplTestMultiScrollable : public LayerTreeHostImplTest { … };
INSTANTIATE_COMMIT_TO_TREE_TEST_P(…);
TEST_P(LayerTreeHostImplTestMultiScrollable,
ScrollbarFlashAfterAnyScrollUpdate) { … }
TEST_P(LayerTreeHostImplTest, ScrollHitTestOnScrollbar) { … }
TEST_P(LayerTreeHostImplTest, NullScrollerLayerForScrollbarLayer) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
ScrollbarVisibilityChangeCausesRedrawAndCommit) { … }
TEST_P(LayerTreeHostImplTest, ScrollbarInnerLargerThanOuter) { … }
TEST_P(LayerTreeHostImplTest, ScrollbarRegistration) { … }
TEST_P(LayerTreeHostImplTest, ScrollBeforeMouseMove) { … }
void LayerTreeHostImplTestBase::SetupMouseMoveAtWithDeviceScale(
float device_scale_factor) { … }
TEST_P(LayerTreeHostImplTest, MouseMoveAtWithDeviceScaleOf1) { … }
TEST_P(LayerTreeHostImplTest, MouseMoveAtWithDeviceScaleOf2) { … }
TEST_P(LayerTreeHostImplTest, ActivationDependenciesInMetadata) { … }
TEST_P(LayerTreeHostImplTest, SurfaceReferencesChangeCausesDamage) { … }
TEST_P(LayerTreeHostImplTest, CompositorFrameMetadata) { … }
class DidDrawCheckLayer : public LayerImpl { … };
TEST_P(LayerTreeHostImplTest, DamageShouldNotCareAboutContributingLayers) { … }
TEST_P(LayerTreeHostImplTest, WillDrawReturningFalseDoesNotCall) { … }
TEST_P(LayerTreeHostImplTest, DidDrawNotCalledOnHiddenLayer) { … }
TEST_P(LayerTreeHostImplTest, WillDrawNotCalledOnOccludedLayer) { … }
TEST_P(LayerTreeHostImplTest, DidDrawCalledOnAllLayers) { … }
class MissingTextureAnimatingLayer : public DidDrawCheckLayer { … };
struct PrepareToDrawSuccessTestCase { … };
class LayerTreeHostImplPrepareToDrawTest : public LayerTreeHostImplTest { … };
INSTANTIATE_COMMIT_TO_TREE_TEST_P(…);
TEST_P(LayerTreeHostImplPrepareToDrawTest, PrepareToDrawSucceedsAndFails) { … }
TEST_P(LayerTreeHostImplPrepareToDrawTest,
PrepareToDrawWhenDrawAndSwapFullViewportEveryFrame) { … }
TEST_P(LayerTreeHostImplTest, ScrollRootIgnored) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest, ClampingAfterActivation) { … }
class LayerTreeHostImplBrowserControlsTest : public LayerTreeHostImplTest { … };
INSTANTIATE_COMMIT_TO_TREE_TEST_P(…);
#define EXPECT_VIEWPORT_GEOMETRIES(expected_browser_controls_shown_ratio) …
TEST_P(LayerTreeHostImplBrowserControlsTest,
HidingBrowserControlsExpandsScrollableSize) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
HidingBrowserControlsExpandsClipAncestorsOfReplacedOuterScroller) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
HidingBrowserControlsAdjustsSnapFling) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
MovingBrowserControlsOuterClipDeltaScaled) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
HidingBrowserControlsAdjustsScrollbarPosition) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
ScrollBrowserControlsByFractionalAmount) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
BrowserControlsOuterViewportBecomesScrollable) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest, FixedContainerDelta) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest, BrowserControlsPushUnsentRatio) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
BrowserControlsScrollableSublayer) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
PositionBrowserControlsToActiveTreeExplicitly) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
PositionBrowserControlsToPendingTreeExplicitly) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest, ApplyDeltaOnTreeActivation) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
BrowserControlsLayoutHeightChanged) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
BrowserControlsViewportOffsetClamping) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest, BrowserControlsAspectRatio) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest, NoShrinkNotUserScrollable) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
BrowserControlsScrollOuterViewport) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
ScrollNonScrollableRootWithBrowserControls) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
ViewportBoundsDeltaOnTreeActivation) { … }
TEST_P(LayerTreeHostImplTest, ScrollNonCompositedRoot) { … }
TEST_P(LayerTreeHostImplTest, ScrollChildCallsCommitAndRedraw) { … }
TEST_P(LayerTreeHostImplTest, ScrollMissesChild) { … }
TEST_P(LayerTreeHostImplTest, ScrollMissesBackfacingChild) { … }
TEST_P(LayerTreeHostImplTest, ScrollLayerWithMainThreadReason) { … }
TEST_P(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnMainThread) { … }
TEST_P(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnImplThread) { … }
TEST_P(LayerTreeHostImplTest, PageScaleDeltaAppliedToRootScrollLayerOnly) { … }
TEST_P(LayerTreeHostImplTest, ScrollChildAndChangePageScaleOnMainThread) { … }
TEST_P(LayerTreeHostImplTest, ScrollChildBeyondLimit) { … }
TEST_P(LayerTreeHostImplTimelinesTest, ScrollAnimatedLatchToChild) { … }
TEST_F(CommitToActiveTreeLayerTreeHostImplTest, ScrollWithoutBubbling) { … }
TEST_P(LayerTreeHostImplTest, ChildrenOfInnerScrollNodeCanScrollOnThread) { … }
TEST_P(LayerTreeHostImplTest, ScrollEventBubbling) { … }
TEST_P(LayerTreeHostImplTest, ScrollBeforeRedraw) { … }
TEST_F(CommitToActiveTreeLayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) { … }
TEST_F(CommitToActiveTreeLayerTreeHostImplTest,
ScrollNonAxisAlignedRotatedLayer) { … }
TEST_F(CommitToActiveTreeLayerTreeHostImplTest,
ScrollPerspectiveTransformedLayer) { … }
TEST_F(CommitToActiveTreeLayerTreeHostImplTest, ScrollScaledLayer) { … }
TEST_P(LayerTreeHostImplTest, ScrollViewportRounding) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
RootLayerScrollOffsetDelegation) { … }
void CheckLayerScrollOffset(LayerImpl* layer, gfx::Point scroll_offset) { … }
TEST_P(LayerTreeHostImplTest,
ExternalRootLayerScrollOffsetDelegationReflectedInNextDraw) { … }
TEST_P(LayerTreeHostImplTest, ViewportUserScrollable) { … }
TEST_P(LayerTreeHostImplTest, SetRootScrollOffsetUserScrollable) { … }
TEST_P(LayerTreeHostImplTest, SetRootScrollOffsetNoViewportCrash) { … }
TEST_P(LayerTreeHostImplTest, OverscrollRoot) { … }
TEST_P(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) { … }
TEST_P(LayerTreeHostImplTest, OverscrollChildEventBubbling) { … }
TEST_P(LayerTreeHostImplTest, OverscrollAlways) { … }
TEST_P(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) { … }
TEST_P(LayerTreeHostImplTest, NoOverscrollOnNonViewportLayers) { … }
TEST_P(LayerTreeHostImplTest, ScrollFromOuterViewportSibling) { … }
TEST_P(LayerTreeHostImplTest, ScrollChainingWithReplacedOuterViewport) { … }
TEST_P(LayerTreeHostImplTest, RootScrollerScrollNonDescendant) { … }
TEST_P(LayerTreeHostImplTest, OverscrollOnImplThread) { … }
class BlendStateCheckLayer : public LayerImpl { … };
TEST_P(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { … }
static bool MayContainVideoBitSetOnFrameData(LayerTreeHostImpl* host_impl) { … }
TEST_P(LayerTreeHostImplTest, MayContainVideo) { … }
TEST_P(LayerTreeHostImplTest, MayThrottleIfUnusedFrames) { … }
class LayerTreeHostImplViewportCoveredTest
: public CommitToPendingTreeLayerTreeHostImplTest { … };
TEST_F(LayerTreeHostImplViewportCoveredTest, ViewportCovered) { … }
TEST_F(LayerTreeHostImplViewportCoveredTest, ViewportCoveredScaled) { … }
TEST_F(LayerTreeHostImplViewportCoveredTest, ActiveTreeGrowViewportInvalid) { … }
TEST_F(LayerTreeHostImplViewportCoveredTest, ActiveTreeShrinkViewportInvalid) { … }
class FakeDrawableLayerImpl : public LayerImpl { … };
TEST_P(LayerTreeHostImplTest, PartialSwapReceivesDamageRect) { … }
TEST_P(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) { … }
class FakeLayerWithQuads : public LayerImpl { … };
TEST_P(LayerTreeHostImplTest, LayersFreeTextures) { … }
TEST_P(LayerTreeHostImplTest, HasTransparentBackground) { … }
class LayerTreeHostImplTestDrawAndTestDamage : public LayerTreeHostImplTest { … };
INSTANTIATE_COMMIT_TO_TREE_TEST_P(…);
TEST_P(LayerTreeHostImplTestDrawAndTestDamage, FrameIncludesDamageRect) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest, FarAwayQuadsDontNeedAA) { … }
class CompositorFrameMetadataTest : public LayerTreeHostImplTest { … };
INSTANTIATE_COMMIT_TO_TREE_TEST_P(…);
TEST_P(CompositorFrameMetadataTest, CompositorFrameAckCountsAsSwapComplete) { … }
class CountingSoftwareDevice : public viz::SoftwareOutputDevice { … };
TEST_P(LayerTreeHostImplTest,
ForcedDrawToSoftwareDeviceSkipsUnsupportedLayers) { … }
TEST_P(LayerTreeHostImplTest, MemoryLimits) { … }
namespace {
void ExpectFullDamageAndDraw(LayerTreeHostImpl* host_impl) { … }
}
TEST_P(LayerTreeHostImplTestDrawAndTestDamage,
RequireHighResAndRedrawWhenVisible) { … }
class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { … };
INSTANTIATE_COMMIT_TO_TREE_TEST_P(…);
TEST_P(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) { … }
TEST_P(LayerTreeHostImplTest, UIResourceManagement) { … }
TEST_P(LayerTreeHostImplTest, CreateETC1UIResource) { … }
TEST_P(LayerTreeHostImplTest, ScrollHitTestIsNotReliable) { … }
TEST_P(LayerTreeHostImplTest, ScrollHitTestAncestorMismatch) { … }
TEST_P(LayerTreeHostImplTest, ScrollInvisibleScroller) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
LatencyInfoPassedToCompositorFrameMetadata) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
CompositorFrameMetadataFrameIntervalInputs) { … }
#if BUILDFLAG(IS_ANDROID)
TEST_P(LayerTreeHostImplTest, SelectionBoundsPassedToCompositorFrameMetadata) {
LayerImpl* root = SetupRootLayer<SolidColorLayerImpl>(
host_impl_->active_tree(), gfx::Size(10, 10));
UpdateDrawProperties(host_impl_->active_tree());
gfx::Point selection_start(5, 0);
gfx::Point selection_end(5, 5);
LayerSelection selection;
selection.start.type = gfx::SelectionBound::CENTER;
selection.start.layer_id = root->id();
selection.start.edge_end = selection_end;
selection.start.edge_start = selection_start;
selection.end = selection.start;
host_impl_->active_tree()->RegisterSelection(selection);
host_impl_->SetNeedsRedraw();
RenderFrameMetadata metadata = StartDrawAndProduceRenderFrameMetadata();
const viz::Selection<gfx::SelectionBound>& selection_after =
metadata.selection;
EXPECT_EQ(selection.start.type, selection_after.start.type());
EXPECT_EQ(selection.end.type, selection_after.end.type());
EXPECT_EQ(gfx::PointF(selection_end), selection_after.start.edge_end());
EXPECT_EQ(gfx::PointF(selection_start), selection_after.start.edge_start());
EXPECT_TRUE(selection_after.start.visible());
EXPECT_TRUE(selection_after.end.visible());
}
TEST_P(LayerTreeHostImplTest, HiddenSelectionBoundsStayHidden) {
LayerImpl* root = SetupDefaultRootLayer(gfx::Size(10, 10));
UpdateDrawProperties(host_impl_->active_tree());
gfx::Point selection_start(5, 0);
gfx::Point selection_end(5, 5);
LayerSelection selection;
selection.start.hidden = true;
selection.start.type = gfx::SelectionBound::CENTER;
selection.start.layer_id = root->id();
selection.start.edge_end = selection_end;
selection.start.edge_start = selection_start;
selection.end = selection.start;
host_impl_->active_tree()->RegisterSelection(selection);
host_impl_->SetNeedsRedraw();
RenderFrameMetadata metadata = StartDrawAndProduceRenderFrameMetadata();
const viz::Selection<gfx::SelectionBound>& selection_after =
metadata.selection;
EXPECT_EQ(selection.start.type, selection_after.start.type());
EXPECT_EQ(selection.end.type, selection_after.end.type());
EXPECT_EQ(gfx::PointF(selection_end), selection_after.start.edge_end());
EXPECT_EQ(gfx::PointF(selection_start), selection_after.start.edge_start());
EXPECT_FALSE(selection_after.start.visible());
EXPECT_FALSE(selection_after.end.visible());
}
#endif
TEST_P(LayerTreeHostImplTest, SimpleSwapPromiseMonitor) { … }
class LayerTreeHostImplWithBrowserControlsTest : public LayerTreeHostImplTest { … };
INSTANTIATE_COMMIT_TO_TREE_TEST_P(…);
const int LayerTreeHostImplWithBrowserControlsTest::top_controls_height_ = …;
TEST_P(LayerTreeHostImplWithBrowserControlsTest, NoIdleAnimations) { … }
TEST_P(LayerTreeHostImplWithBrowserControlsTest,
BrowserControlsHeightIsCommitted) { … }
TEST_P(LayerTreeHostImplWithBrowserControlsTest,
BrowserControlsStayFullyVisibleOnHeightChange) { … }
TEST_P(LayerTreeHostImplWithBrowserControlsTest,
BrowserControlsAnimationScheduling) { … }
TEST_P(LayerTreeHostImplWithBrowserControlsTest,
ScrollHandledByBrowserControls) { … }
TEST_P(LayerTreeHostImplWithBrowserControlsTest,
WheelUnhandledByBrowserControls) { … }
TEST_P(LayerTreeHostImplWithBrowserControlsTest,
BrowserControlsAnimationAtOrigin) { … }
TEST_P(LayerTreeHostImplWithBrowserControlsTest,
BrowserControlsAnimationAfterScroll) { … }
TEST_P(LayerTreeHostImplWithBrowserControlsTest,
BrowserControlsScrollDeltaInOverScroll) { … }
TEST_P(LayerTreeHostImplWithBrowserControlsTest,
AnimationDoesntScrollUnscrolledViewport) { … }
TEST_P(LayerTreeHostImplWithBrowserControlsTest,
AnimationScrollsScrolledViewport) { … }
TEST_P(LayerTreeHostImplWithBrowserControlsTest,
AnimationScrollsViewportWhenOnlyExpandTopControlsAtPageTopIsSet) { … }
TEST_P(LayerTreeHostImplBrowserControlsTest,
ReplacedOuterViewportScrollsBrowserControls) { … }
TEST_P(LayerTreeHostImplTest, RootScrollBothInnerAndOuterLayer) { … }
TEST_P(LayerTreeHostImplTest, DiagonalScrollBubblesPerfectlyToInner) { … }
TEST_P(LayerTreeHostImplTest,
ScrollBeginEventThatTargetsViewportLayerSkipsHitTest) { … }
TEST_P(LayerTreeHostImplTest, NoOverscrollWhenInnerViewportCantScroll) { … }
class LayerTreeHostImplWithImplicitLimitsTest : public LayerTreeHostImplTest { … };
INSTANTIATE_COMMIT_TO_TREE_TEST_P(…);
TEST_P(LayerTreeHostImplWithImplicitLimitsTest, ImplicitMemoryLimits) { … }
TEST_P(LayerTreeHostImplTest, ExternalTransformReflectedInNextDraw) { … }
TEST_P(LayerTreeHostImplTest, ExternalTransformSetNeedsRedraw) { … }
TEST_P(LayerTreeHostImplTest, OnMemoryPressure) { … }
TEST_P(LayerTreeHostImplTest, OnDrawConstraintSetNeedsRedraw) { … }
TEST_P(LayerTreeHostImplTest, FullViewportDamageAfterOnDraw) { … }
class ResourcelessSoftwareLayerTreeHostImplTest
: public CommitToPendingTreeLayerTreeHostImplTest { … };
TEST_F(ResourcelessSoftwareLayerTreeHostImplTest,
ResourcelessSoftwareSetNeedsRedraw) { … }
TEST_F(ResourcelessSoftwareLayerTreeHostImplTest,
ResourcelessSoftwareDrawSkipsUpdateTiles) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
ExternalTileConstraintReflectedInPendingTree) { … }
TEST_P(LayerTreeHostImplTest, ExternalViewportAffectsVisibleRects) { … }
TEST_P(LayerTreeHostImplTest, ExternalTransformAffectsVisibleRects) { … }
TEST_P(LayerTreeHostImplTest, ExternalTransformAffectsSublayerScaleFactor) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest, OneScrollForFirstScrollDelay) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
OtherInputsForFirstScrollDelay) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
MultipleScrollsForFirstScrollDelay) { … }
TEST_P(LayerTreeHostImplTest, ScrollAnimated) { … }
TEST_P(LayerTreeHostImplTest, ScrollAnimatedLatching) { … }
TEST_P(LayerTreeHostImplTest, ScrollAnimatedWhileZoomed) { … }
TEST_P(LayerTreeHostImplTest, ScrollAnimatedUpdateInnerViewport) { … }
TEST_P(FluentOverlayScrollbarOpacityLayerTreeHostImplTest,
PaintedOverlayScrollbarTrackOpacityTest) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(FluentOverlayScrollbarLayerTreeHostImplTest,
FluentScrollbarFlashAfterScrollUpdate) { … }
TEST_F(FluentOverlayScrollbarLayerTreeHostImplTest,
PaintedOverlayLayerOnLoadOpacityTest) { … }
TEST_F(FluentOverlayScrollbarLayerTreeHostImplTest,
DoesntGetHitTestedWhenInvisible) { … }
TEST_P(LayerTreeHostImplTest, FadedOutPaintedOverlayScrollbarHitTest) { … }
TEST_P(LayerTreeHostImplTest, ScrollOnLargeThumb) { … }
TEST_P(LayerTreeHostImplTest, AutoscrollOnDeletedScrollbar) { … }
TEST_P(LayerTreeHostImplTest, PointerMoveOutOfSequence) { … }
TEST_P(LayerTreeHostImplTest, FadedOutPaintedScrollbarHitTest) { … }
TEST_P(LayerTreeHostImplTest, SingleGSUForScrollbarThumbDragPerFrame) { … }
TEST_P(LayerTreeHostImplTest,
ClearTrackingManagerOnLayerTreeFrameSinkLoseContext) { … }
TEST_P(LayerTreeHostImplTest, FrameCounterReset) { … }
TEST_P(LayerTreeHostImplTest, FrameCounterNotReset) { … }
TEST_P(LayerTreeHostImplTest, AutoscrollTaskAbort) { … }
TEST_P(LayerTreeHostImplTest, JumpOnScrollbarClick) { … }
TEST_P(LayerTreeHostImplTest, ThumbDragAfterJumpClick) { … }
TEST_P(LayerTreeHostImplTest, AbortAnimatedScrollBeforeStartingAutoscroll) { … }
TEST_P(LayerTreeHostImplTest, AnimatedScrollYielding) { … }
TEST_P(LayerTreeHostImplTest, ThumbDragScrollerLengthIncrease) { … }
TEST_P(LayerTreeHostImplTest, MainThreadFallback) { … }
TEST_P(LayerTreeHostImplTest, SecondScrollAnimatedBeginNotIgnored) { … }
TEST_P(LayerTreeHostImplTest, AnimatedScrollUpdateTargetBeforeStarting) { … }
TEST_P(LayerTreeHostImplTest, ScrollAnimatedWithDelay) { … }
TEST_P(LayerTreeHostImplTimelinesTest, ScrollAnimatedAborted) { … }
TEST_P(LayerTreeHostImplTimelinesTest, ScrollAnimated) { … }
TEST_P(LayerTreeHostImplTimelinesTest, ImplPinchZoomScrollAnimated) { … }
TEST_P(LayerTreeHostImplTimelinesTest, ImplPinchZoomScrollAnimatedUpdate) { … }
TEST_P(LayerTreeHostImplTimelinesTest, ScrollAnimatedNotUserScrollable) { … }
TEST_P(LayerTreeHostImplTimelinesTest, ScrollAnimatedChangingBounds) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
InvalidLayerNotAddedToRasterQueue) { … }
TEST_F(CommitToPendingTreeLayerTreeHostImplTest, DidBecomeActive) { … }
TEST_P(LayerTreeHostImplTest, WheelScrollWithPageScaleFactorOnInnerLayer) { … }
class LayerTreeHostImplCountingLostSurfaces : public LayerTreeHostImplTest { … };
INSTANTIATE_COMMIT_TO_TREE_TEST_P(…);
TEST_P(LayerTreeHostImplCountingLostSurfaces, TwiceLostSurface) { … }
size_t CountRenderPassesWithId(const viz::CompositorRenderPassList& list,
viz::CompositorRenderPassId id) { … }
TEST_P(LayerTreeHostImplTest, RemoveUnreferencedRenderPass) { … }
TEST_P(LayerTreeHostImplTest, RemoveEmptyRenderPass) { … }TEST_P(LayerTreeHostImplTest, DoNotRemoveEmptyRootRenderPass) { … }class FakeVideoFrameController : public VideoFrameController { … }TEST_P(LayerTreeHostImplTest, AddVideoFrameControllerInsideFrame) { … }TEST_P(LayerTreeHostImplTest, AddVideoFrameControllerOutsideFrame) { … }class GpuRasterizationDisabledLayerTreeHostImplTest
: public LayerTreeHostImplTest { … }class MsaaIsSlowLayerTreeHostImplTest
: public CommitToActiveTreeLayerTreeHostImplTest { … }TEST_F(MsaaIsSlowLayerTreeHostImplTest, GpuRasterizationStatusMsaaIsSlow) { … }TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
UpdatePageScaleFactorOnActiveTree) { … }TEST_P(LayerTreeHostImplTest, SubLayerScaleForNodeInSubtreeOfPageScaleLayer) { … }TEST_P(LayerTreeHostImplTest, RecomputeGpuRasterOnLayerTreeFrameSinkChange) { … }void LayerTreeHostImplTestBase::SetupMouseMoveAtTestScrollbarStates(
bool main_thread_scrolling) { … }TEST_P(LayerTreeHostImplTest,
LayerTreeHostImplTestScrollbarStatesInMainThreadScrolling) { … }TEST_P(LayerTreeHostImplTest,
LayerTreeHostImplTestScrollbarStatesInNotMainThreadScrolling) { … }TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
CheckerImagingTileInvalidation) { … }TEST_P(LayerTreeHostImplTest, RasterColorSpace) { … }TEST_P(LayerTreeHostImplTest, RasterColorSpaceSoftware) { … }TEST_P(LayerTreeHostImplTest, RasterColorPrefersSRGB) { … }TEST_P(LayerTreeHostImplTest, RasterColorSpaceHDR) { … }TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
UpdatedTilingsForNonDrawingLayers) { … }TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
RasterTilePrioritizationForNonDrawingLayers) { … }TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
DrawAfterDroppingTileResources) { … }TEST_P(LayerTreeHostImplTest, AllowedTouchActionTest1) { … }TEST_P(LayerTreeHostImplTest, AllowedTouchActionTest2) { … }TEST_P(LayerTreeHostImplTest, AllowedTouchActionTest3) { … }TEST_P(LayerTreeHostImplTest, AllowedTouchActionTest4) { … }class TestRenderFrameMetadataObserver : public RenderFrameMetadataObserver { … }TEST_P(LayerTreeHostImplTest, RenderFrameMetadata) { … }TEST_P(LayerTreeHostImplTest, SelectionBoundsPassedToRenderFrameMetadata) { … }TEST_P(LayerTreeHostImplTest,
VerticalScrollDirectionChangesPassedToRenderFrameMetadata) { … }TEST_P(LayerTreeHostImplTest, ScrollUpdateDoesNotSetScrollingNode) { … }class HitTestRegionListGeneratingLayerTreeHostImplTest
: public LayerTreeHostImplTest { … }INSTANTIATE_COMMIT_TO_TREE_TEST_P(…)TEST_P(HitTestRegionListGeneratingLayerTreeHostImplTest, BuildHitTestData) { … }TEST_P(HitTestRegionListGeneratingLayerTreeHostImplTest, PointerEvents) { … }TEST_P(HitTestRegionListGeneratingLayerTreeHostImplTest, ComplexPage) { … }TEST_P(HitTestRegionListGeneratingLayerTreeHostImplTest, InvalidFrameSinkId) { … }TEST_P(LayerTreeHostImplTest, ImplThreadPhaseUponImplSideInvalidation) { … }TEST_P(LayerTreeHostImplTest, SkipOnDrawDoesNotUpdateDrawParams) { … }TEST_P(LayerTreeHostImplTest, TouchScrollOnAndroidScrollbar) { … }TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
CommitWithNoPaintWorkletLayerPainter) { … }TEST_F(CommitToPendingTreeLayerTreeHostImplTest, CommitWithNoPaintWorklets) { … }TEST_F(CommitToPendingTreeLayerTreeHostImplTest, CommitWithDirtyPaintWorklets) { … }TEST_F(CommitToPendingTreeLayerTreeHostImplTest,
CommitWithNoDirtyPaintWorklets) { … }class ForceActivateAfterPaintWorkletPaintLayerTreeHostImplTest
: public CommitToPendingTreeLayerTreeHostImplTest { … }TEST_F(ForceActivateAfterPaintWorkletPaintLayerTreeHostImplTest,
ForceActivationAfterPaintWorkletsFinishPainting) { … }TEST_P(LayerTreeHostImplTest, PercentBasedScrollbarDeltasDSF3) { … }TEST_P(LayerTreeHostImplTest, PageBasedScroll) { … }class UnifiedScrollingTest : public LayerTreeHostImplTest { … }INSTANTIATE_COMMIT_TO_TREE_TEST_P(…)TEST_P(UnifiedScrollingTest, UnifiedScrollMainThreadScrollHitTestRegion) { … }TEST_P(UnifiedScrollingTest, MainThreadHitTestLatchBubbling) { … }UnifiedScrollingDeathTestINSTANTIATE_COMMIT_TO_TREE_TEST_P(…)TEST_P(UnifiedScrollingDeathTest, EmptyMainThreadHitTest) { … }TEST_P(UnifiedScrollingTest, MainThreadHitTestScrollNodeNotFound) { … }TEST_P(UnifiedScrollingTest, NonCompositedScrollOnCompositor) { … }TEST_P(UnifiedScrollingTest,
LayerMixedHitTestOpaquenessCausesMainThreadHitTest) { … }TEST_P(UnifiedScrollingTest,
LayerMixedHitTestOpaquenessCausesMainThreadHitTest2) { … }TEST_P(UnifiedScrollingTest, LayerOpaqueToHitTestScrollsOnCompositor) { … }TEST_P(UnifiedScrollingTest, FixedLayerOpaqueToHitTestScrollsOnCompositor) { … }TEST_P(UnifiedScrollingTest,
LayerOpaqueToHitTestEscapingScrollersWithMixedToHitTestLayers) { … }TEST_P(UnifiedScrollingTest,
ReliableScrollHitTestWithOpaqueAndMixedToHitTestLayers) { … }TEST_P(UnifiedScrollingTest, MainThreadScrollingReasonsScrollOnCompositor) { … }TEST_P(UnifiedScrollingTest, UnreliableHitTestOnNonOpaqueToHitTestScroller) { … }TEST_P(UnifiedScrollingTest, ScrollbarLayerClippedByRoundedCorner) { … }void UnifiedScrollingTest::TestNonCompositedScrollingState(
bool mutates_transform_tree) { … }TEST_P(UnifiedScrollingTest, MainThreadReasonsScrollDoesntAffectTransform) { … }TEST_P(UnifiedScrollingTest, NonCompositedScrollerDoesntAffectTransform) { … }TEST_P(UnifiedScrollingTest, CompositedWithSquashedLayerMutatesTransform) { … }TEST_P(OccludedSurfaceThrottlingLayerTreeHostImplTest,
ThrottleOccludedSurface) { … }TEST_P(LayerTreeHostImplTest, FrameElementIdHitTestSimple) { … }TEST_P(LayerTreeHostImplTest, FrameElementIdHitTestInheritance) { … }TEST_P(LayerTreeHostImplTest, FrameElementIdHitTestOverlap) { … }TEST_P(LayerTreeHostImplTest, FrameElementIdHitTestOverlapSimpleClip) { … }TEST_P(LayerTreeHostImplTest, FrameElementIdHitTestOverlapRoundedCorners) { … }TEST_P(LayerTreeHostImplTest, FrameElementIdHitTestOverlapSibling) { … }TEST_P(LayerTreeHostImplTest, ViewTransitionRequestCausesDamage) { … }TEST_P(LayerTreeHostImplTest, CollectRegionCaptureBounds) { … }TEST_P(LayerTreeHostImplTest, RecomputeRasterCapsOnLayerTreeFrameSinkUpdate) { … }TEST_P(LayerTreeHostImplBrowserControlsTest,
BrowserControlsActivelyScrollingType) { … }TEST_P(LayerTreeHostImplTest, AnimatedScrollSnapStrategyCurrentOffset) { … }TEST_P(LayerTreeHostImplTest, NonAnimatedScrollSnapStrategyCurrentOffset) { … }TEST_P(LayerTreeHostImplTest, AnimatedViewportScrollSnapStrategyCurrentOffset) { … }TEST_P(LayerTreeHostImplTest,
NonAnimatedViewportScrollSnapStrategyCurrentOffset) { … }TEST_P(LayerTreeHostImplTest, FlingSnapStrategyCurrentOffset) { … }class FakeLayerImpl : public LayerImpl { … }TEST_P(LayerTreeHostImplTest, VisbilityUpdateToLayers) { … }