#include "components/paint_preview/common/serialized_recording.h"
#include <optional>
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/test/task_environment.h"
#include "base/threading/thread_restrictions.h"
#include "base/unguessable_token.h"
#include "components/paint_preview/common/capture_result.h"
#include "components/paint_preview/common/paint_preview_tracker.h"
#include "components/paint_preview/common/proto/paint_preview.pb.h"
#include "components/paint_preview/common/recording_map.h"
#include "components/paint_preview/common/serial_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkMatrix.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
#include "third_party/skia/include/core/SkRect.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/core/SkSurfaceProps.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
namespace paint_preview {
namespace {
sk_sp<const SkPicture> PaintGrayPictureWithSubframes(
gfx::Size bounds,
PictureSerializationContext* context,
DeserializationContext* expected_deserialization_context,
base::flat_map<base::UnguessableToken, gfx::RectF> subframes) { … }
sk_sp<const SkPicture> PaintPictureSingleGrayPixel() { … }
sk_sp<const SkPicture> PaintPictureLargeImage(gfx::Size bounds) { … }
SkBitmap CreateBitmapFromPicture(const SkPicture* pic) { … }
void ExpectPicturesEqual(sk_sp<const SkPicture> pic,
sk_sp<const SkPicture> expected) { … }
}
class PaintPreviewSerializedRecordingTest : public testing::Test { … };
TEST_F(PaintPreviewSerializedRecordingTest, RoundtripWithFileBacking) { … }
TEST_F(PaintPreviewSerializedRecordingTest, RoundtripWithMemoryBufferBacking) { … }
TEST_F(PaintPreviewSerializedRecordingTest, ImageDiscardingTolerated) { … }
TEST_F(PaintPreviewSerializedRecordingTest, ImageDiscardingNotTolerated) { … }
TEST_F(PaintPreviewSerializedRecordingTest, InvalidBacking) { … }
TEST_F(PaintPreviewSerializedRecordingTest, RoundtripHasEmbeddedContent) { … }
TEST_F(PaintPreviewSerializedRecordingTest,
RecordingMapFromCaptureResultSingleFrame) { … }
TEST_F(PaintPreviewSerializedRecordingTest,
RecordingMapFromPaintPreviewProtoSingleFrame) { … }
}