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

Unified Diff: Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp

Issue 25422003: Ignore unsupported disposal methods when decoding GIF (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test Created 7 years, 2 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
« no previous file with comments | « no previous file | Source/core/platform/image-decoders/gif/GIFImageReader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp
diff --git a/Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp b/Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp
index 80070dca78e429057eba5bf062260d9502507229..356be68f5ddf41cb8631329d2564805d024778cb 100644
--- a/Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp
+++ b/Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp
@@ -451,3 +451,19 @@ TEST(GIFImageDecoderTest, resumePartialDecodeAfterClearFrameBufferCache)
EXPECT_EQ(ImageFrame::FrameComplete, firstFrame->status());
EXPECT_EQ(baselineHashes[0], hashSkBitmap(firstFrame->getSkBitmap()));
}
+
+TEST(GIFImageDecoderTest, invalidDisposalMethod)
+{
+ OwnPtr<GIFImageDecoder> decoder = createDecoder();
+
+ // The image has 2 frames, with disposal method 4 and 5, respectively.
+ RefPtr<SharedBuffer> data = readFile("/Source/web/tests/data/invalid-disposal-method.gif");
+ ASSERT_TRUE(data.get());
+ decoder->setData(data.get(), true);
+
+ EXPECT_EQ(2u, decoder->frameCount());
+ // Disposal method 4 is converted to ImageFrame::DisposeOverwritePrevious.
+ EXPECT_EQ(ImageFrame::DisposeOverwritePrevious, decoder->frameBufferAtIndex(0)->disposalMethod());
+ // Disposal method 5 is ignored.
+ EXPECT_EQ(ImageFrame::DisposeNotSpecified, decoder->frameBufferAtIndex(1)->disposalMethod());
+}
« no previous file with comments | « no previous file | Source/core/platform/image-decoders/gif/GIFImageReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698