Chromium Code Reviews| Index: Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp |
| diff --git a/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp b/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp |
| index db39a29bfc4c3c35fdb767c8285ea3a882eae7cd..ae2f2c89cf33364af0d52aadb95de116eb8806e6 100644 |
| --- a/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp |
| +++ b/Source/platform/image-decoders/gif/GIFImageDecoderTest.cpp |
| @@ -499,3 +499,27 @@ TEST(GIFImageDecoderTest, invalidDisposalMethod) |
| // Disposal method 5 is ignored. |
| EXPECT_EQ(ImageFrame::DisposeNotSpecified, decoder->frameBufferAtIndex(1)->disposalMethod()); |
| } |
| + |
| +TEST(GIFImageDecoderTest, firstFrameHasGreaterSizeThanScreenSize) |
| +{ |
| + RefPtr<SharedBuffer> fullData = readFile("/Source/platform/image-decoders/testing/first-frame-has-greater-size-than-screen-size.gif"); |
|
Stephen White
2015/01/14 22:17:02
Not new to this CL, but we should probably shorten
Alpha Left Google
2015/01/14 23:14:59
Done.
|
| + ASSERT_TRUE(fullData.get()); |
| + |
| + OwnPtr<GIFImageDecoder> decoder; |
| + IntSize frameSize; |
| + |
| + // Compute hashes when the file is truncated. |
| + for (size_t i = 1; i <= fullData->size(); ++i) { |
| + decoder = createDecoder(); |
| + RefPtr<SharedBuffer> data = SharedBuffer::create(fullData->data(), i); |
| + decoder->setData(data.get(), i == fullData->size()); |
| + |
| + if (decoder->isSizeAvailable() && !frameSize.width() && !frameSize.height()) { |
| + frameSize = decoder->decodedSize(); |
| + continue; |
| + } |
| + |
| + ASSERT_EQ(frameSize.width(), decoder->decodedSize().width()); |
| + ASSERT_EQ(frameSize.height(), decoder->decodedSize().height()); |
| + } |
| +} |