2 * Copyright 2013 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #include "SkDiscardableMemory.h"
12 DEF_TEST(DiscardableMemory, reporter) {
13 const char testString[] = "HELLO, WORLD!";
14 const size_t len = sizeof(testString);
15 SkAutoTDelete<SkDiscardableMemory> dm(SkDiscardableMemory::Create(len));
16 REPORTER_ASSERT(reporter, dm.get() != NULL);
17 if (NULL == dm.get()) {
20 void* ptr = dm->data();
21 REPORTER_ASSERT(reporter, ptr != NULL);
22 memcpy(ptr, testString, sizeof(testString));
24 bool success = dm->lock();
25 REPORTER_ASSERT(reporter, success);
30 REPORTER_ASSERT(reporter, 0 == memcmp(ptr, testString, len));