chromium/components/viz/service/display/resolved_frame_data_unittest.cc

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

#include "components/viz/service/display/resolved_frame_data.h"

#include <memory>
#include <utility>

#include "components/viz/common/quads/compositor_render_pass.h"
#include "components/viz/common/quads/offset_tag.h"
#include "components/viz/common/quads/texture_draw_quad.h"
#include "components/viz/service/display/display_resource_provider_software.h"
#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h"
#include "components/viz/service/frame_sinks/compositor_frame_sink_support.h"
#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h"
#include "components/viz/service/surfaces/surface.h"
#include "components/viz/test/compositor_frame_helpers.h"
#include "components/viz/test/draw_quad_matchers.h"
#include "components/viz/test/test_surface_id_allocator.h"
#include "gpu/command_buffer/service/scheduler.h"
#include "gpu/command_buffer/service/shared_image/shared_image_manager.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/transform.h"
#include "ui/gfx/geometry/vector2d_f.h"

namespace viz {

// Allow test access to ResolvedFrameData internals.
class ResolvedFrameDataTestHelper {};

namespace {

constexpr gfx::Rect kOutputRect(100, 100);
constexpr FrameSinkId kArbitraryFrameSinkId(1, 1);

SurfaceId MakeSurfaceId() {}

OffsetTagDefinition MakeOffsetTagDefinition() {}

CompositorFrame MakeSimpleFrame(const gfx::Rect& damage_rect = kOutputRect) {}

std::unique_ptr<CompositorRenderPass> BuildRenderPass(int id) {}

void AddRenderPassQuad(CompositorRenderPass* render_pass,
                       CompositorRenderPassId render_pass_id) {}

class ResolvedFrameDataTest : public testing::Test {};

// Submits a CompositorFrame with three valid render passes then checks that
// ResolvedPassData is valid and has the correct data.
TEST_F(ResolvedFrameDataTest, UpdateActiveFrame) {}

// Constructs a CompositorFrame with two render passes that have the same id.
// Verifies the frame is rejected as invalid.
TEST_F(ResolvedFrameDataTest, DupliateRenderPassIds) {}

// Constructs a CompositorFrame with render pass that tries to embed itself
// forming a cycle. Verifies the frame is rejected as invalid.
TEST_F(ResolvedFrameDataTest, RenderPassIdsSelfCycle) {}

// Constructs a CompositorFrame with two render pass that tries to embed each
// other forming a cycle. Verifies the frame is rejected as invalid.
TEST_F(ResolvedFrameDataTest, RenderPassIdsCycle) {}

// Check GetRectDamage() handles per quad damage correctly.
TEST_F(ResolvedFrameDataTest, RenderPassWithPerQuadDamage) {}

TEST_F(ResolvedFrameDataTest, MarkAsUsed) {}

// Verifies that SetFullDamageForNextAggregation()
TEST_F(ResolvedFrameDataTest, SetFullDamageNextAggregation) {}

// Verifies that the ResolvedFrameData will reuse a provided root pass ID
TEST_F(ResolvedFrameDataTest, ReusePreviousRootPassId) {}

// Verify OffsetTag creating a modified copy of original CompositorRenderPasses.
TEST_F(ResolvedFrameDataTest, OffsetTags) {}

TEST_F(ResolvedFrameDataTest, OffsetTagValueIsClamped) {}

TEST_F(ResolvedFrameDataTest, OffsetTagWithCopyRequest) {}

// Verify that client provided damage is offset along with quads.
TEST_F(ResolvedFrameDataTest, OffsetTagClientDamageIsOffset) {}

// Verify damage works correctly when the offset value changes.
TEST_F(ResolvedFrameDataTest, OffsetTagOffsetValueChangedDamage) {}

// Verify damage works correctly when an offset tag is removed from a layer.
TEST_F(ResolvedFrameDataTest, OffsetTagLayerRemovedDamage) {}

// Verify that containing rect is computed correctly for tagged quads that are
// in a non-root render pass with non-trivial transform between the render
// passes.
TEST_F(ResolvedFrameDataTest, OffsetTagContainingRectNonRootRenderPass) {}

}  // namespace
}  // namespace viz