Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: tests/FrontBufferedStreamTest.cpp

Issue 1703293002: Remove position from FrontBufferedStream (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix test_peeking_front_buffered_stream Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/CodexTest.cpp ('k') | tests/StreamTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/FrontBufferedStreamTest.cpp
diff --git a/tests/FrontBufferedStreamTest.cpp b/tests/FrontBufferedStreamTest.cpp
index 0b161b96d8459c573e5ec99fdd453980dc2c480e..7821c5e40dcfb163ac213710631e8c71d6bf1a31 100644
--- a/tests/FrontBufferedStreamTest.cpp
+++ b/tests/FrontBufferedStreamTest.cpp
@@ -68,7 +68,7 @@ static void test_incremental_buffering(skiatest::Reporter* reporter, size_t buff
test_read(reporter, bufferedStream, gAbcs, bufferSize / 4);
// Now test reading part of what was buffered, and buffering new data.
- test_read(reporter, bufferedStream, gAbcs + bufferedStream->getPosition(), bufferSize / 2);
+ test_read(reporter, bufferedStream, gAbcs + bufferSize / 4, bufferSize / 2);
// Now test reading what was buffered, buffering new data, and
// reading directly from the stream.
@@ -96,7 +96,7 @@ static void test_perfectly_sized_buffer(skiatest::Reporter* reporter, size_t buf
test_read(reporter, bufferedStream, gAbcs, bufferSize);
// Read past the size of the buffer. At this point, we cannot return.
- test_read(reporter, bufferedStream, gAbcs + bufferedStream->getPosition(), 1);
+ test_read(reporter, bufferedStream, gAbcs + memStream->getPosition(), 1);
test_rewind(reporter, bufferedStream, false);
}
@@ -116,7 +116,7 @@ static void test_skipping(skiatest::Reporter* reporter, size_t bufferSize) {
bufferedStream->skip(bufferSize / 2);
// Test that reading will still work.
- test_read(reporter, bufferedStream, gAbcs + bufferedStream->getPosition(), bufferSize / 4);
+ test_read(reporter, bufferedStream, gAbcs + memStream->getPosition(), bufferSize / 4);
test_rewind(reporter, bufferedStream, true);
test_read(reporter, bufferedStream, gAbcs, bufferSize);
@@ -219,13 +219,12 @@ static void test_initial_offset(skiatest::Reporter* reporter, size_t bufferSize)
memStream->skip(arbitraryOffset);
SkAutoTDelete<SkStream> bufferedStream(SkFrontBufferedStream::Create(memStream, bufferSize));
- // Since SkMemoryStream has a length and a position, bufferedStream must also.
+ // Since SkMemoryStream has a length, bufferedStream must also.
REPORTER_ASSERT(reporter, bufferedStream->hasLength());
const size_t amountToRead = 10;
const size_t bufferedLength = bufferedStream->getLength();
- size_t currentPosition = bufferedStream->getPosition();
- REPORTER_ASSERT(reporter, 0 == currentPosition);
+ size_t currentPosition = 0;
// Read the stream in chunks. After each read, the position must match currentPosition,
// which sums the amount attempted to read, unless the end of the stream has been reached.
@@ -235,7 +234,7 @@ static void test_initial_offset(skiatest::Reporter* reporter, size_t bufferSize)
test_read(reporter, bufferedStream, gAbcs + arbitraryOffset + currentPosition,
amountToRead);
currentPosition = SkTMin(currentPosition + amountToRead, bufferedLength);
- REPORTER_ASSERT(reporter, bufferedStream->getPosition() == currentPosition);
+ REPORTER_ASSERT(reporter, memStream->getPosition() - arbitraryOffset == currentPosition);
}
REPORTER_ASSERT(reporter, bufferedStream->isAtEnd());
REPORTER_ASSERT(reporter, bufferedLength == currentPosition);
« no previous file with comments | « tests/CodexTest.cpp ('k') | tests/StreamTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698