• Home
  • Raw
  • Download

Lines Matching +full:get +full:- +full:stream

4  * Use of this source code is governed by a BSD-style license that can be
25 const size_t bytesRead = bufferedStream->read(storage.get(), bytesToRead); in test_read()
26 REPORTER_ASSERT(reporter, bytesRead == bytesToRead || bufferedStream->isAtEnd()); in test_read()
27 REPORTER_ASSERT(reporter, memcmp(storage.get(), expectations, bytesRead) == 0); in test_read()
32 const bool success = bufferedStream->rewind(); in test_rewind()
36 // Test that hasLength() returns the correct value, based on the stream
37 // being wrapped. A length can only be known if the wrapped stream has a
55 // Tests reading the stream across boundaries of what has been buffered so far and what
59 // wrapped stream, but that's okay because we know the wrapping stream has not been in test_incremental_buffering()
69 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize / 2); in test_incremental_buffering()
73 test_rewind(reporter, bufferedStream.get(), true); in test_incremental_buffering()
74 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize / 4); in test_incremental_buffering()
77 test_read(reporter, bufferedStream.get(), gAbcs + bufferSize / 4, bufferSize / 2); in test_incremental_buffering()
80 // reading directly from the stream. in test_incremental_buffering()
81 test_rewind(reporter, bufferedStream.get(), true); in test_incremental_buffering()
82 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize << 1); in test_incremental_buffering()
85 // This test assumes that the stream is larger than the buffer; otherwise the in test_incremental_buffering()
87 test_rewind(reporter, bufferedStream.get(), false); in test_incremental_buffering()
97 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize); in test_perfectly_sized_buffer()
100 test_rewind(reporter, bufferedStream.get(), true); in test_perfectly_sized_buffer()
103 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize); in test_perfectly_sized_buffer()
106 test_read(reporter, bufferedStream.get(), gAbcs + memStream->getPosition(), 1); in test_perfectly_sized_buffer()
107 test_rewind(reporter, bufferedStream.get(), false); in test_perfectly_sized_buffer()
117 bufferedStream->skip(bufferSize / 2); in test_skipping()
120 test_rewind(reporter, bufferedStream.get(), true); in test_skipping()
121 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize / 4); in test_skipping()
124 bufferedStream->skip(bufferSize / 2); in test_skipping()
127 test_read(reporter, bufferedStream.get(), gAbcs + memStream->getPosition(), bufferSize / 4); in test_skipping()
129 test_rewind(reporter, bufferedStream.get(), true); in test_skipping()
130 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize); in test_skipping()
133 // A custom class whose isAtEnd behaves the way Android's stream does - since it is an adaptor to a
143 size_t bytesRead = this->INHERITED::read(dst, requested); in read()
159 // This test ensures that buffering the exact length of the stream and attempting to read beyond it
162 // Use a stream that behaves like Android's stream. in test_read_beyond_buffer()
166 // Create a buffer that matches the length of the stream. in test_read_beyond_buffer()
172 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize + 1); in test_read_beyond_buffer()
173 test_rewind(reporter, bufferedStream.get(), true); in test_read_beyond_buffer()
176 test_read(reporter, bufferedStream.get(), gAbcs, bufferSize); in test_read_beyond_buffer()
179 // Mock stream that optionally has a length and/or position. Tests that FrontBufferedStream's
180 // length depends on the stream it's buffering having a length and position.
209 // Test all possible combinations of the wrapped stream having a length and a position.
213 LengthOptionalStream* stream = in test_length_combos() local
216 std::unique_ptr<SkStream>(stream), bufferSize); in test_length_combos()
217 test_hasLength(reporter, *buffered, *stream); in test_length_combos()
222 // Test using a stream with an initial offset.
227 // the stream it wraps. in test_initial_offset()
229 memStream->skip(arbitraryOffset); in test_initial_offset()
234 REPORTER_ASSERT(reporter, bufferedStream->hasLength()); in test_initial_offset()
237 const size_t bufferedLength = bufferedStream->getLength(); in test_initial_offset()
240 // Read the stream in chunks. After each read, the position must match currentPosition, in test_initial_offset()
241 // which sums the amount attempted to read, unless the end of the stream has been reached. in test_initial_offset()
244 REPORTER_ASSERT(reporter, !bufferedStream->isAtEnd()); in test_initial_offset()
245 test_read(reporter, bufferedStream.get(), gAbcs + arbitraryOffset + currentPosition, in test_initial_offset()
248 REPORTER_ASSERT(reporter, memStream->getPosition() - arbitraryOffset == currentPosition); in test_initial_offset()
250 REPORTER_ASSERT(reporter, bufferedStream->isAtEnd()); in test_initial_offset()
270 // Test that a FrontBufferedStream does not allow reading after the end of a stream.
295 auto stream = android::skia::FrontBufferedStream::Make( in DEF_TEST() local
299 // won't read past the end of the stream. in DEF_TEST()
300 std::unique_ptr<SkCodec> codec(SkCodec::MakeFromStream(std::move(stream))); in DEF_TEST()