Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: ui/gfx/codec/jpeg_codec_unittest.cc

Issue 2895953003: Use SkJpegEncoder in gfx jpeg_codec (Closed)
Patch Set: Remove brackets Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gfx/codec/jpeg_codec_unittest.cc
diff --git a/ui/gfx/codec/jpeg_codec_unittest.cc b/ui/gfx/codec/jpeg_codec_unittest.cc
index 9c4c8f1dd83e3a390f93d8222f36024748d836e7..f97206af2210d9c289509141976abbf6cdc81f15 100644
--- a/ui/gfx/codec/jpeg_codec_unittest.cc
+++ b/ui/gfx/codec/jpeg_codec_unittest.cc
@@ -111,8 +111,10 @@ TEST(JPEGCodec, EncodeDecodeRGBA) {
// encode, making sure it was compressed some
std::vector<unsigned char> encoded;
- EXPECT_TRUE(JPEGCodec::Encode(&original[0], JPEGCodec::FORMAT_RGBA, w, h,
- w * 4, jpeg_quality, &encoded));
+ SkImageInfo info =
+ SkImageInfo::Make(w, h, kRGBA_8888_SkColorType, kOpaque_SkAlphaType);
+ SkPixmap src(info, &original[0], w * 4);
+ EXPECT_TRUE(JPEGCodec::Encode(src, jpeg_quality, &encoded));
EXPECT_GT(original.size(), encoded.size());
// decode, it should have the same size as the original
@@ -147,8 +149,10 @@ TEST(JPEGCodec, DecodeCorrupted) {
// make some compressed data
std::vector<unsigned char> compressed;
- ASSERT_TRUE(JPEGCodec::Encode(&original[0], JPEGCodec::FORMAT_RGBA, w, h,
- w * 3, jpeg_quality, &compressed));
+ SkImageInfo info =
+ SkImageInfo::Make(w, h, kRGBA_8888_SkColorType, kOpaque_SkAlphaType);
+ SkPixmap src(info, &original[0], w * 4);
+ ASSERT_TRUE(JPEGCodec::Encode(src, jpeg_quality, &compressed));
// try decompressing a truncated version
ASSERT_FALSE(JPEGCodec::Decode(&compressed[0], compressed.size() / 2,

Powered by Google App Engine
This is Rietveld 408576698