#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/viz/service/display/display.h"
#include <limits>
#include <map>
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/null_task_runner.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "cc/base/features.h"
#include "cc/base/math_util.h"
#include "cc/test/scheduler_test_common.h"
#include "components/viz/common/features.h"
#include "components/viz/common/frame_sinks/begin_frame_source.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/quads/aggregated_render_pass.h"
#include "components/viz/common/quads/aggregated_render_pass_draw_quad.h"
#include "components/viz/common/quads/compositor_frame.h"
#include "components/viz/common/quads/compositor_render_pass.h"
#include "components/viz/common/quads/compositor_render_pass_draw_quad.h"
#include "components/viz/common/quads/solid_color_draw_quad.h"
#include "components/viz/common/quads/surface_draw_quad.h"
#include "components/viz/common/surfaces/frame_sink_id.h"
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
#include "components/viz/common/surfaces/region_capture_bounds.h"
#include "components/viz/common/surfaces/subtree_capture_id.h"
#include "components/viz/common/switches.h"
#include "components/viz/service/display/aggregated_frame.h"
#include "components/viz/service/display/delegated_ink_point_renderer_skia.h"
#include "components/viz/service/display/delegated_ink_trail_data.h"
#include "components/viz/service/display/direct_renderer.h"
#include "components/viz/service/display/display_client.h"
#include "components/viz/service/display/display_scheduler.h"
#include "components/viz/service/display/overlay_processor_stub.h"
#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h"
#include "components/viz/service/frame_sinks/compositor_frame_sink_support.h"
#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h"
#include "components/viz/service/surfaces/surface.h"
#include "components/viz/service/surfaces/surface_manager.h"
#include "components/viz/test/compositor_frame_helpers.h"
#include "components/viz/test/delegated_ink_point_renderer_skia_for_test.h"
#include "components/viz/test/fake_output_surface.h"
#include "components/viz/test/fake_skia_output_surface.h"
#include "components/viz/test/mock_compositor_frame_sink_client.h"
#include "components/viz/test/test_gles2_interface.h"
#include "components/viz/test/test_surface_id_allocator.h"
#include "components/viz/test/viz_test_suite.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/common/swap_buffers_complete_params.h"
#include "gpu/command_buffer/service/scheduler.h"
#include "gpu/command_buffer/service/shared_image/shared_image_manager.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/gfx/delegated_ink_metadata.h"
#include "ui/gfx/delegated_ink_point.h"
#include "ui/gfx/mojom/delegated_ink_point_renderer.mojom.h"
#include "ui/gfx/overlay_transform.h"
_;
AnyNumber;
namespace viz {
namespace {
static constexpr FrameSinkId kArbitraryFrameSinkId(3, 3);
static constexpr FrameSinkId kAnotherFrameSinkId(4, 4);
static constexpr FrameSinkId kAnotherFrameSinkId2(5, 5);
const uint64_t kBeginFrameSourceId = …;
class TestSoftwareOutputDevice : public SoftwareOutputDevice { … };
class TestDisplayScheduler : public DisplayScheduler { … };
class StubDisplayClient : public DisplayClient { … };
void CopyCallback(bool* called,
base::OnceClosure finished,
std::unique_ptr<CopyOutputResult> result) { … }
gfx::SwapTimings GetTestSwapTimings() { … }
std::string PostTestCaseName(const ::testing::TestParamInfo<bool>& info) { … }
}
class DisplayTest : public testing::Test { … };
TEST_F(DisplayTest, DisplayDamaged) { … }
void DisplayTest::LatencyInfoCapTest(bool over_capacity) { … }
TEST_F(DisplayTest, UnderLatencyInfoCap) { … }
TEST_F(DisplayTest, OverLatencyInfoCap) { … }
TEST_F(DisplayTest, DisableSwapUntilResize) { … }
TEST_F(DisplayTest, BackdropFilterTest) { … }
TEST_F(DisplayTest, CompositorFrameDamagesCorrectDisplay) { … }
class OnBeginFrameAcksDisplayTest : public DisplayTest,
public testing::WithParamInterface<bool> { … };
OnBeginFrameAcksDisplayTest::OnBeginFrameAcksDisplayTest() { … }
TEST_P(OnBeginFrameAcksDisplayTest, CompositorFrameWithPresentationToken) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(DisplayTest, BeginFrameThrottling) { … }
TEST_F(DisplayTest, BeginFrameThrottlingMultipleSurfaces) { … }
TEST_F(DisplayTest, DontThrottleWhenParentBlocked) { … }
TEST_F(DisplayTest, DisplayTransformHint) { … }
TEST_F(DisplayTest, DisplaySizeMismatch) { … }
class UseMapRectDisplayTest : public DisplayTest,
public testing::WithParamInterface<bool> { … };
UseMapRectDisplayTest::UseMapRectDisplayTest() { … }
TEST_P(UseMapRectDisplayTest, PixelMovingForegroundFilterTest) { … }
TEST_F(DisplayTest, CanSkipRenderPass) { … }
class SkiaDelegatedInkRendererTest : public DisplayTest { … };
TEST_F(SkiaDelegatedInkRendererTest, SkiaDelegatedInkRendererFilteringPoints) { … }
TEST_F(SkiaDelegatedInkRendererTest,
SkiaDelegatedInkRendererFilteringPointsWithMultiplePointerIds) { … }
TEST_F(SkiaDelegatedInkRendererTest, LatencyHistograms) { … }
TEST_F(SkiaDelegatedInkRendererTest, DrawTrailWhenMetadataIsCloseEnough) { … }
TEST_F(SkiaDelegatedInkRendererTest, SkiaDelegatedInkOutstandingPointsToDraw) { … }
TEST_F(SkiaDelegatedInkRendererTest, SkiaDelegatedInkTimeToDrawMillis) { … }
enum class DelegatedInkType { … };
class DelegatedInkDisplayTest
: public SkiaDelegatedInkRendererTest,
public testing::WithParamInterface<DelegatedInkType> { … };
struct DelegatedInkDisplayTestPassToString { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(DelegatedInkDisplayTest, MetadataOnlySentToSkiaRendererOrOutputSurface) { … }
TEST_P(DelegatedInkDisplayTest,
InkRendererRemoteGoesToSkiaRendererOrOutputSurface) { … }
UnsupportedRendererDelegatedInkTest;
TEST_F(UnsupportedRendererDelegatedInkTest,
DelegatedInkSilentlyFailsOnSoftwareRenderer) { … }
INSTANTIATE_TEST_SUITE_P(…);
}