chromium/cc/slim/slim_layer_tree_compositor_frame_unittest.cc

// Copyright 2023 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 <memory>
#include <utility>

#include "base/functional/callback_helpers.h"
#include "base/memory/weak_ptr.h"
#include "base/test/bind.h"
#include "base/time/time.h"
#include "base/unguessable_token.h"
#include "cc/base/region.h"
#include "cc/paint/filter_operation.h"
#include "cc/paint/filter_operations.h"
#include "cc/slim/layer.h"
#include "cc/slim/nine_patch_layer.h"
#include "cc/slim/solid_color_layer.h"
#include "cc/slim/surface_layer.h"
#include "cc/slim/test_frame_sink_impl.h"
#include "cc/slim/test_layer_tree_client.h"
#include "cc/slim/test_layer_tree_impl.h"
#include "cc/slim/ui_resource_layer.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/quads/compositor_frame.h"
#include "components/viz/common/quads/compositor_render_pass_draw_quad.h"
#include "components/viz/common/quads/surface_draw_quad.h"
#include "components/viz/common/quads/texture_draw_quad.h"
#include "components/viz/common/resources/transferable_resource.h"
#include "components/viz/common/surfaces/local_surface_id.h"
#include "components/viz/common/surfaces/surface_id.h"
#include "components/viz/test/draw_quad_matchers.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/linear_gradient.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rounded_corners_f.h"
#include "ui/gfx/geometry/test/geometry_util.h"
#include "ui/gfx/geometry/transform.h"
#include "ui/gfx/presentation_feedback.h"

namespace cc::slim {

namespace {

AllOf;
ElementsAre;

class SlimLayerTreeCompositorFrameTest : public testing::Test {};

TEST_F(SlimLayerTreeCompositorFrameTest, CompositorFrameMetadataBasics) {}

TEST_F(SlimLayerTreeCompositorFrameTest, OneSolidColorQuad) {}

TEST_F(SlimLayerTreeCompositorFrameTest, LayerTransform) {}

TEST_F(SlimLayerTreeCompositorFrameTest, ChildOrder) {}

TEST_F(SlimLayerTreeCompositorFrameTest, AxisAlignedClip) {}

TEST_F(SlimLayerTreeCompositorFrameTest, PresentationCallback) {}

TEST_F(SlimLayerTreeCompositorFrameTest, PresentationCallbackMissedFrame) {}

TEST_F(SlimLayerTreeCompositorFrameTest, SuccessPresentationCallback) {}

TEST_F(SlimLayerTreeCompositorFrameTest,
       SuccessPresentationCallbackNotCalledForFailedFrame) {}

TEST_F(SlimLayerTreeCompositorFrameTest, CopyOutputRequest) {}

TEST_F(SlimLayerTreeCompositorFrameTest, UIResourceLayerAppendQuads) {}

TEST_F(SlimLayerTreeCompositorFrameTest, ReclaimResources) {}

TEST_F(SlimLayerTreeCompositorFrameTest, NinePatchLayerAppendQuads) {}

TEST_F(SlimLayerTreeCompositorFrameTest, SurfaceLayerAppendQuads) {}

TEST_F(SlimLayerTreeCompositorFrameTest, SimpleHitTestRegionList) {}

TEST_F(SlimLayerTreeCompositorFrameTest, HitTestRegionInNonRootPass) {}

TEST_F(SlimLayerTreeCompositorFrameTest, NonInvertibleTransform) {}

TEST_F(SlimLayerTreeCompositorFrameTest, VisibleRect) {}

TEST_F(SlimLayerTreeCompositorFrameTest, CompletelyClippedLayer) {}

TEST_F(SlimLayerTreeCompositorFrameTest, NonAxisAlignedClip) {}

TEST_F(SlimLayerTreeCompositorFrameTest, ChildPassOutputRect) {}

TEST_F(SlimLayerTreeCompositorFrameTest, Filters) {}

TEST_F(SlimLayerTreeCompositorFrameTest, FiltersOnNonDrawingLayer) {}

TEST_F(SlimLayerTreeCompositorFrameTest, Opacity) {}

TEST_F(SlimLayerTreeCompositorFrameTest, SkipZeroOpacitySubtree) {}

TEST_F(SlimLayerTreeCompositorFrameTest, SimpleOcclusion) {}

TEST_F(SlimLayerTreeCompositorFrameTest, OcclusionWithNonOpaqueLayer) {}

TEST_F(SlimLayerTreeCompositorFrameTest, OcclusionWithRenderPass) {}

TEST_F(SlimLayerTreeCompositorFrameTest, OccludedNonOpaqueBackgroundColor) {}

TEST_F(SlimLayerTreeCompositorFrameTest, Guttering) {}

TEST_F(SlimLayerTreeCompositorFrameTest, PropertyDamage) {}

TEST_F(SlimLayerTreeCompositorFrameTest, PropertyChangeFromParentDamage) {}

TEST_F(SlimLayerTreeCompositorFrameTest, NonRootPassDamage) {}

TEST_F(SlimLayerTreeCompositorFrameTest, SimpleRoundedCorner) {}

TEST_F(SlimLayerTreeCompositorFrameTest, RoundedCornerWithChild) {}

TEST_F(SlimLayerTreeCompositorFrameTest, NonAxisAlignedRoundedCorner) {}

TEST_F(SlimLayerTreeCompositorFrameTest, RoundedCornerOnParentAndChild) {}

TEST_F(SlimLayerTreeCompositorFrameTest, GradientMaskWithChild) {}

TEST_F(SlimLayerTreeCompositorFrameTest, GradientMaskOnParentAndChild) {}

// Testing that {Add|Remove}SurfaceRange should trigger a draw via
// `SetNeedsDraw`, where the added or removed surface range should be reflected
// in the metadata of the next frame's metadata.
TEST_F(SlimLayerTreeCompositorFrameTest,
       AddRemoveSurfaceRangesTriggerSetNeedsDraw) {}

TEST_F(SlimLayerTreeCompositorFrameTest, OffsetTagLayers) {}

TEST_F(SlimLayerTreeCompositorFrameTest, OffsetTagVisibleRect) {}

TEST_F(SlimLayerTreeCompositorFrameTest, OffsetTagNoEmbeddedSurface) {}

TEST_F(SlimLayerTreeCompositorFrameTest, OffsetTagClipping) {}

}  // namespace

}  // namespace cc::slim