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

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: Review #23 fix - comments. cleanup. Thanks Leon. Created 4 years, 6 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
92 // FIXME: libwebp parsing of crbug.364830.webp doesn't mark the frame
scroggo_chromium 2016/05/24 19:34:11 We know the file name. Should we special case furt
aleksandar.stojiljkovic 2016/06/06 14:26:38 Written the check differently.
93 // as complete two bytes before the end of the file. However, decoding
94 // it to the same point produces completely decoded frame.
95 if (decoder->filenameExtension() != "webp" || frameIsFullyReceived)
96 EXPECT_EQ(frameIsFullyReceived, decoder->frameIsCompleteAtIndex(fram eCount - 1) || decoder->failed());
Peter Kasting 2016/05/25 01:05:23 Isn't this test fundamentally incorrect? It's che
aleksandar.stojiljkovic 2016/05/30 16:12:19 This test checks that frameIsFullyReceivedAtIndex
Peter Kasting 2016/05/31 03:46:42 If you want to check that, isn't the correct test
aleksandar.stojiljkovic 2016/06/01 22:47:35 For other than WebP it is important to check that
aleksandar.stojiljkovic 2016/06/01 22:47:35 Decoder get to know this in setData() which is cal
aleksandar.stojiljkovic 2016/06/06 14:26:38 You have the point here. Written the the check lik
97
90 if (frame && frame->getStatus() == ImageFrame::FrameComplete && framesDe coded < frameCount) 98 if (frame && frame->getStatus() == ImageFrame::FrameComplete && framesDe coded < frameCount)
91 ++framesDecoded; 99 ++framesDecoded;
92 } 100 }
93 101
94 EXPECT_FALSE(decoder->failed()); 102 EXPECT_FALSE(decoder->failed());
95 EXPECT_EQ(expectedFrameCount, decoder->frameCount()); 103 EXPECT_EQ(expectedFrameCount, decoder->frameCount());
96 EXPECT_EQ(expectedFrameCount, framesDecoded); 104 EXPECT_EQ(expectedFrameCount, framesDecoded);
97 EXPECT_EQ(expectedRepetitionCount, decoder->repetitionCount()); 105 EXPECT_EQ(expectedRepetitionCount, decoder->repetitionCount());
98 106
99 ASSERT_EQ(expectedFrameCount, baselineHashes.size()); 107 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. 140 // data in a segment, its pointer would no longer be valid.
133 segmentedData->data(); 141 segmentedData->data();
134 142
135 ImageFrame* frame = decoder->frameBufferAtIndex(0); 143 ImageFrame* frame = decoder->frameBufferAtIndex(0);
136 ASSERT_FALSE(decoder->failed()); 144 ASSERT_FALSE(decoder->failed());
137 EXPECT_EQ(frame->getStatus(), ImageFrame::FrameComplete); 145 EXPECT_EQ(frame->getStatus(), ImageFrame::FrameComplete);
138 EXPECT_EQ(hashBitmap(frame->bitmap()), hash); 146 EXPECT_EQ(hashBitmap(frame->bitmap()), hash);
139 } 147 }
140 148
141 } // namespace blink 149 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698