Avoid infinite loop in Codec_requiredFrame test
Prior to this commit, the test would finish (and pass) with a correct SkCodec implementation, but could infinite loop (instead of finish with failure) with an incorrect implementation. Bug: skia: Change-Id: I89e8cfef9837c50e83a23e67a40204a9478a17cb Reviewed-on: https://skia-review.googlesource.com/144740 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
This commit is contained in:
parent
fd98c2c871
commit
afea9c32ac
@ -180,7 +180,7 @@ DEF_TEST(Codec_requiredFrame, r) {
|
||||
|
||||
std::vector<SkCodec::FrameInfo> partialInfo;
|
||||
size_t frameToCompare = 0;
|
||||
for (; stream->getLength() <= file->size(); stream->addNewData(1)) {
|
||||
while (true) {
|
||||
partialInfo = partialCodec->getFrameInfo();
|
||||
for (; frameToCompare < partialInfo.size(); frameToCompare++) {
|
||||
REPORTER_ASSERT(r, partialInfo[frameToCompare].fRequiredFrame
|
||||
@ -190,6 +190,12 @@ DEF_TEST(Codec_requiredFrame, r) {
|
||||
if (frameToCompare == frameInfo.size()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (stream->getLength() == file->size()) {
|
||||
ERRORF(r, "Should have found all frames for %s", path);
|
||||
return;
|
||||
}
|
||||
stream->addNewData(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user