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

Side by Side Diff: tests/DiscardableMemoryPool.cpp

Issue 138563004: Move macros from TestClassDef.h to Test.h (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: upload Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/DeviceLooperTest.cpp ('k') | tests/DiscardableMemoryTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "SkDiscardableMemoryPool.h" 7 #include "SkDiscardableMemoryPool.h"
8 8
9 #include "Test.h" 9 #include "Test.h"
10 #include "TestClassDef.h"
11 10
12 DEF_TEST(DiscardableMemoryPool, reporter) { 11 DEF_TEST(DiscardableMemoryPool, reporter) {
13 SkAutoTUnref<SkDiscardableMemoryPool> pool( 12 SkAutoTUnref<SkDiscardableMemoryPool> pool(
14 SkNEW_ARGS(SkDiscardableMemoryPool, (1, NULL))); 13 SkNEW_ARGS(SkDiscardableMemoryPool, (1, NULL)));
15 pool->setRAMBudget(3); 14 pool->setRAMBudget(3);
16 REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed()); 15 REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
17 16
18 SkAutoTDelete<SkDiscardableMemory> dm1(pool->create(100)); 17 SkAutoTDelete<SkDiscardableMemory> dm1(pool->create(100));
19 REPORTER_ASSERT(reporter, dm1->data() != NULL); 18 REPORTER_ASSERT(reporter, dm1->data() != NULL);
20 REPORTER_ASSERT(reporter, 100 == pool->getRAMUsed()); 19 REPORTER_ASSERT(reporter, 100 == pool->getRAMUsed());
21 dm1->unlock(); 20 dm1->unlock();
22 REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed()); 21 REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
23 REPORTER_ASSERT(reporter, !dm1->lock()); 22 REPORTER_ASSERT(reporter, !dm1->lock());
24 23
25 24
26 SkAutoTDelete<SkDiscardableMemory> dm2(pool->create(200)); 25 SkAutoTDelete<SkDiscardableMemory> dm2(pool->create(200));
27 REPORTER_ASSERT(reporter, 200 == pool->getRAMUsed()); 26 REPORTER_ASSERT(reporter, 200 == pool->getRAMUsed());
28 pool->setRAMBudget(400); 27 pool->setRAMBudget(400);
29 dm2->unlock(); 28 dm2->unlock();
30 REPORTER_ASSERT(reporter, 200 == pool->getRAMUsed()); 29 REPORTER_ASSERT(reporter, 200 == pool->getRAMUsed());
31 REPORTER_ASSERT(reporter, dm2->lock()); 30 REPORTER_ASSERT(reporter, dm2->lock());
32 dm2->unlock(); 31 dm2->unlock();
33 pool->dumpPool(); 32 pool->dumpPool();
34 REPORTER_ASSERT(reporter, !dm2->lock()); 33 REPORTER_ASSERT(reporter, !dm2->lock());
35 REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed()); 34 REPORTER_ASSERT(reporter, 0 == pool->getRAMUsed());
36 } 35 }
OLDNEW
« no previous file with comments | « tests/DeviceLooperTest.cpp ('k') | tests/DiscardableMemoryTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698