Fix FrontBufferedStreamTest
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
This commit is contained in:
parent
3d5d9ac426
commit
b9e56c1ee6
@ -263,14 +263,11 @@ class FailingStream : public SkStream {
|
|||||||
public:
|
public:
|
||||||
FailingStream()
|
FailingStream()
|
||||||
: fAtEnd(false)
|
: fAtEnd(false)
|
||||||
, fReadAfterEnd(false)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
size_t read(void* buffer, size_t size) override {
|
size_t read(void* buffer, size_t size) override {
|
||||||
if (fAtEnd) {
|
SkASSERT(!fAtEnd);
|
||||||
fReadAfterEnd = true;
|
|
||||||
} else {
|
|
||||||
fAtEnd = true;
|
fAtEnd = true;
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,12 +275,8 @@ public:
|
|||||||
return fAtEnd;
|
return fAtEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool readAfterEnd() const {
|
|
||||||
return fReadAfterEnd;
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
bool fAtEnd;
|
bool fAtEnd;
|
||||||
bool fReadAfterEnd;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DEF_TEST(ShortFrontBufferedStream, reporter) {
|
DEF_TEST(ShortFrontBufferedStream, reporter) {
|
||||||
@ -293,5 +286,4 @@ DEF_TEST(ShortFrontBufferedStream, reporter) {
|
|||||||
// This will fail to create a codec. However, what we really want to test is that we
|
// 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.
|
// won't read past the end of the stream.
|
||||||
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
|
SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
|
||||||
REPORTER_ASSERT(reporter, !failingStream->readAfterEnd());
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user