#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 = …;
}
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) { … }
#if defined(MEMORY_SANITIZER)
#define MAYBE_EndPaint …
#else
#define MAYBE_EndPaint …
#endif
TEST_F(SkiaOutputSurfaceImplTest, MAYBE_EndPaint) { … }
TEST_F(SkiaOutputSurfaceImplTest, SupportsColorSpaceChange) { … }
#if defined(MEMORY_SANITIZER)
#define MAYBE_CopyOutputBitmapSupportedColorSpace …
#else
#define MAYBE_CopyOutputBitmapSupportedColorSpace …
#endif
TEST_F(SkiaOutputSurfaceImplTest, MAYBE_CopyOutputBitmapSupportedColorSpace) { … }
TEST_F(SkiaOutputSurfaceImplTest, CopyOutputBitmapUnsupportedColorSpace) { … }
}