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

Side by Side Diff: ppapi/tests/test_memory.cc

Issue 8982006: Add GetLiveVars to PPB_Testing_Dev. Fix leaks it uncovered. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged Created 9 years 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 | « ppapi/tests/test_input_event.cc ('k') | ppapi/tests/test_post_message.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/tests/test_memory.h" 5 #include "ppapi/tests/test_memory.h"
6 6
7 #include "ppapi/c/dev/ppb_testing_dev.h" 7 #include "ppapi/c/dev/ppb_testing_dev.h"
8 #include "ppapi/c/dev/ppb_memory_dev.h" 8 #include "ppapi/c/dev/ppb_memory_dev.h"
9 #include "ppapi/cpp/instance.h" 9 #include "ppapi/cpp/instance.h"
10 #include "ppapi/cpp/module.h" 10 #include "ppapi/cpp/module.h"
11 #include "ppapi/tests/testing_instance.h" 11 #include "ppapi/tests/testing_instance.h"
12 12
13 namespace { 13 namespace {
14 14
15 size_t kTestBufferSize = 1000; 15 size_t kTestBufferSize = 1000;
16 16
17 } // namespace 17 } // namespace
18 18
19 REGISTER_TEST_CASE(Memory); 19 REGISTER_TEST_CASE(Memory);
20 20
21 bool TestMemory::Init() { 21 bool TestMemory::Init() {
22 memory_dev_interface_ = static_cast<const PPB_Memory_Dev*>( 22 memory_dev_interface_ = static_cast<const PPB_Memory_Dev*>(
23 pp::Module::Get()->GetBrowserInterface(PPB_MEMORY_DEV_INTERFACE)); 23 pp::Module::Get()->GetBrowserInterface(PPB_MEMORY_DEV_INTERFACE));
24 return memory_dev_interface_ && InitTestingInterface(); 24 return memory_dev_interface_ && CheckTestingInterface();
25 } 25 }
26 26
27 void TestMemory::RunTests(const std::string& filter) { 27 void TestMemory::RunTests(const std::string& filter) {
28 RUN_TEST(MemAlloc, filter); 28 RUN_TEST(MemAlloc, filter);
29 RUN_TEST(NullMemFree, filter); 29 RUN_TEST(NullMemFree, filter);
30 } 30 }
31 31
32 std::string TestMemory::TestMemAlloc() { 32 std::string TestMemory::TestMemAlloc() {
33 char* buffer = static_cast<char*>( 33 char* buffer = static_cast<char*>(
34 memory_dev_interface_->MemAlloc(kTestBufferSize)); 34 memory_dev_interface_->MemAlloc(kTestBufferSize));
35 // Touch a couple of locations. Failure will crash the test. 35 // Touch a couple of locations. Failure will crash the test.
36 buffer[0] = '1'; 36 buffer[0] = '1';
37 buffer[kTestBufferSize - 1] = '1'; 37 buffer[kTestBufferSize - 1] = '1';
38 memory_dev_interface_->MemFree(buffer); 38 memory_dev_interface_->MemFree(buffer);
39 39
40 PASS(); 40 PASS();
41 } 41 }
42 42
43 std::string TestMemory::TestNullMemFree() { 43 std::string TestMemory::TestNullMemFree() {
44 // Failure crashes the test. 44 // Failure crashes the test.
45 memory_dev_interface_->MemFree(NULL); 45 memory_dev_interface_->MemFree(NULL);
46 46
47 PASS(); 47 PASS();
48 } 48 }
49 49
OLDNEW
« no previous file with comments | « ppapi/tests/test_input_event.cc ('k') | ppapi/tests/test_post_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698