#include "cc/test/pixel_test.h"
#include <memory>
#include <utility>
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/shared_memory_mapping.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/test/test_switches.h"
#include "build/build_config.h"
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/pixel_test_output_surface.h"
#include "cc/test/pixel_test_utils.h"
#include "components/viz/client/client_resource_provider.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/resources/bitmap_allocation.h"
#include "components/viz/common/resources/shared_bitmap.h"
#include "components/viz/service/display/display_resource_provider_skia.h"
#include "components/viz/service/display/display_resource_provider_software.h"
#include "components/viz/service/display/software_output_device.h"
#include "components/viz/service/display/software_renderer.h"
#include "components/viz/service/display_embedder/skia_output_surface_dependency_impl.h"
#include "components/viz/service/display_embedder/skia_output_surface_impl.h"
#include "components/viz/service/gl/gpu_service_impl.h"
#include "components/viz/test/paths.h"
#include "components/viz/test/test_in_process_context_provider.h"
#include "components/viz/test/test_shared_bitmap_manager.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/config/gpu_finch_features.h"
#include "skia/buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(SKIA_USE_DAWN)
#include "third_party/dawn/include/dawn/dawn_proc.h"
#include "third_party/dawn/include/dawn/native/DawnNative.h"
#endif
namespace cc {
PixelTest::PixelTest(GraphicsBackend backend)
: … { … }
PixelTest::~PixelTest() = default;
void PixelTest::RenderReadbackTargetAndAreaToResultBitmap(
viz::AggregatedRenderPassList* pass_list,
viz::AggregatedRenderPass* target,
const gfx::Rect* copy_rect) { … }
bool PixelTest::RunPixelTest(viz::AggregatedRenderPassList* pass_list,
const base::FilePath& ref_file,
const PixelComparator& comparator) { … }
bool PixelTest::RunPixelTestWithReadbackTarget(
viz::AggregatedRenderPassList* pass_list,
viz::AggregatedRenderPass* target,
const base::FilePath& ref_file,
const PixelComparator& comparator) { … }
bool PixelTest::RunPixelTestWithReadbackTargetAndArea(
viz::AggregatedRenderPassList* pass_list,
viz::AggregatedRenderPass* target,
const base::FilePath& ref_file,
const PixelComparator& comparator,
const gfx::Rect* copy_rect) { … }
bool PixelTest::RunPixelTest(viz::AggregatedRenderPassList* pass_list,
std::vector<SkColor>* ref_pixels,
const PixelComparator& comparator) { … }
bool PixelTest::RunPixelTest(viz::AggregatedRenderPassList* pass_list,
SkBitmap ref_bitmap,
const PixelComparator& comparator) { … }
void PixelTest::ReadbackResult(base::OnceClosure quit_run_loop,
std::unique_ptr<viz::CopyOutputResult> result) { … }
base::WritableSharedMemoryMapping PixelTest::AllocateSharedBitmapMemory(
const viz::SharedBitmapId& id,
const gfx::Size& size) { … }
viz::ResourceId PixelTest::AllocateAndFillSoftwareResource(
const gfx::Size& size,
const SkBitmap& source) { … }
void PixelTest::SetUpSkiaRenderer(gfx::SurfaceOrigin output_surface_origin) { … }
void PixelTest::TearDown() { … }
void PixelTest::SetUpSoftwareRenderer() { … }
void PixelTest::FinishSetup() { … }
}