Chromium Code Reviews| Index: third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp |
| diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp |
| index 3c51d4d721e9ce215e416a24110b7697c9c91a37..af0d140e5fe495534adac6931a765860aa6918e1 100644 |
| --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp |
| +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp |
| @@ -86,11 +86,38 @@ void testByteByByteDecode(DecoderCreator createDecoder, const char* file, size_t |
| if (!decoder->isSizeAvailable()) |
| continue; |
| - ImageFrame* frame = decoder->frameBufferAtIndex(frameCount - 1); |
| - if (frame && frame->getStatus() == ImageFrame::FrameComplete && framesDecoded < frameCount) |
| + bool frameIsFullyReceived = decoder->frameIsFullyReceivedAtIndex(framesDecoded); |
|
aleksandar.stojiljkovic
2016/06/06 14:26:39
The change here is that we decode frames one after
|
| + for (size_t i = 0; i < framesDecoded; ++i) { |
| + ASSERT_TRUE(decoder->frameIsFullyReceivedAtIndex(i)); |
| + } |
| + |
| + ImageFrame* frame = decoder->frameBufferAtIndex(framesDecoded); |
| + |
| + if (frameIsFullyReceived) |
| + ASSERT_TRUE(decoder->frameIsCompleteAtIndex(framesDecoded) || decoder->failed()); |
| + if (!decoder->frameIsCompleteAtIndex(framesDecoded) && !decoder->failed()) |
|
aleksandar.stojiljkovic
2016/06/06 14:26:38
Broken logic here - fullyReceived = trye for parti
|
| + ASSERT_FALSE(decoder->frameIsFullyReceivedAtIndex(framesDecoded)); |
| + |
| + ASSERT_FALSE(decoder->frameIsCompleteAtIndex(frameCount)); |
| + |
| + if (frame && frame->getStatus() == ImageFrame::FrameComplete) { |
| ++framesDecoded; |
| + } |
| } |
| + for (size_t i = framesDecoded; i < frameCount; ++i) { |
| + // ICO frames order doesn't match the order of frames as in memory |
| + // and multiple frames can be completely decoded only when file is |
| + // fully received. |
| + // Attempt here to decode frames that were not decoded in the loop above, |
| + // while the file content was partially available. |
| + ASSERT_TRUE(decoder->frameIsFullyReceivedAtIndex(i)); |
| + ImageFrame* frame = decoder->frameBufferAtIndex(i); |
| + if (frame && frame->getStatus() == ImageFrame::FrameComplete) |
|
aleksandar.stojiljkovic
2016/06/06 14:26:38
"&& framesDecoded < frameCount" was reequired for
|
| + ++framesDecoded; |
| + } |
| + |
| + |
|
aleksandar.stojiljkovic
2016/06/06 14:26:38
Removed this newline.
|
| EXPECT_FALSE(decoder->failed()); |
| EXPECT_EQ(expectedFrameCount, decoder->frameCount()); |
| EXPECT_EQ(expectedFrameCount, framesDecoded); |