#include <limits>
#include "mojo/public/cpp/test_support/test_utils.h"
#include "skia/ext/skcolorspace_primaries.h"
#include "skia/public/mojom/bitmap.mojom.h"
#include "skia/public/mojom/bitmap_skbitmap_mojom_traits.h"
#include "skia/public/mojom/image_info.mojom-shared.h"
#include "skia/public/mojom/image_info.mojom.h"
#include "skia/public/mojom/skcolorspace.mojom.h"
#include "skia/public/mojom/skcolorspace_mojom_traits.h"
#include "skia/public/mojom/skcolorspace_primaries.mojom.h"
#include "skia/public/mojom/skcolorspace_primaries_mojom_traits.h"
#include "skia/public/mojom/tile_mode.mojom.h"
#include "skia/public/mojom/tile_mode_mojom_traits.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkColorFilter.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkString.h"
#include "third_party/skia/include/core/SkTileMode.h"
#include "third_party/skia/modules/skcms/skcms.h"
#include "ui/gfx/skia_util.h"
namespace skia {
namespace {
mojo::StructPtr<skia::mojom::BitmapN32> ConstructBitmapN32(
SkImageInfo info,
std::vector<unsigned char> pixels) { … }
mojo::StructPtr<skia::mojom::BitmapWithArbitraryBpp>
ConstructBitmapWithArbitraryBpp(SkImageInfo info,
int row_bytes,
std::vector<unsigned char> pixels) { … }
mojo::StructPtr<skia::mojom::BitmapMappedFromTrustedProcess>
ConstructBitmapMappedFromTrustedProcess(SkImageInfo info,
int row_bytes,
std::vector<unsigned char> pixels) { … }
mojo::StructPtr<skia::mojom::InlineBitmap> ConstructInlineBitmap(
SkImageInfo info,
std::vector<unsigned char> pixels) { … }
mojo::StructPtr<skia::mojom::ImageInfo> ConstructImageInfo(
SkColorType color_type,
SkAlphaType alpha_type,
uint32_t width,
uint32_t height) { … }
TEST(StructTraitsTest, ImageInfo) { … }
TEST(StructTraitsDeathTest, ImageInfoOverflowSizeWithStructTrait) { … }
TEST(StructTraitsTest, ImageInfoOverflowSizeWithoutStructTrait) { … }
TEST(StructTraitsTest, ImageInfoCustomColorSpace) { … }
TEST(StructTraitsTest, SkColorSpace) { … }
TEST(StructTraitsTest, TileMode) { … }
TEST(StructTraitsTest, Bitmap) { … }
TEST(StructTraitsTest, BitmapNull) { … }
TEST(StructTraitsTest, InlineBitmapSerializeToString) { … }
TEST(StructTraitsTest, VerifyMojomConstruction) { … }
TEST(StructTraitsTest, BitmapTooWideToSerialize) { … }
TEST(StructTraitsTest, BitmapTooTallToSerialize) { … }
template <typename MojomType>
static void BadRowBytes() { … }
TEST(StructTraitsTest, BitmapSerializeInvalidRowBytes_BitmapN32) { … }
TEST(StructTraitsTest, BitmapSerializeInvalidRowBytes_BitmapWithArbitraryBpp) { … }
TEST(StructTraitsTest,
BitmapSerializeInvalidRowBytes_BitmapMappedFromTrustedProcess) { … }
TEST(StructTraitsTest, BitmapSerializeInvalidRowBytes_InlineBitmap) { … }
template <typename MojomType>
static void BadColor(bool expect_crash) { … }
TEST(StructTraitsTest, BitmapSerializeInvalidColorType_BitmapN32) { … }
TEST(StructTraitsTest, BitmapSerializeInvalidColorType_BitmapWithArbitraryBpp) { … }
TEST(StructTraitsTest,
BitmapSerializeInvalidColorType_BitmapMappedFromTrustedProcess) { … }
TEST(StructTraitsTest, BitmapSerializeInvalidColorType_InlineBitmap) { … }
TEST(StructTraitsTest, BitmapDeserializeIgnoresRowBytes) { … }
TEST(StructTraitsTest, InlineBitmapDeserializeTooFewBytes) { … }
TEST(StructTraitsTest, InlineBitmapDeserializeTooManyBytes) { … }
}
}