TBR=scroggo@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=
1747423002
Review URL: https://codereview.chromium.org/
1747423002
public:
FailingStream()
: fAtEnd(false)
- , fReadAfterEnd(false)
{}
+
size_t read(void* buffer, size_t size) override {
- if (fAtEnd) {
- fReadAfterEnd = true;
- } else {
- fAtEnd = true;
- }
+ SkASSERT(!fAtEnd);
+ fAtEnd = true;
return 0;
}
return fAtEnd;
}
- bool readAfterEnd() const {
- return fReadAfterEnd;
- }
private:
bool fAtEnd;
- bool fReadAfterEnd;
};
DEF_TEST(ShortFrontBufferedStream, reporter) {
// This will fail to create a codec. However, what we really want to test is that we
// won't read past the end of the stream.
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
- REPORTER_ASSERT(reporter, !failingStream->readAfterEnd());
}