Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp |
| diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp |
| index de0dcb6788e8c2f287e2feb866cfa0321f2e304b..7e9d0cf23347076588268ba618b9a509e22c2490 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp |
| @@ -115,6 +115,16 @@ public: |
| m_image->advanceAnimation(0); |
| } |
| + int repetitionCount() |
| + { |
| + return m_image->repetitionCount(true); |
| + } |
| + |
| + int animationFinished() |
| + { |
| + return m_image->m_animationFinished; |
| + } |
| + |
| PassRefPtr<Image> imageForDefaultFrame() |
| { |
| return m_image->imageForDefaultFrame(); |
| @@ -167,6 +177,22 @@ TEST_F(BitmapImageTest, maybeAnimated) |
| EXPECT_FALSE(m_image->maybeAnimated()); |
| } |
| +TEST_F(BitmapImageTest, animationRepetitions) |
| +{ |
| + loadImage("/LayoutTests/fast/images/resources/full2loop.gif"); |
| + int expectedRepetitionCount = 2; |
| + EXPECT_EQ(expectedRepetitionCount, repetitionCount()); |
| + |
| + // We actually loop once more than stored repetition count. |
| + for (int repeat = 0; repeat < expectedRepetitionCount + 1; ++repeat) { |
|
Peter Kasting
2016/03/11 01:23:46
Nit: repeat <= expectedRepetitionCount
urvang
2016/03/11 18:32:17
Done
|
| + for (size_t i = 0; i < frameCount(); ++i) { |
| + EXPECT_FALSE(animationFinished()); |
| + advanceAnimation(); |
| + } |
| + } |
| + EXPECT_TRUE(animationFinished()); |
| +} |
| + |
| TEST_F(BitmapImageTest, isAllDataReceived) |
| { |
| RefPtr<SharedBuffer> imageData = readFile("/LayoutTests/fast/images/resources/green.jpg"); |