chromium/cc/trees/layer_tree_host_unittest_capture.cc

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

#include "cc/test/fake_content_layer_client.h"
#include "cc/test/fake_picture_layer.h"
#include "cc/test/layer_tree_test.h"
#include "cc/test/property_tree_test_utils.h"
#include "cc/trees/layer_tree_impl.h"
#include "components/viz/common/quads/compositor_frame.h"
#include "components/viz/common/surfaces/subtree_capture_id.h"

namespace cc {
namespace {

constexpr viz::SubtreeCaptureId kCaptureId(base::Token(0u, 22u));

// A base class for tests that verifies the bahvior of the layer tree when a
// sub layer has a valid viz::SubtreeCaptureId.
class LayerTreeHostCaptureTest : public LayerTreeTest {};

// -----------------------------------------------------------------------------
// LayerTreeHostCaptureTestNoExtraRenderPassWhenNotCapturing:
//
// Tests that a layer tree that doesn't have a viz::SubtreeCaptureId on any of
// its layers, draw in a single root render surface, and generates a single
// compositor render pass.
class LayerTreeHostCaptureTestNoExtraRenderPassWhenNotCapturing
    : public LayerTreeHostCaptureTest {};

SINGLE_AND_MULTI_THREAD_TEST_F(
    LayerTreeHostCaptureTestNoExtraRenderPassWhenNotCapturing);

// -----------------------------------------------------------------------------
// LayerTreeHostCaptureTestLayerWithCaptureIdElevatesToSurface
//
// Tests that a layer sub tree whose root has a valid viz::SubtreeCaptureId will
// draw into a separate render surface and a separate render pass.
class LayerTreeHostCaptureTestLayerWithCaptureIdElevatesToSurface
    : public LayerTreeHostCaptureTest {};

SINGLE_AND_MULTI_THREAD_TEST_F(
    LayerTreeHostCaptureTestLayerWithCaptureIdElevatesToSurface);

}  // namespace
}  // namespace cc