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>
diff --git a/tests/CodecPartialTest.cpp b/tests/CodecPartialTest.cpp
index 0c5e614..c5bb214 100644
--- a/tests/CodecPartialTest.cpp
+++ b/tests/CodecPartialTest.cpp
@@ -180,7 +180,7 @@
 
     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 @@
         if (frameToCompare == frameInfo.size()) {
             break;
         }
+
+        if (stream->getLength() == file->size()) {
+            ERRORF(r, "Should have found all frames for %s", path);
+            return;
+        }
+        stream->addNewData(1);
     }
 }