aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/FrontBufferedStreamTest.cpp
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@google.com>2014-10-23 12:08:03 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-23 12:08:03 -0700
commit404eb87993d557cffb9f76bedf42edef0ed5280f (patch)
tree935c1336ac94ff1b2828e18890f100c8b4abaf94 /tests/FrontBufferedStreamTest.cpp
parent73f105345066b1f22f15ba6575cb3800dd9313b8 (diff)
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
Diffstat (limited to 'tests/FrontBufferedStreamTest.cpp')
-rw-r--r--tests/FrontBufferedStreamTest.cpp44
1 files changed, 0 insertions, 44 deletions
diff --git a/tests/FrontBufferedStreamTest.cpp b/tests/FrontBufferedStreamTest.cpp
index e8c2c6a678..cb11b12de8 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 @@ DEF_TEST(FrontBufferedStream, reporter) {
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());
-}