Revert of Add test for new FrontBufferedStream behavior. (patchset #1 id:1 of https://codereview.chromium.org/641813009/)
Reason for revert:
Test is SkASSERTing on Macs, e.g:
http://chromegw.corp.google.com/i/client.skia/builders/Test-Mac10.6-MacMini4.1-GeForce320M-x86_64-Debug/builds/257/steps/dm/logs/stdio
210 tasks left 1737M peak 1ms test FrontBufferedStream../../src/ports/SkImageDecoder_CG.cpp:43: failed assertion "data"
Signal 11:
_sigtramp (+0x1a)
SkStreamToCGImageSource(SkStream*) (+0x62)
SkImageDecoder_CG::onDecode(SkStream*, SkBitmap*, SkImageDecoder::Mode) (+0x2e)
SkImageDecoder::decode(SkStream*, SkBitmap*, SkColorType, SkImageDecoder::Mode) (+0x81)
SkImageDecoder::DecodeStream(SkStreamRewindable*, SkBitmap*, SkColorType, SkImageDecoder::Mode, SkImageDecoder::Format*) (+0xff)
SkImageDecoder::DecodeStream(SkStreamRewindable*, SkBitmap*) (+0x31)
test_ShortFrontBufferedStream(skiatest::Reporter*) (+0x97)
skiatest::ShortFrontBufferedStreamClass::onRun(skiatest::Reporter*) (+0x19)
skiatest::Test::run() (+0x7c)
DM::CpuTestTask::draw() (+0x5a)
DM::CpuTask::run() (+0x9e)
non-virtual thunk to DM::CpuTask::run() (+0x1c)
(anonymous namespace)::ThreadPool::Loop(void*) (+0xf4)
thread_start(void*) (+0x54)
_pthread_start (+0x14b)
Original issue's description:
> Add test for new FrontBufferedStream behavior.
>
> Test for https://skia.googlesource.com/skia/+/dd5a1e094c19fa10202c37c50a1f799e5af5dac0
>
> Verify that FrontBufferedStream does not attempt to read beyond the
> end of its underlying stream.
>
> Committed: https://skia.googlesource.com/skia/+/da59f05c6738dbb9a92cad21c608cdfae53a76b2
TBR=reed@google.com,scroggo@google.com
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/649553003
diff --git a/tests/FrontBufferedStreamTest.cpp b/tests/FrontBufferedStreamTest.cpp
index e8c2c6a..cb11b12 100644
--- a/tests/FrontBufferedStreamTest.cpp
+++ b/tests/FrontBufferedStreamTest.cpp
@@ -5,9 +5,7 @@
* found in the LICENSE file.
*/
-#include "SkBitmap.h"
#include "SkFrontBufferedStream.h"
-#include "SkImageDecoder.h"
#include "SkRefCnt.h"
#include "SkStream.h"
#include "SkTypes.h"
@@ -251,45 +249,3 @@
test_buffers(reporter, 15);
test_buffers(reporter, 64);
}
-
-// Test that a FrontBufferedStream does not allow reading after the end of a stream.
-// This class is a dummy SkStream which reports that it is at the end on the first
-// read (simulating a failure). Then it tracks whether someone calls read() again.
-class FailingStream : public SkStream {
-public:
- FailingStream()
- : fAtEnd(false)
- , fReadAfterEnd(false)
- {}
- virtual size_t read(void* buffer, size_t size) SK_OVERRIDE {
- if (fAtEnd) {
- fReadAfterEnd = true;
- } else {
- fAtEnd = true;
- }
- return 0;
- }
-
- virtual bool isAtEnd() const SK_OVERRIDE {
- return fAtEnd;
- }
-
- bool readAfterEnd() const {
- return fReadAfterEnd;
- }
-private:
- bool fAtEnd;
- bool fReadAfterEnd;
-};
-
-DEF_TEST(ShortFrontBufferedStream, reporter) {
- FailingStream failingStream;
- SkAutoTUnref<SkStreamRewindable> stream(SkFrontBufferedStream::Create(&failingStream, 64));
- SkBitmap bm;
- // The return value of DecodeStream is not important. We are just using DecodeStream because
- // it simulates a bug. DecodeStream will read the stream, then rewind, then attempt to read
- // again. FrontBufferedStream::read should not continue to read its underlying stream beyond
- // its end.
- SkImageDecoder::DecodeStream(stream, &bm);
- REPORTER_ASSERT(reporter, !failingStream.readAfterEnd());
-}