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

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

Issue 23646005: Improve GIF decoding performance (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: test with bad code Created 7 years, 3 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: 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 090e0d90e3062264bce92ed3317f4b03e6a7a2f8..e505e9dfe49f2311a1f5e608a51a7d63f29fc957 100644
--- a/Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp
+++ b/Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp
@@ -451,3 +451,29 @@ TEST(GIFImageDecoderTest, resumePartialDecodeAfterClearFrameBufferCache)
EXPECT_EQ(ImageFrame::FrameComplete, firstFrame->status());
EXPECT_EQ(baselineHashes[0], hashSkBitmap(firstFrame->getSkBitmap()));
}
+
+// The first LZW code in the image is invalid. Decoding should fail.
Peter Kasting 2013/09/05 06:13:01 Nit: Perhaps: The first LZW codes in the image ar
Alpha Left Google 2013/09/05 17:02:28 Done.
+TEST(GIFImageDecoderTest, badInitialCode)
+{
+ RefPtr<SharedBuffer> testData = readFile("/Source/web/tests/data/bad-initial-code.gif");
+ ASSERT_TRUE(testData.get());
+
+ OwnPtr<GIFImageDecoder> testDecoder(createDecoder());
+ testDecoder->setData(testData.get(), true);
+ EXPECT_EQ(1u, testDecoder->frameCount());
+ ASSERT_TRUE(testDecoder->frameBufferAtIndex(0));
+ EXPECT_TRUE(testDecoder->failed());
+}
+
+// Image has an invalid LZW code. Decoding should fail.
+TEST(GIFImageDecoderTest, badCode)
+{
+ RefPtr<SharedBuffer> testData = readFile("/Source/web/tests/data/bad-code.gif");
+ ASSERT_TRUE(testData.get());
+
+ OwnPtr<GIFImageDecoder> testDecoder(createDecoder());
+ testDecoder->setData(testData.get(), true);
+ EXPECT_EQ(1u, testDecoder->frameCount());
+ ASSERT_TRUE(testDecoder->frameBufferAtIndex(0));
+ EXPECT_TRUE(testDecoder->failed());
+}
« no previous file with comments | « Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp ('k') | Source/core/platform/image-decoders/gif/GIFImageReader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698