Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/image-decoders/ImageDecoderTestHelpers.h" | 5 #include "platform/image-decoders/ImageDecoderTestHelpers.h" |
| 6 | 6 |
| 7 #include "platform/SharedBuffer.h" | 7 #include "platform/SharedBuffer.h" |
| 8 #include "platform/image-decoders/ImageDecoder.h" | 8 #include "platform/image-decoders/ImageDecoder.h" |
| 9 #include "platform/image-decoders/ImageFrame.h" | 9 #include "platform/image-decoders/ImageFrame.h" |
| 10 #include "platform/testing/UnitTestHelpers.h" | 10 #include "platform/testing/UnitTestHelpers.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 sourceData[1]->append(source++, 1u); | 79 sourceData[1]->append(source++, 1u); |
| 80 // Alternate the buffers to cover the JPEGImageDecoder::onSetData restar t code. | 80 // Alternate the buffers to cover the JPEGImageDecoder::onSetData restar t code. |
| 81 decoder->setData(sourceData[length & 1].get(), length == data->size()); | 81 decoder->setData(sourceData[length & 1].get(), length == data->size()); |
| 82 | 82 |
| 83 EXPECT_LE(frameCount, decoder->frameCount()); | 83 EXPECT_LE(frameCount, decoder->frameCount()); |
| 84 frameCount = decoder->frameCount(); | 84 frameCount = decoder->frameCount(); |
| 85 | 85 |
| 86 if (!decoder->isSizeAvailable()) | 86 if (!decoder->isSizeAvailable()) |
| 87 continue; | 87 continue; |
| 88 | 88 |
| 89 bool frameIsFullyReceived = decoder->frameIsFullyReceivedAtIndex(frameCo unt - 1); | |
| 89 ImageFrame* frame = decoder->frameBufferAtIndex(frameCount - 1); | 90 ImageFrame* frame = decoder->frameBufferAtIndex(frameCount - 1); |
| 91 if (decoder->filenameExtension() != "webp" || frameIsFullyReceived) | |
|
aleksandar.stojiljkovic
2016/05/22 15:41:53
The check is conservative - when frameIsFullyRecei
scroggo_chromium
2016/05/23 16:40:42
I'm still not convinced that that is the case. See
aleksandar.stojiljkovic
2016/05/24 11:08:24
Looks like the fix would go to libwebp. I'll check
scroggo_chromium
2016/05/24 13:55:14
Please add a comment explaining why you need to sp
aleksandar.stojiljkovic
2016/05/24 19:24:34
Done.
| |
| 92 EXPECT_EQ(frameIsFullyReceived, decoder->frameIsCompleteAtIndex(fram eCount - 1) || decoder->failed()); | |
| 90 if (frame && frame->getStatus() == ImageFrame::FrameComplete && framesDe coded < frameCount) | 93 if (frame && frame->getStatus() == ImageFrame::FrameComplete && framesDe coded < frameCount) |
| 91 ++framesDecoded; | 94 ++framesDecoded; |
| 92 } | 95 } |
| 93 | 96 |
| 94 EXPECT_FALSE(decoder->failed()); | 97 EXPECT_FALSE(decoder->failed()); |
| 95 EXPECT_EQ(expectedFrameCount, decoder->frameCount()); | 98 EXPECT_EQ(expectedFrameCount, decoder->frameCount()); |
| 96 EXPECT_EQ(expectedFrameCount, framesDecoded); | 99 EXPECT_EQ(expectedFrameCount, framesDecoded); |
| 97 EXPECT_EQ(expectedRepetitionCount, decoder->repetitionCount()); | 100 EXPECT_EQ(expectedRepetitionCount, decoder->repetitionCount()); |
| 98 | 101 |
| 99 ASSERT_EQ(expectedFrameCount, baselineHashes.size()); | 102 ASSERT_EQ(expectedFrameCount, baselineHashes.size()); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 // data in a segment, its pointer would no longer be valid. | 135 // data in a segment, its pointer would no longer be valid. |
| 133 segmentedData->data(); | 136 segmentedData->data(); |
| 134 | 137 |
| 135 ImageFrame* frame = decoder->frameBufferAtIndex(0); | 138 ImageFrame* frame = decoder->frameBufferAtIndex(0); |
| 136 ASSERT_FALSE(decoder->failed()); | 139 ASSERT_FALSE(decoder->failed()); |
| 137 EXPECT_EQ(frame->getStatus(), ImageFrame::FrameComplete); | 140 EXPECT_EQ(frame->getStatus(), ImageFrame::FrameComplete); |
| 138 EXPECT_EQ(hashBitmap(frame->bitmap()), hash); | 141 EXPECT_EQ(hashBitmap(frame->bitmap()), hash); |
| 139 } | 142 } |
| 140 | 143 |
| 141 } // namespace blink | 144 } // namespace blink |
| OLD | NEW |