aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-11-18 09:32:36 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-18 09:32:36 -0800
commit0bd57b2e1eb6ff824ac59a461d1a8aa24a808886 (patch)
tree888fcf1fc99ff4e193214be04f547120917bcdb7 /tests
parenta06a9531213d2f00a0fe1dc07acd96eba57e6044 (diff)
SkVarAlloc::approxBytesAllocated()
This is what I was getting at on the other CL. BUG=skia: Committed: https://skia.googlesource.com/skia/+/f27f1bcce50c8f95aea8469684a70b70c9baee09 CQ_EXTRA_TRYBOTS=client.skia.android:Test-Android-Nexus5-Adreno330-Arm7-Release-Trybot Review URL: https://codereview.chromium.org/730193003
Diffstat (limited to 'tests')
-rw-r--r--tests/VarAllocTest.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/VarAllocTest.cpp b/tests/VarAllocTest.cpp
new file mode 100644
index 0000000000..d6a288dcce
--- /dev/null
+++ b/tests/VarAllocTest.cpp
@@ -0,0 +1,13 @@
+#include "Test.h"
+#include "SkVarAlloc.h"
+
+DEF_TEST(VarAlloc, r) {
+ SkVarAlloc va;
+ char* p = va.alloc(128, SK_MALLOC_THROW);
+ sk_bzero(p, 128); // Just checking this is safe.
+
+#ifndef SK_BUILD_FOR_ANDROID
+ // This method will always return 0 on Android.
+ REPORTER_ASSERT(r, va.approxBytesAllocated() >= 128);
+#endif
+}