| * 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 "SkDiscardableMemory.h" |
| DEF_TEST(DiscardableMemory, reporter) { |
| const char testString[] = "HELLO, WORLD!"; |
| const size_t len = sizeof(testString); |
| SkAutoTDelete<SkDiscardableMemory> dm(SkDiscardableMemory::Create(len)); |
| REPORTER_ASSERT(reporter, dm.get() != NULL); |
| REPORTER_ASSERT(reporter, ptr != NULL); |
| memcpy(ptr, testString, sizeof(testString)); |
| bool success = dm->lock(); |
| REPORTER_ASSERT(reporter, success); |
| REPORTER_ASSERT(reporter, 0 == memcmp(ptr, testString, len)); |