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

Side by Side Diff: trunk/src/base/i18n/icu_string_conversions_unittest.cc

Issue 336793004: Revert 277111 "Roll ICU to icu52" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 6 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
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 <math.h> 5 #include <math.h>
6 #include <stdarg.h> 6 #include <stdarg.h>
7 7
8 #include <limits> 8 #include <limits>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 true, 179 true,
180 L"\x03B3\x03B5\x03B9\x03AC" L" " L"\x03C3\x03BF\x03C5", 180 L"\x03B3\x03B5\x03B9\x03AC" L" " L"\x03C3\x03BF\x03C5",
181 NULL}, 181 NULL},
182 // Hebrew (Windows) 182 // Hebrew (Windows)
183 {"windows-1255", 183 {"windows-1255",
184 "\xF9\xD1\xC8\xEC\xE5\xC9\xED", 184 "\xF9\xD1\xC8\xEC\xE5\xC9\xED",
185 OnStringConversionError::FAIL, 185 OnStringConversionError::FAIL,
186 true, 186 true,
187 L"\x05E9\x05C1\x05B8\x05DC\x05D5\x05B9\x05DD", 187 L"\x05E9\x05C1\x05B8\x05DC\x05D5\x05B9\x05DD",
188 NULL}, 188 NULL},
189 // Hindi Devanagari (ISCII)
190 {"iscii-dev",
191 "\xEF\x42" "\xC6\xCC\xD7\xE8\xB3\xDA\xCF",
192 OnStringConversionError::FAIL,
193 true,
194 L"\x0928\x092E\x0938\x094D\x0915\x093E\x0930",
195 NULL},
189 // Korean (EUC) 196 // Korean (EUC)
190 {"euc-kr", 197 {"euc-kr",
191 "\xBE\xC8\xB3\xE7\xC7\xCF\xBC\xBC\xBF\xE4", 198 "\xBE\xC8\xB3\xE7\xC7\xCF\xBC\xBC\xBF\xE4",
192 OnStringConversionError::FAIL, 199 OnStringConversionError::FAIL,
193 true, 200 true,
194 L"\xC548\xB155\xD558\xC138\xC694", 201 L"\xC548\xB155\xD558\xC138\xC694",
195 NULL}, 202 NULL},
196 // Japanese (EUC) 203 // Japanese (EUC)
197 {"euc-jp", 204 {"euc-jp",
198 "\xA4\xB3\xA4\xF3\xA4\xCB\xA4\xC1\xA4\xCF\xB0\xEC\x8E\xA6", 205 "\xA4\xB3\xA4\xF3\xA4\xCB\xA4\xC1\xA4\xCF\xB0\xEC\x8F\xB0\xA1\x8E\xA6",
199 OnStringConversionError::FAIL, 206 OnStringConversionError::FAIL,
200 true, 207 true,
201 L"\x3053\x3093\x306B\x3061\x306F\x4E00\xFF66", 208 L"\x3053\x3093\x306B\x3061\x306F\x4E00\x4E02\xFF66",
202 NULL}, 209 NULL},
203 // Japanese (ISO-2022) 210 // Japanese (ISO-2022)
204 {"iso-2022-jp", 211 {"iso-2022-jp",
205 "\x1B$B" "\x24\x33\x24\x73\x24\x4B\x24\x41\x24\x4F\x30\x6C" "\x1B(B" 212 "\x1B$B" "\x24\x33\x24\x73\x24\x4B\x24\x41\x24\x4F\x30\x6C" "\x1B(B"
206 "ab" "\x1B(J" "\x5C\x7E#$" "\x1B(B", 213 "ab" "\x1B(J" "\x5C\x7E#$" "\x1B(B",
207 OnStringConversionError::FAIL, 214 OnStringConversionError::FAIL,
208 true, 215 true,
209 L"\x3053\x3093\x306B\x3061\x306F\x4E00" L"ab\x00A5\x203E#$", 216 L"\x3053\x3093\x306B\x3061\x306F\x4E00" L"ab\x00A5\x203E#$",
210 NULL}, 217 NULL},
211 // Japanese (Shift-JIS) 218 // Japanese (Shift-JIS)
(...skipping 12 matching lines...) Expand all
224 L"\x0443\x0439\x0442\x0435", 231 L"\x0443\x0439\x0442\x0435",
225 NULL}, 232 NULL},
226 // Thai (windows-874) 233 // Thai (windows-874)
227 {"windows-874", 234 {"windows-874",
228 "\xCA\xC7\xD1\xCA\xB4\xD5" "\xA4\xC3\xD1\xBA", 235 "\xCA\xC7\xD1\xCA\xB4\xD5" "\xA4\xC3\xD1\xBA",
229 OnStringConversionError::FAIL, 236 OnStringConversionError::FAIL,
230 true, 237 true,
231 L"\x0E2A\x0E27\x0E31\x0E2A\x0E14\x0E35" 238 L"\x0E2A\x0E27\x0E31\x0E2A\x0E14\x0E35"
232 L"\x0E04\x0E23\x0e31\x0E1A", 239 L"\x0E04\x0E23\x0e31\x0E1A",
233 NULL}, 240 NULL},
241 // Empty text
242 {"iscii-dev",
243 "",
244 OnStringConversionError::FAIL,
245 true,
246 L"",
247 NULL},
234 }; 248 };
235 249
236 TEST(ICUStringConversionsTest, ConvertBetweenCodepageAndWide) { 250 TEST(ICUStringConversionsTest, ConvertBetweenCodepageAndWide) {
237 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kConvertCodepageCases); ++i) { 251 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kConvertCodepageCases); ++i) {
238 SCOPED_TRACE(base::StringPrintf( 252 SCOPED_TRACE(base::StringPrintf(
239 "Test[%" PRIuS "]: <encoded: %s> <codepage: %s>", i, 253 "Test[%" PRIuS "]: <encoded: %s> <codepage: %s>", i,
240 kConvertCodepageCases[i].encoded, 254 kConvertCodepageCases[i].encoded,
241 kConvertCodepageCases[i].codepage_name)); 255 kConvertCodepageCases[i].codepage_name));
242 256
243 std::wstring wide; 257 std::wstring wide;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 377
364 bool success = ConvertToUtf8AndNormalize( 378 bool success = ConvertToUtf8AndNormalize(
365 kConvertAndNormalizeCases[i].encoded, 379 kConvertAndNormalizeCases[i].encoded,
366 kConvertAndNormalizeCases[i].codepage_name, &result); 380 kConvertAndNormalizeCases[i].codepage_name, &result);
367 EXPECT_EQ(kConvertAndNormalizeCases[i].expected_success, success); 381 EXPECT_EQ(kConvertAndNormalizeCases[i].expected_success, success);
368 EXPECT_EQ(kConvertAndNormalizeCases[i].expected_value, result); 382 EXPECT_EQ(kConvertAndNormalizeCases[i].expected_value, result);
369 } 383 }
370 } 384 }
371 385
372 } // namespace base 386 } // namespace base
OLDNEW
« no previous file with comments | « trunk/src/DEPS ('k') | trunk/src/chrome/browser/translate/translate_manager_render_view_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698