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

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

Issue 1769343002: GIF decoding: Add a unit test for repetition count (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@test_file
Patch Set: Revert code change; test existing behavior instead Created 4 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
index 88164b1a16260d92e972e6c35d53e2604f24e988..de57fd4d58f515122948bd22398a2057725598e9 100644
--- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp
@@ -500,4 +500,21 @@ TEST(GIFImageDecoderTest, firstFrameHasGreaterSizeThanScreenSize)
}
}
+TEST(GIFImageDecoderTest, verifyRepetitionCount)
+{
+ const int expectedRepetitionCount = 2;
+ OwnPtr<ImageDecoder> decoder = createDecoder();
+ RefPtr<SharedBuffer> data = readFile(layoutTestResourcesDir, "full2loop.gif");
+ ASSERT_TRUE(data.get());
+ decoder->setData(data.get(), true);
+ EXPECT_EQ(cAnimationLoopOnce, decoder->repetitionCount()); // Default value before decode.
+
+ ImageFrame* frame = decoder->frameBufferAtIndex(0);
+ EXPECT_EQ(ImageFrame::FrameComplete, frame->getStatus());
+ frame = decoder->frameBufferAtIndex(1);
+ EXPECT_EQ(ImageFrame::FrameComplete, frame->getStatus());
+
Noel Gordon 2016/03/11 00:39:50 Are there 2, or 3, frames in the test GIF image?
urvang 2016/03/11 01:13:49 Yes, there are 3 frames, with repetition count of
+ EXPECT_EQ(expectedRepetitionCount, decoder->repetitionCount()); // Expected value after decode.
+}
+
} // namespace blink
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698