| 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..574ea35571ada38d8dbc3eac480bdb5bebda48bf 100644
|
| --- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp
|
| +++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp
|
| @@ -86,9 +86,16 @@ 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)
|
| - ++framesDecoded;
|
| + for (size_t i = framesDecoded; i < frameCount; ++i) {
|
| + // In ICOImageDecoder memory layout could differ from frame order.
|
| + // E.g. memory layout could be |<frame1><frame0>| and frameCount
|
| + // would return 1 until receiving full file.
|
| + // When file is completely received frameCount would return 2 and
|
| + // only then both frames could be completely decoded.
|
| + ImageFrame* frame = decoder->frameBufferAtIndex(i);
|
| + if (frame && frame->getStatus() == ImageFrame::FrameComplete)
|
| + ++framesDecoded;
|
| + }
|
| }
|
|
|
| EXPECT_FALSE(decoder->failed());
|
|
|