diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-03-03 19:23:28 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-03-03 19:23:28 +0000 |
commit | 085a6e476b5bd54d93d002209e6cba078afe3a6b (patch) | |
tree | b7a454a6d9d7fcd643770830458dec32221fe10d /tests/DiscardableMemoryPoolTest.cpp | |
parent | 6f4fb0f1296422a44d5d0dac155d82595dc5ebec (diff) |
Rename test files to end with Test.cpp.
DM builds all of {bench,gm,test}/*.cpp. A Windows build warned us that we were
trying to link typeface.obj twice. This must have something to do with there
existing gm/typeface.cpp and tests/Typeface.cpp. To be safe, make sure tests
have a Test.cpp suffix to disambiguate.
BUG=skia:
R=rmistry@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/185923002
git-svn-id: http://skia.googlecode.com/svn/trunk@13644 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/DiscardableMemoryPoolTest.cpp')
-rw-r--r-- | tests/DiscardableMemoryPoolTest.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/DiscardableMemoryPoolTest.cpp b/tests/DiscardableMemoryPoolTest.cpp new file mode 100644 index 0000000000..dc927bd4b7 --- /dev/null +++ b/tests/DiscardableMemoryPoolTest.cpp @@ -0,0 +1,35 @@ +/* + * Copyright 2013 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#include "SkDiscardableMemoryPool.h" + +#include "Test.h" + +DEF_TEST(DiscardableMemoryPool, reporter) { + SkAutoTUnref<SkDiscardableMemoryPool> pool( + SkNEW_ARGS(SkDiscardableMemoryPool, (1, NULL))); + pool->setRAMBudget(3); + REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed()); + + SkAutoTDelete<SkDiscardableMemory> dm1(pool->create(100)); + REPORTER_ASSERT(reporter, dm1->data() != NULL); + REPORTER_ASSERT(reporter, 100 == pool->getRAMUsed()); + dm1->unlock(); + REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed()); + REPORTER_ASSERT(reporter, !dm1->lock()); + + + SkAutoTDelete<SkDiscardableMemory> dm2(pool->create(200)); + REPORTER_ASSERT(reporter, 200 == pool->getRAMUsed()); + pool->setRAMBudget(400); + dm2->unlock(); + REPORTER_ASSERT(reporter, 200 == pool->getRAMUsed()); + REPORTER_ASSERT(reporter, dm2->lock()); + dm2->unlock(); + pool->dumpPool(); + REPORTER_ASSERT(reporter, !dm2->lock()); + REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed()); +} |