chromium/components/viz/service/display_embedder/skia_output_surface_impl_unittest.cc

// Copyright 2018 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_embedder/skia_output_surface_impl.h"

#include <memory>
#include <utility>

#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/pixel_test_utils.h"
#include "components/viz/common/display/renderer_settings.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_sinks/copy_output_util.h"
#include "components/viz/service/display/output_surface_frame.h"
#include "components/viz/service/display_embedder/skia_output_surface_dependency_impl.h"
#include "components/viz/service/gl/gpu_service_impl.h"
#include "components/viz/test/test_gpu_service_holder.h"
#include "gpu/command_buffer/service/service_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/gpu_fence_handle.h"
#include "ui/gl/gl_implementation.h"

namespace viz {
namespace {

constexpr gfx::Rect kSurfaceRect(0, 0, 100, 100);
constexpr SkColor4f kOutputColor =;

}  // namespace

class SkiaOutputSurfaceImplTest : public testing::Test {};

SkiaOutputSurfaceImplTest::SkiaOutputSurfaceImplTest()
    :{}

SkiaOutputSurfaceImplTest::~SkiaOutputSurfaceImplTest() {}

void SkiaOutputSurfaceImplTest::SetUpSkiaOutputSurfaceImpl() {}

gpu::SyncToken SkiaOutputSurfaceImplTest::PaintRootRenderPass(
    const gfx::Rect& output_rect,
    base::OnceClosure closure,
    base::OnceCallback<void(gfx::GpuFenceHandle)> return_release_fence) {}

void SkiaOutputSurfaceImplTest::BlockMainThread() {}

void SkiaOutputSurfaceImplTest::UnblockMainThread() {}

void SkiaOutputSurfaceImplTest::CheckSyncTokenOnGpuThread(
    const gpu::SyncToken& sync_token) {}

void SkiaOutputSurfaceImplTest::CopyRequestCallbackOnGpuThread(
    const gfx::Rect& output_rect,
    const gfx::ColorSpace& color_space,
    std::unique_ptr<CopyOutputResult> result) {}

// TODO(crbug.com/40922049): Re-enable this test
#if defined(MEMORY_SANITIZER)
#define MAYBE_EndPaint
#else
#define MAYBE_EndPaint
#endif
TEST_F(SkiaOutputSurfaceImplTest, MAYBE_EndPaint) {}

// Draws two frames and calls Reshape() between the two frames changing the
// color space. Verifies draw after color space change is successful.
TEST_F(SkiaOutputSurfaceImplTest, SupportsColorSpaceChange) {}

// TODO(crbug.com/40922049): Re-enable this test
#if defined(MEMORY_SANITIZER)
#define MAYBE_CopyOutputBitmapSupportedColorSpace
#else
#define MAYBE_CopyOutputBitmapSupportedColorSpace
#endif
// Tests that the destination color space is preserved across a CopyOutput for
// ColorSpaces supported by SkColorSpace.
TEST_F(SkiaOutputSurfaceImplTest, MAYBE_CopyOutputBitmapSupportedColorSpace) {}

// Tests that copying from a source with a color space that can't be converted
// to a SkColorSpace will fallback to a transform to sRGB.
TEST_F(SkiaOutputSurfaceImplTest, CopyOutputBitmapUnsupportedColorSpace) {}

}  // namespace viz