From 404eb87993d557cffb9f76bedf42edef0ed5280f Mon Sep 17 00:00:00 2001 From: mtklein Date: Thu, 23 Oct 2014 12:08:03 -0700 Subject: 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 --- tests/FrontBufferedStreamTest.cpp | 44 --------------------------------------- 1 file changed, 44 deletions(-) (limited to 'tests/FrontBufferedStreamTest.cpp') 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 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()); -} -- cgit v1.2.3