#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "cc/paint/discardable_image_map.h"
#include <stddef.h>
#include <algorithm>
#include <limits>
#include <memory>
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/memory/ref_counted.h"
#include "base/test/gtest_util.h"
#include "base/values.h"
#include "cc/base/region.h"
#include "cc/paint/paint_flags.h"
#include "cc/paint/paint_op_buffer.h"
#include "cc/paint/paint_recorder.h"
#include "cc/paint/skottie_color_map.h"
#include "cc/paint/skottie_frame_data.h"
#include "cc/paint/skottie_resource_metadata.h"
#include "cc/test/fake_content_layer_client.h"
#include "cc/test/fake_recording_source.h"
#include "cc/test/lottie_test_data.h"
#include "cc/test/paint_image_matchers.h"
#include "cc/test/skia_common.h"
#include "cc/test/test_paint_worklet_input.h"
#include "skia/buildflags.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkBlendMode.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkClipOp.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkGraphics.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageGenerator.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkMatrix.h"
#include "third_party/skia/include/core/SkRect.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/core/SkSize.h"
#include "third_party/skia/include/core/SkTileMode.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/skia_conversions.h"
namespace cc {
namespace {
_;
Contains;
Eq;
Field;
FieldsAre;
FloatNear;
IsEmpty;
SizeIs;
UnorderedElementsAre;
Rects;
struct PositionScaleDrawImage { … };
PaintRecord CreateRecording(const PaintImage& discardable_image,
const gfx::Rect& visible_rect) { … }
}
class DiscardableImageMapTest : public testing::Test { … };
TEST_F(DiscardableImageMapTest, GetDiscardableImagesInRectTest) { … }
TEST_F(DiscardableImageMapTest, GetDiscardableImagesInRectNonZeroLayer) { … }
TEST_F(DiscardableImageMapTest, GetDiscardableImagesInRectOnePixelQuery) { … }
TEST_F(DiscardableImageMapTest, GetDiscardableImagesInRectMassiveImage) { … }
TEST_F(DiscardableImageMapTest, PaintDestroyedWhileImageIsDrawn) { … }
TEST_F(DiscardableImageMapTest, RestoreSavedBigLayers) { … }
TEST_F(DiscardableImageMapTest, RestoreSavedTransformedLayers) { … }
TEST_F(DiscardableImageMapTest, NullPaintOnSaveLayer) { … }
TEST_F(DiscardableImageMapTest, GetDiscardableImagesInRectMaxImage) { … }
TEST_F(DiscardableImageMapTest, GetDiscardableImagesInRectMaxImageMaxLayer) { … }
TEST_F(DiscardableImageMapTest, GetDiscardableImagesRectInBounds) { … }
TEST_F(DiscardableImageMapTest, GetDiscardableImagesInShader) { … }
TEST_F(DiscardableImageMapTest, ClipsImageRects) { … }
TEST_F(DiscardableImageMapTest, GathersDiscardableImagesFromNestedOps) { … }
TEST_F(DiscardableImageMapTest, GathersAnimatedImages) { … }
TEST_F(DiscardableImageMapTest, GathersPaintWorklets) { … }
TEST_F(DiscardableImageMapTest, CapturesImagesInPaintRecordShaders) { … }
TEST_F(DiscardableImageMapTest, CapturesImagesInPaintFilters) { … }
TEST_F(DiscardableImageMapTest, CapturesImagesInSaveLayers) { … }
TEST_F(DiscardableImageMapTest, EmbeddedShaderWithAnimatedImages) { … }
TEST_F(DiscardableImageMapTest, DecodingModeHintsBasic) { … }
TEST_F(DiscardableImageMapTest, DecodingModeHintsDuplicates) { … }
TEST_F(DiscardableImageMapTest, TracksImageRegions) { … }
TEST_F(DiscardableImageMapTest, ImagesUnderDrawScrollingContentsOp) { … }
#if BUILDFLAG(SKIA_SUPPORT_SKOTTIE)
TEST_F(DiscardableImageMapTest,
GetDiscardableImagesInRectSkottieWithoutImages) { … }
TEST_F(DiscardableImageMapTest, GetDiscardableImagesInRectSkottieWithImages) { … }
TEST_F(DiscardableImageMapTest,
GetDiscardableImagesInRectSkottieWithImagesScalesProperly) { … }
#endif
}