| Index: ui/gfx/codec/png_codec_unittest.cc
|
| diff --git a/ui/gfx/codec/png_codec_unittest.cc b/ui/gfx/codec/png_codec_unittest.cc
|
| index faf665d670847e0536356aa51e075322ad6462f0..986d187d193b88ffe409c176a67dc94ecf6a0e59 100644
|
| --- a/ui/gfx/codec/png_codec_unittest.cc
|
| +++ b/ui/gfx/codec/png_codec_unittest.cc
|
| @@ -286,10 +286,11 @@ TEST(PNGCodec, EncodeDecodeRGBA) {
|
|
|
| // encode
|
| std::vector<unsigned char> encoded;
|
| - ASSERT_TRUE(PNGCodec::Encode(&original[0], PNGCodec::FORMAT_RGBA,
|
| - Size(w, h), w * 4, false,
|
| - std::vector<PNGCodec::Comment>(),
|
| - &encoded));
|
| + SkImageInfo info =
|
| + SkImageInfo::Make(w, h, kRGBA_8888_SkColorType, kUnpremul_SkAlphaType);
|
| + SkPixmap src(info, &original[0], w * 4);
|
| + ASSERT_TRUE(
|
| + PNGCodec::Encode(src, std::vector<PNGCodec::Comment>(), &encoded));
|
|
|
| // decode, it should have the same size as the original
|
| std::vector<unsigned char> decoded;
|
| @@ -315,10 +316,11 @@ TEST(PNGCodec, EncodeDecodeBGRA) {
|
|
|
| // Encode.
|
| std::vector<unsigned char> encoded;
|
| - ASSERT_TRUE(PNGCodec::Encode(&original[0], PNGCodec::FORMAT_BGRA,
|
| - Size(w, h), w * 4, false,
|
| - std::vector<PNGCodec::Comment>(),
|
| - &encoded));
|
| + SkImageInfo info =
|
| + SkImageInfo::Make(w, h, kBGRA_8888_SkColorType, kUnpremul_SkAlphaType);
|
| + SkPixmap src(info, &original[0], w * 4);
|
| + ASSERT_TRUE(
|
| + PNGCodec::Encode(src, std::vector<PNGCodec::Comment>(), &encoded));
|
|
|
| // Decode, it should have the same size as the original.
|
| std::vector<unsigned char> decoded;
|
| @@ -749,9 +751,11 @@ TEST(PNGCodec, DecodeCorrupted) {
|
|
|
| // Make some compressed data.
|
| std::vector<unsigned char> compressed;
|
| - ASSERT_TRUE(PNGCodec::Encode(&original[0], PNGCodec::FORMAT_RGBA, Size(w, h),
|
| - w * 4, false, std::vector<PNGCodec::Comment>(),
|
| - &compressed));
|
| + SkImageInfo info =
|
| + SkImageInfo::Make(w, h, kRGBA_8888_SkColorType, kUnpremul_SkAlphaType);
|
| + SkPixmap src(info, &original[0], w * 4);
|
| + ASSERT_TRUE(
|
| + PNGCodec::Encode(src, std::vector<PNGCodec::Comment>(), &compressed));
|
|
|
| // Try decompressing a truncated version.
|
| EXPECT_FALSE(PNGCodec::Decode(&compressed[0], compressed.size() / 2,
|
| @@ -908,8 +912,10 @@ TEST(PNGCodec, EncodeWithComment) {
|
| comments.push_back(PNGCodec::Comment("key", "text"));
|
| comments.push_back(PNGCodec::Comment("test", "something"));
|
| comments.push_back(PNGCodec::Comment("have some", "spaces in both"));
|
| - EXPECT_TRUE(PNGCodec::Encode(&original[0], PNGCodec::FORMAT_RGBA, Size(w, h),
|
| - w * 4, false, comments, &encoded));
|
| + SkImageInfo info =
|
| + SkImageInfo::Make(w, h, kRGBA_8888_SkColorType, kUnpremul_SkAlphaType);
|
| + SkPixmap src(info, &original[0], w * 4);
|
| + EXPECT_TRUE(PNGCodec::Encode(src, comments, &encoded));
|
|
|
| // Each chunk is of the form length (4 bytes), chunk type (tEXt), data,
|
| // checksum (4 bytes). Make sure we find all of them in the encoded
|
|
|