#include "components/viz/service/display/overlay_candidate_factory.h"
#include <unordered_map>
#include <vector>
#include "base/dcheck_is_on.h"
#include "components/viz/client/client_resource_provider.h"
#include "components/viz/common/gpu/context_provider.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/draw_quad.h"
#include "components/viz/common/quads/solid_color_draw_quad.h"
#include "components/viz/common/quads/texture_draw_quad.h"
#include "components/viz/common/resources/resource_id.h"
#include "components/viz/common/resources/shared_image_format.h"
#include "components/viz/service/display/aggregated_frame.h"
#include "components/viz/service/display/display_resource_provider.h"
#include "components/viz/service/display/display_resource_provider_null.h"
#include "components/viz/service/display/overlay_candidate.h"
#include "components/viz/test/test_context_provider.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/test/geometry_util.h"
#include "ui/gfx/overlay_transform_utils.h"
#include "ui/gfx/video_types.h"
_;
Mock;
namespace viz {
namespace {
RoundedDisplayMasksInfo;
OverlayCandidateFactory::OverlayContext GetOverlayContextForTesting() { … }
class OverlayCandidateFactoryTestBase : public testing::Test { … };
SolidColorDrawQuad* AddQuad(const gfx::Rect quad_rect,
const gfx::Transform& quad_to_target_transform,
AggregatedRenderPass* render_pass,
const std::optional<gfx::Rect> clip_rect,
const gfx::Rect visible_rect) { … }
SolidColorDrawQuad* AddQuad(const gfx::Rect quad_rect,
const gfx::Transform& quad_to_target_transform,
AggregatedRenderPass* render_pass) { … }
AggregatedRenderPassDrawQuad* AddRenderPassQuad(
gfx::Rect quad_rect,
gfx::Transform transform,
std::optional<gfx::Rect> clip_rect,
AggregatedRenderPassId rpid,
AggregatedRenderPass* render_pass) { … }
OverlayCandidate CreateCandidate(float left,
float top,
float right,
float bottom) { … }
OverlayCandidateFactoryTest;
TEST_F(OverlayCandidateFactoryTest, IsOccluded) { … }
TEST_F(OverlayCandidateFactoryTest, IsOccludedScaled) { … }
TEST_F(OverlayCandidateFactoryTest, RoundedCorner) { … }
TEST_F(OverlayCandidateFactoryTest, RoundedCornerOptimizedwireSize) { … }
class OverlayCandidateFactoryArbitraryTransformTest
: public OverlayCandidateFactoryTestBase { … };
TEST_F(OverlayCandidateFactoryArbitraryTransformTest,
AxisAlignedNotBakedIntoDisplayRect) { … }
TEST_F(OverlayCandidateFactoryArbitraryTransformTest, SupportsNonAxisAligned) { … }
TEST_F(OverlayCandidateFactoryArbitraryTransformTest, TransformIncludesYFlip) { … }
TEST_F(OverlayCandidateFactoryArbitraryTransformTest,
UseArbitraryTransformWhenSupported) { … }
TEST_F(OverlayCandidateFactoryArbitraryTransformTest,
UseOverlayTransformWhenPossibleForWireSize) { … }
TEST_F(OverlayCandidateFactoryArbitraryTransformTest,
Allow3DTransformNoPerspective) { … }
TEST_F(OverlayCandidateFactoryArbitraryTransformTest,
TechnicallyFlatTransform) { … }
#if DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST)
class OverlayCandidateFactoryInvalidContextTest
: public OverlayCandidateFactoryTestBase { … };
TEST_F(OverlayCandidateFactoryInvalidContextTest, NoClipSupport) { … }
TEST_F(OverlayCandidateFactoryInvalidContextTest, NoTransformSupport) { … }
#endif
TEST_F(OverlayCandidateFactoryArbitraryTransformTest,
NoArbitraryTransformSupportFails) { … }
TEST_F(OverlayCandidateFactoryArbitraryTransformTest,
OccludedByFilteredQuadWorksInTargetSpace) { … }
TEST_F(OverlayCandidateFactoryArbitraryTransformTest,
UnassignedDamageWithArbitraryTransforms) { … }
constexpr float kEpsilon = …;
class TransformedOverlayClipRectTest : public OverlayCandidateFactoryTestBase { … };
TEST_F(TransformedOverlayClipRectTest, NoTransform) { … }
TEST_F(TransformedOverlayClipRectTest, Rotate90) { … }
TEST_F(TransformedOverlayClipRectTest, Rotate180) { … }
TEST_F(TransformedOverlayClipRectTest, Rotate270) { … }
TEST_F(TransformedOverlayClipRectTest, ClippedUvs) { … }
TEST_F(TransformedOverlayClipRectTest, NoTransformNeedsDetiling) { … }
TEST_F(TransformedOverlayClipRectTest, Rotate90NeedsDetiling) { … }
TEST_F(TransformedOverlayClipRectTest, Rotate180NeedsDetiling) { … }
TEST_F(TransformedOverlayClipRectTest, Rotate270NeedsDetiling) { … }
TEST_F(OverlayCandidateFactoryTest, RenderPassClipped) { … }
TEST_F(OverlayCandidateFactoryTest, RenderPassOffscreen) { … }
TEST_F(OverlayCandidateFactoryTest, RenderPassOffscreenBeforeFilter) { … }
TEST_F(OverlayCandidateFactoryTest, ClipDelegation_Success) { … }
TEST_F(OverlayCandidateFactoryTest, ClipDelegation_OutOfWindow) { … }
TEST_F(OverlayCandidateFactoryTest, ClipDelegation_VisibleRect) { … }
}
}