aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2016-12-14 12:34:06 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-14 18:34:30 +0000
commit49282296b6b1ca4e49be2441d83a3e0aad65b319 (patch)
tree733e91f2c5db90974a59355f8616522e7eccc8d6 /tests
parent7a1cc6766d07f343923587deaf14e1a3965c2b8f (diff)
add tests/bench for dynamicwstream
BUG=skia: Change-Id: I5a995b63b1a2975cce8101717777eaa6fc12af21 Reviewed-on: https://skia-review.googlesource.com/6035 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/StreamTest.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp
index b330745fb8..d1fd75105a 100644
--- a/tests/StreamTest.cpp
+++ b/tests/StreamTest.cpp
@@ -352,6 +352,7 @@ DEF_TEST(StreamPeek_BlockMemoryStream, rep) {
SkRandom rand(kSeed << 1);
uint8_t buffer[4096];
SkDynamicMemoryWStream dynamicMemoryWStream;
+ size_t totalWritten = 0;
for (int i = 0; i < 32; ++i) {
// Randomize the length of the blocks.
size_t size = rand.nextRangeU(1, sizeof(buffer));
@@ -359,6 +360,8 @@ DEF_TEST(StreamPeek_BlockMemoryStream, rep) {
buffer[j] = valueSource.nextU() & 0xFF;
}
dynamicMemoryWStream.write(buffer, size);
+ totalWritten += size;
+ REPORTER_ASSERT(rep, totalWritten == dynamicMemoryWStream.bytesWritten());
}
std::unique_ptr<SkStreamAsset> asset(dynamicMemoryWStream.detachAsStream());
sk_sp<SkData> expected(SkData::MakeUninitialized(asset->getLength()));