aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/FrontBufferedStreamTest.cpp
Commit message (Collapse)AuthorAge
* detach -> releaseGravatar mtklein2016-03-16
| | | | | | | | | | | | | The C++ standard library uses the name "release" for the operation we call "detach". Rewriting each "detach(" to "release(" brings us a step closer to using standard library types directly (e.g. std::unique_ptr instead of SkAutoTDelete). This was a fairly blind transformation. There may have been unintentional conversions in here, but it's probably for the best to have everything uniformly say "release". BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1809733002 Review URL: https://codereview.chromium.org/1809733002
* Fix FrontBufferedStreamTestGravatar msarett2016-03-01
| | | | | | | | | 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
* Fix bug in SkGifCodec / Switch SkImageDec tests to use CodecGravatar msarett2016-03-01
| | | | | | | | | | | | SkImageDecoder is still used throughout tests, tools, gms etc. Deleting it from tests is an easy first step. Bonus is that we add tests of SkCodec. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1733863003 Review URL: https://codereview.chromium.org/1733863003
* Remove position from FrontBufferedStreamGravatar scroggo2016-02-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When FrontBufferedStream was written, it implemented getPosition() and returned true for hasPosition(). The CL that introduced it (crrev.com/23717055) does not have any indication why, but I'm guessing it was because it was easy to implement. None of our decoders rely on this (only some tests do). Now that we have a decoder (SkRawCodec) that expects to be able to seek a stream if it has a position (which makes sense - SkStream.h associates that with SkStreamSeekable, and there is no other way to check to see if a stream is seekable), it is failing because FrontBufferedStream reports it has a position and the decoder tries to seek. Remove FrontBufferedStream::hasPosition() (reverting to the default, false) and ::getPosition() (so it will return 0). Fix tests - do not call FrontBufferedStream::getPosition() Update CodexTest to test using an FrontBufferedStream, like Android does. BUG=b/27218441 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1703293002 Review URL: https://codereview.chromium.org/1703293002
* Style Change: SkNEW->new; SkDELETE->deleteGravatar halcanary2015-08-26
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316123003 Review URL: https://codereview.chromium.org/1316123003
* C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla}Gravatar mtklein2015-03-25
| | | | | | | | | NOPRESUBMIT=true BUG=skia: DOCS_PREVIEW= https://skia.org/?cl=1037793002 Review URL: https://codereview.chromium.org/1037793002
* Make SkStream *not* ref counted.Gravatar scroggo2015-01-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SkStream is a stateful object, so it does not make sense for it to have multiple owners. Make SkStream inherit directly from SkNoncopyable. Update methods which previously called SkStream::ref() (e.g. SkImageDecoder::buildTileIndex() and SkFrontBufferedStream::Create(), which required the existing owners to call SkStream::unref()) to take ownership of their SkStream parameters and delete when done (including on failure). Switch all SkAutoTUnref<SkStream>s to SkAutoTDelete<SkStream>s. In some cases this means heap allocating streams that were previously stack allocated. Respect ownership rules of SkTypeface::CreateFromStream() and SkImageDecoder::buildTileIndex(). Update the comments for exceptional methods which do not affect the ownership of their SkStream parameters (e.g. SkPicture::CreateFromStream() and SkTypeface::Deserialize()) to be explicit about ownership. Remove test_stream_life, which tested that buildTileIndex() behaved correctly when SkStream was a ref counted object. The test does not make sense now that it is not. In SkPDFStream, remove the SkMemoryStream member. Instead of using it, create a new SkMemoryStream to pass to fDataStream (which is now an SkAutoTDelete). Make other pdf rasterizers behave like SkPDFDocumentToBitmap. SkPDFDocumentToBitmap delete the SkStream, so do the same in the following pdf rasterizers: SkPopplerRasterizePDF SkNativeRasterizePDF SkNoRasterizePDF Requires a change to Android, which currently treats SkStreams as ref counted objects. Review URL: https://codereview.chromium.org/849103004
* Fix up all the easy virtual ... SK_OVERRIDE cases.Gravatar mtklein2015-01-09
| | | | | | | | | | | | This fixes every case where virtual and SK_OVERRIDE were on the same line, which should be the bulk of cases. We'll have to manually clean up the rest over time unless I level up in regexes. for f in (find . -type f); perl -p -i -e 's/virtual (.*)SK_OVERRIDE/\1SK_OVERRIDE/g' $f; end BUG=skia: Review URL: https://codereview.chromium.org/806653007
* Add test for new FrontBufferedStream behavior.Gravatar scroggo2014-10-24
| | | | | | | | | | | Test for https://skia.googlesource.com/skia/+/dd5a1e094c19fa10202c37c50a1f799e5af5dac0 Verify that FrontBufferedStream does not attempt to read beyond the end of its underlying stream. Make SkStreamToCGImageSource handle an empty stream better. Review URL: https://codereview.chromium.org/641813009
* Revert of Add test for new FrontBufferedStream behavior. (patchset #1 id:1 ↵Gravatar mtklein2014-10-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add test for new FrontBufferedStream behavior.Gravatar scroggo2014-10-23
| | | | | | | | | Test for https://skia.googlesource.com/skia/+/dd5a1e094c19fa10202c37c50a1f799e5af5dac0 Verify that FrontBufferedStream does not attempt to read beyond the end of its underlying stream. Review URL: https://codereview.chromium.org/641813009
* Use SkToBool to fix a warning.Gravatar commit-bot@chromium.org2014-02-10
| | | | | | | | | | | NOTRY=true TBR=djsollen@google.com Author: scroggo@google.com Review URL: https://codereview.chromium.org/159333002 git-svn-id: http://skia.googlecode.com/svn/trunk@13389 2bbb7eff-a529-9590-31e7-b0007b416f81
* Allow buffered stream to work with an offset.Gravatar commit-bot@chromium.org2014-02-10
| | | | | | | | | | | | | | If the stream being buffered is buffered from somewhere other than the start, the SkFrontBufferedStream needs to take that into account when reporting its length. R=djsollen@google.com, bungeman@google.com, reed@google.com Author: scroggo@google.com Review URL: https://codereview.chromium.org/157103002 git-svn-id: http://skia.googlecode.com/svn/trunk@13388 2bbb7eff-a529-9590-31e7-b0007b416f81
* Cleanup: Sanitize the order of includes under tests/Gravatar tfarina@chromium.org2014-01-24
| | | | | | | | | | | | | | | | Initially this was to make sure Test.h appeared after the Sk*.h includes. Patch generated by the following command line: $ ~/chromium/src/tools/sort-headers.py tests/*.cpp BUG=None TEST=tests R=robertphillips@google.com Review URL: https://codereview.chromium.org/145313004 git-svn-id: http://skia.googlecode.com/svn/trunk@13177 2bbb7eff-a529-9590-31e7-b0007b416f81
* Move macros from TestClassDef.h to Test.hGravatar commit-bot@chromium.org2014-01-14
| | | | | | | | | | | | | | Motivation: those macros don't make any sense without the definitions in Test.h. BUG= R=mtklein@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/138563004 git-svn-id: http://skia.googlecode.com/svn/trunk@13074 2bbb7eff-a529-9590-31e7-b0007b416f81
* Use DEFINE_TESTCLASS_SHORT macro in tests.Gravatar tfarina@chromium.org2013-12-12
| | | | | | | | | | | | | The three version of DEFINE_TESTCLASS macro is deprecated and thus just use the simple, short one. BUG=None TEST=out/Debug/tests R=mtklein@google.com, bsalomon@google.com, robertphillips@google.com Review URL: https://codereview.chromium.org/100113004 git-svn-id: http://skia.googlecode.com/svn/trunk@12653 2bbb7eff-a529-9590-31e7-b0007b416f81
* Hide implementation details: SkFrontBufferedStreamGravatar scroggo@google.com2013-11-12
| | | | | | | | R=reed@google.com Review URL: https://codereview.chromium.org/25581002 git-svn-id: http://skia.googlecode.com/svn/trunk@12256 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add a buffered SkStream class.Gravatar scroggo@google.com2013-09-26
This is used by Android to buffer an input stream which may not otherwise be able to rewind. Add a test for the new class. R=bungeman@google.com, mtklein@google.com, reed@google.com Review URL: https://codereview.chromium.org/23717055 git-svn-id: http://skia.googlecode.com/svn/trunk@11488 2bbb7eff-a529-9590-31e7-b0007b416f81