chromium/cc/test/layer_tree_test.cc

// Copyright 2011 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/layer_tree_test.h"

#include <memory>
#include <string>

#include "base/cfi_buildflags.h"
#include "base/clang_profiling_buildflags.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.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/keyframe_effect.h"
#include "cc/animation/keyframe_model.h"
#include "cc/base/switches.h"
#include "cc/input/input_handler.h"
#include "cc/layers/layer.h"
#include "cc/layers/layer_impl.h"
#include "cc/metrics/begin_main_frame_metrics.h"
#include "cc/metrics/compositor_timing_history.h"
#include "cc/test/animation_test_common.h"
#include "cc/test/fake_compositor_frame_reporting_controller.h"
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/test_layer_tree_frame_sink.h"
#include "cc/test/test_ukm_recorder_factory.h"
#include "cc/trees/layer_tree_host_client.h"
#include "cc/trees/layer_tree_host_impl.h"
#include "cc/trees/layer_tree_host_single_thread_client.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/paint_holding_reason.h"
#include "cc/trees/proxy_impl.h"
#include "cc/trees/proxy_main.h"
#include "cc/trees/single_thread_proxy.h"
#include "components/ukm/test_ukm_recorder.h"
#include "components/viz/common/frame_timing_details.h"
#include "components/viz/service/display/display_compositor_memory_and_task_controller.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 "components/viz/test/test_context_provider.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/config/gpu_finch_features.h"
#include "gpu/config/gpu_switches.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/animation/keyframe/timing_function.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_switches.h"

#if BUILDFLAG(SKIA_USE_DAWN)
#include "third_party/dawn/include/dawn/dawn_proc.h"
#include "third_party/dawn/include/dawn/native/DawnNative.h"  // nogncheck
#endif

namespace cc {
namespace {

class SynchronousLayerTreeFrameSink : public TestLayerTreeFrameSink {};

}  // namespace

// Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks.
class LayerTreeHostImplForTesting : public LayerTreeHostImpl {};

// Implementation of LayerTreeHost callback interface.
class LayerTreeHostClientForTesting : public LayerTreeHostClient,
                                      public LayerTreeHostSchedulingClient,
                                      public LayerTreeHostSingleThreadClient {};

// Adapts LayerTreeHost for test. Injects LayerTreeHostImplForTesting.
class LayerTreeHostForTesting : public LayerTreeHost {};

class LayerTreeTestLayerTreeFrameSinkClient
    : public TestLayerTreeFrameSinkClient {};

LayerTreeTest::LayerTreeTest(viz::RendererType renderer_type)
    :{}

LayerTreeTest::~LayerTreeTest() {}

void LayerTreeTest::EndTest() {}

void LayerTreeTest::EndTestAfterDelayMs(int delay_milliseconds) {}

void LayerTreeTest::PostAddNoDamageAnimationToMainThread(
    Animation* animation_to_receive_animation) {}

void LayerTreeTest::PostAddOpacityAnimationToMainThread(
    Animation* animation_to_receive_animation) {}

void LayerTreeTest::PostAddOpacityAnimationToMainThreadInstantly(
    Animation* animation_to_receive_animation) {}

void LayerTreeTest::PostAddOpacityAnimationToMainThreadDelayed(
    Animation* animation_to_receive_animation) {}

void LayerTreeTest::PostSetLocalSurfaceIdToMainThread(
    const viz::LocalSurfaceId& local_surface_id) {}

void LayerTreeTest::PostRequestNewLocalSurfaceIdToMainThread() {}

void LayerTreeTest::PostGetDeferMainFrameUpdateToMainThread(
    std::unique_ptr<ScopedDeferMainFrameUpdate>*
        scoped_defer_main_frame_update) {}

void LayerTreeTest::PostReturnDeferMainFrameUpdateToMainThread(
    std::unique_ptr<ScopedDeferMainFrameUpdate>
        scoped_defer_main_frame_update) {}

void LayerTreeTest::PostDeferringCommitsStatusToMainThread(
    bool is_deferring_commits) {}

void LayerTreeTest::PostSetNeedsCommitToMainThread() {}

void LayerTreeTest::PostSetNeedsUpdateLayersToMainThread() {}

void LayerTreeTest::PostSetNeedsRedrawToMainThread() {}

void LayerTreeTest::PostSetNeedsRedrawRectToMainThread(
    const gfx::Rect& damage_rect) {}

void LayerTreeTest::PostSetVisibleToMainThread(bool visible) {}

void LayerTreeTest::PostSetNeedsCommitWithForcedRedrawToMainThread() {}

void LayerTreeTest::PostCompositeImmediatelyToMainThread() {}

void LayerTreeTest::PostNextCommitWaitsForActivationToMainThread() {}

std::unique_ptr<LayerTreeFrameSink>
LayerTreeTest::ReleaseLayerTreeFrameSinkOnLayerTreeHost() {}

void LayerTreeTest::SetVisibleOnLayerTreeHost(bool visible) {}

void LayerTreeTest::WillBeginTest() {}

void LayerTreeTest::DoBeginTest() {}

void LayerTreeTest::SkipAllocateInitialLocalSurfaceId() {}

const viz::LocalSurfaceId& LayerTreeTest::GetCurrentLocalSurfaceId() const {}

void LayerTreeTest::GenerateNewLocalSurfaceId() {}

void LayerTreeTest::SetupTree() {}

void LayerTreeTest::Timeout() {}

void LayerTreeTest::RealEndTest() {}

void LayerTreeTest::DispatchAddNoDamageAnimation(
    Animation* animation_to_receive_animation,
    double animation_duration) {}

void LayerTreeTest::DispatchAddOpacityAnimation(
    Animation* animation_to_receive_animation,
    double animation_duration) {}

void LayerTreeTest::DispatchSetLocalSurfaceId(
    const viz::LocalSurfaceId& local_surface_id) {}

void LayerTreeTest::DispatchRequestNewLocalSurfaceId() {}

void LayerTreeTest::DispatchGetDeferMainFrameUpdate(
    std::unique_ptr<ScopedDeferMainFrameUpdate>*
        scoped_defer_main_frame_update) {}

void LayerTreeTest::DispatchReturnDeferMainFrameUpdate(
    std::unique_ptr<ScopedDeferMainFrameUpdate>
        scoped_defer_main_frame_update) {}

void LayerTreeTest::DispatchDeferringCommitsStatus(bool is_deferring_commits) {}

void LayerTreeTest::DispatchSetNeedsCommit() {}

void LayerTreeTest::DispatchSetNeedsUpdateLayers() {}

void LayerTreeTest::DispatchSetNeedsRedraw() {}

void LayerTreeTest::DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect) {}

