| 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..9c39a031f90373eb802c2ca5a2c66310b48f7b38 100644
|
| --- a/ppapi/tests/test_char_set.cc
|
| +++ b/ppapi/tests/test_char_set.cc
|
| @@ -5,6 +5,7 @@
|
| #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;
|
| }
|
|
|