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

Unified Diff: ppapi/tests/test_char_set.cc

Issue 7349016: Added versioning for PPB_Core::MemAlloc and MemFree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes based on comments from dmichael Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/shared_impl/char_set_impl.cc ('k') | webkit/plugins/ppapi/plugin_module.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_char_set.cc
diff --git a/ppapi/tests/test_char_set.cc b/ppapi/tests/test_char_set.cc
index dc417a006e121e59d814f9307399e564fd0bd3b4..5c7ae696bee17ef6dd1d45db160f56018f87954f 100644
--- a/ppapi/tests/test_char_set.cc
+++ b/ppapi/tests/test_char_set.cc
@@ -1,10 +1,11 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ppapi/tests/test_char_set.h"
#include "ppapi/c/dev/ppb_char_set_dev.h"
+#include "ppapi/cpp/dev/memory_dev.h"
#include "ppapi/cpp/module.h"
#include "ppapi/tests/testing_instance.h"
@@ -32,13 +33,14 @@ std::string TestCharSet::TestUTF16ToCharSet() {
std::vector<uint16_t> utf16;
utf16.push_back(0);
uint32_t utf8result_len = 0;
+ pp::Memory_Dev memory;
char* utf8result = char_set_interface_->UTF16ToCharSet(
instance_->pp_instance(), &utf16[0], 0, "latin1",
PP_CHARSET_CONVERSIONERROR_SUBSTITUTE, &utf8result_len);
ASSERT_TRUE(utf8result);
ASSERT_TRUE(utf8result[0] == 0);
ASSERT_TRUE(utf8result_len == 0);
- pp::Module::Get()->core()->MemFree(utf8result);
+ memory.MemFree(utf8result);
// Try round-tripping some English & Chinese from UTF-8 through UTF-16
std::string utf8source("Hello, world. \xe4\xbd\xa0\xe5\xa5\xbd");
@@ -47,7 +49,7 @@ std::string TestCharSet::TestUTF16ToCharSet() {
instance_->pp_instance(), &utf16[0], static_cast<uint32_t>(utf16.size()),
"Utf-8", PP_CHARSET_CONVERSIONERROR_FAIL, &utf8result_len);
ASSERT_TRUE(utf8source == std::string(utf8result, utf8result_len));
- pp::Module::Get()->core()->MemFree(utf8result);
+ memory.MemFree(utf8result);
// Test an un-encodable character with various modes.
utf16 = UTF8ToUTF16("h\xe4\xbd\xa0i");
@@ -67,7 +69,7 @@ std::string TestCharSet::TestUTF16ToCharSet() {
ASSERT_TRUE(utf8result_len == 2);
ASSERT_TRUE(utf8result[0] == 'h' && utf8result[1] == 'i' &&
utf8result[2] == 0);
- pp::Module::Get()->core()->MemFree(utf8result);
+ memory.MemFree(utf8result);
// Substitute mode.
utf8result = char_set_interface_->UTF16ToCharSet(
@@ -76,7 +78,7 @@ std::string TestCharSet::TestUTF16ToCharSet() {
ASSERT_TRUE(utf8result_len == 3);
ASSERT_TRUE(utf8result[0] == 'h' && utf8result[1] == '?' &&
utf8result[2] == 'i' && utf8result[3] == 0);
- pp::Module::Get()->core()->MemFree(utf8result);
+ memory.MemFree(utf8result);
// Try some invalid input encoding.
utf16.clear();
@@ -88,7 +90,7 @@ std::string TestCharSet::TestUTF16ToCharSet() {
ASSERT_TRUE(utf8result_len == 2);
ASSERT_TRUE(utf8result[0] == '?' && utf8result[1] == 'A' &&
utf8result[2] == 0);
- pp::Module::Get()->core()->MemFree(utf8result);
+ memory.MemFree(utf8result);
// Invalid encoding name.
utf8result = char_set_interface_->UTF16ToCharSet(
@@ -182,6 +184,7 @@ std::vector<uint16_t> TestCharSet::UTF8ToUTF16(const std::string& utf8) {
return result_vector;
result_vector.assign(result, &result[result_len]);
- pp::Module::Get()->core()->MemFree(result);
+ pp::Memory_Dev memory;
+ memory.MemFree(result);
return result_vector;
}
« no previous file with comments | « ppapi/shared_impl/char_set_impl.cc ('k') | webkit/plugins/ppapi/plugin_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698