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

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

Issue 4182010: Use PASS() everywhere in ppapi/tests. (Closed) Base URL: https://ppapi.googlecode.com/svn/trunk/tests
Patch Set: First. Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/test_buffer.cc ('k') | ppapi/tests/test_file_io.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_char_set.h" 5 #include "ppapi/tests/test_char_set.h"
6 6
7 #include "ppapi/c/dev/ppb_char_set_dev.h" 7 #include "ppapi/c/dev/ppb_char_set_dev.h"
8 #include "ppapi/cpp/module.h" 8 #include "ppapi/cpp/module.h"
9 #include "ppapi/tests/testing_instance.h" 9 #include "ppapi/tests/testing_instance.h"
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 utf8result[2] == 0); 89 utf8result[2] == 0);
90 pp::Module::Get()->core()->MemFree(utf8result); 90 pp::Module::Get()->core()->MemFree(utf8result);
91 91
92 // Invalid encoding name. 92 // Invalid encoding name.
93 utf8result = char_set_interface_->UTF16ToCharSet( 93 utf8result = char_set_interface_->UTF16ToCharSet(
94 &utf16[0], static_cast<uint32_t>(utf16.size()), "poopiepants", 94 &utf16[0], static_cast<uint32_t>(utf16.size()), "poopiepants",
95 PP_CHARSET_CONVERSIONERROR_SUBSTITUTE, &utf8result_len); 95 PP_CHARSET_CONVERSIONERROR_SUBSTITUTE, &utf8result_len);
96 ASSERT_TRUE(!utf8result); 96 ASSERT_TRUE(!utf8result);
97 ASSERT_TRUE(utf8result_len == 0); 97 ASSERT_TRUE(utf8result_len == 0);
98 98
99 return std::string(); 99 PASS();
100 } 100 }
101 101
102 std::string TestCharSet::TestCharSetToUTF16() { 102 std::string TestCharSet::TestCharSetToUTF16() {
103 // Empty string. 103 // Empty string.
104 uint32_t utf16result_len; 104 uint32_t utf16result_len;
105 uint16_t* utf16result = char_set_interface_->CharSetToUTF16( 105 uint16_t* utf16result = char_set_interface_->CharSetToUTF16(
106 "", 0, "latin1", PP_CHARSET_CONVERSIONERROR_FAIL, &utf16result_len); 106 "", 0, "latin1", PP_CHARSET_CONVERSIONERROR_FAIL, &utf16result_len);
107 ASSERT_TRUE(utf16result); 107 ASSERT_TRUE(utf16result);
108 ASSERT_TRUE(utf16result_len == 0); 108 ASSERT_TRUE(utf16result_len == 0);
109 ASSERT_TRUE(utf16result[0] == 0); 109 ASSERT_TRUE(utf16result[0] == 0);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 ASSERT_TRUE(utf16result[0] == 'A' && utf16result[1] == 0xFFFD && 141 ASSERT_TRUE(utf16result[0] == 'A' && utf16result[1] == 0xFFFD &&
142 utf16result[2] == 'Z' && utf16result[3] == 0); 142 utf16result[2] == 'Z' && utf16result[3] == 0);
143 143
144 // Invalid encoding name. 144 // Invalid encoding name.
145 utf16result = char_set_interface_->CharSetToUTF16( 145 utf16result = char_set_interface_->CharSetToUTF16(
146 badutf8, 3, "poopiepants", 146 badutf8, 3, "poopiepants",
147 PP_CHARSET_CONVERSIONERROR_SUBSTITUTE, &utf16result_len); 147 PP_CHARSET_CONVERSIONERROR_SUBSTITUTE, &utf16result_len);
148 ASSERT_TRUE(!utf16result); 148 ASSERT_TRUE(!utf16result);
149 ASSERT_TRUE(utf16result_len == 0); 149 ASSERT_TRUE(utf16result_len == 0);
150 150
151 return std::string(); 151 PASS();
152 } 152 }
153 153
154 std::vector<uint16_t> TestCharSet::UTF8ToUTF16(const std::string& utf8) { 154 std::vector<uint16_t> TestCharSet::UTF8ToUTF16(const std::string& utf8) {
155 uint32_t result_len = 0; 155 uint32_t result_len = 0;
156 uint16_t* result = char_set_interface_->CharSetToUTF16( 156 uint16_t* result = char_set_interface_->CharSetToUTF16(
157 utf8.c_str(), static_cast<uint32_t>(utf8.size()), 157 utf8.c_str(), static_cast<uint32_t>(utf8.size()),
158 "utf-8", PP_CHARSET_CONVERSIONERROR_FAIL, &result_len); 158 "utf-8", PP_CHARSET_CONVERSIONERROR_FAIL, &result_len);
159 159
160 std::vector<uint16_t> result_vector; 160 std::vector<uint16_t> result_vector;
161 if (!result) 161 if (!result)
162 return result_vector; 162 return result_vector;
163 163
164 result_vector.assign(result, &result[result_len]); 164 result_vector.assign(result, &result[result_len]);
165 pp::Module::Get()->core()->MemFree(result); 165 pp::Module::Get()->core()->MemFree(result);
166 return result_vector; 166 return result_vector;
167 } 167 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_buffer.cc ('k') | ppapi/tests/test_file_io.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698