Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/ImageDecoderTestHelpers.cpp

Issue 1962563002: Fix ImageDecoder::frameIsCompleteAtIndex - fully received instead of decoded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert hasSeenAlpha approach in webp & png. bytebybyte unit tests. fixes. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698