void LayerTreeTest::DispatchSetVisible(bool visible) {}

void LayerTreeTest::DispatchSetNeedsCommitWithForcedRedraw() {}

void LayerTreeTest::DispatchCompositeImmediately() {}

void LayerTreeTest::DispatchNextCommitWaitsForActivation() {}

void LayerTreeTest::RunTest(CompositorMode mode) {}

void LayerTreeTest::RequestNewLayerTreeFrameSink() {}

void LayerTreeTest::SetUpUnboundContextProviders(
    viz::TestContextProvider* context_provider,
    viz::TestContextProvider* worker_context_provider) {}

std::unique_ptr<TestLayerTreeFrameSink> LayerTreeTest::CreateLayerTreeFrameSink(
    const viz::RendererSettings& renderer_settings,
    double refresh_rate,
    scoped_refptr<viz::RasterContextProvider> compositor_context_provider,
    scoped_refptr<viz::RasterContextProvider> worker_context_provider) {}

std::unique_ptr<viz::DisplayCompositorMemoryAndTaskController>
LayerTreeTest::CreateDisplayControllerOnThread() {}

std::unique_ptr<viz::SkiaOutputSurface>
LayerTreeTest::CreateSkiaOutputSurfaceOnThread(
    viz::DisplayCompositorMemoryAndTaskController*) {}

std::unique_ptr<viz::OutputSurface>
LayerTreeTest::CreateSoftwareOutputSurfaceOnThread() {}

size_t LayerTreeTest::NumCallsToWaitForProtectedSequenceCompletion() const {}

void LayerTreeTest::DestroyLayerTreeHost() {}

TaskRunnerProvider* LayerTreeTest::task_runner_provider() const {}

LayerTreeHost* LayerTreeTest::layer_tree_host() const {}

Proxy* LayerTreeTest::proxy() {}

}  // namespace cc