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

Unified Diff: Source/WebKit/chromium/tests/GIFImageDecoderTest.cpp

Issue 15914009: More tolerant about malformed GIF files (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: added test file Created 7 years, 7 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/WebKit/chromium/tests/data/radient-bad-terminator.gif » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/tests/GIFImageDecoderTest.cpp
diff --git a/Source/WebKit/chromium/tests/GIFImageDecoderTest.cpp b/Source/WebKit/chromium/tests/GIFImageDecoderTest.cpp
index e7e7172fde2ff5c1674af90bc0e2a7fc429499de..245fe830e7bfa5c64ceed26d31c4d81e1f3d1ef5 100644
--- a/Source/WebKit/chromium/tests/GIFImageDecoderTest.cpp
+++ b/Source/WebKit/chromium/tests/GIFImageDecoderTest.cpp
@@ -186,10 +186,10 @@ TEST(GIFImageDecoderTest, brokenSecondFrame)
ASSERT_TRUE(data.get());
decoder->setData(data.get(), true);
- EXPECT_EQ(0u, decoder->frameCount());
- ImageFrame* frame = decoder->frameBufferAtIndex(0);
+ // One frame is detected but cannot be decoded.
+ EXPECT_EQ(1u, decoder->frameCount());
+ ImageFrame* frame = decoder->frameBufferAtIndex(1);
EXPECT_FALSE(frame);
- EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount());
}
TEST(GIFImageDecoderTest, progressiveDecode)
@@ -297,6 +297,28 @@ TEST(GIFImageDecoderTest, frameIsCompleteLoading)
EXPECT_TRUE(decoder->frameIsCompleteAtIndex(1));
}
+TEST(GIFImageDecoderTest, badTerminator)
+{
+ RefPtr<SharedBuffer> referenceData = readFile("/Source/WebKit/chromium/tests/data/radient.gif");
+ RefPtr<SharedBuffer> testData = readFile("/Source/WebKit/chromium/tests/data/radient-bad-terminator.gif");
+ ASSERT_TRUE(referenceData.get());
+ ASSERT_TRUE(testData.get());
+
+ OwnPtr<GIFImageDecoder> referenceDecoder(createDecoder());
+ referenceDecoder->setData(referenceData.get(), true);
+ EXPECT_EQ(1u, referenceDecoder->frameCount());
+ ImageFrame* referenceFrame = referenceDecoder->frameBufferAtIndex(0);
+ ASSERT(referenceFrame);
+
+ OwnPtr<GIFImageDecoder> testDecoder(createDecoder());
+ testDecoder->setData(testData.get(), true);
+ EXPECT_EQ(1u, testDecoder->frameCount());
+ ImageFrame* testFrame = testDecoder->frameBufferAtIndex(0);
+ ASSERT(testFrame);
+
+ EXPECT_EQ(hashSkBitmap(referenceFrame->getSkBitmap()), hashSkBitmap(testFrame->getSkBitmap()));
+}
+
#endif
} // namespace
« no previous file with comments | « no previous file | Source/WebKit/chromium/tests/data/radient-bad-terminator.gif » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698