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

Side by Side Diff: ui/base/l10n/l10n_util_unittest.cc

Issue 232773008: More removal of GTK code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove base/ so I don't need another stamp. Created 6 years, 8 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 | « ui/base/clipboard/custom_data_helper_linux.cc ('k') | ui/gfx/gfx.gyp » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_POSIX) && !defined(OS_MACOSX) 7 #if defined(OS_POSIX) && !defined(OS_MACOSX)
8 #include <cstdlib> 8 #include <cstdlib>
9 #endif 9 #endif
10 10
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 367
368 result = l10n_util::GetDisplayNameForLocale("es-419", "en", false); 368 result = l10n_util::GetDisplayNameForLocale("es-419", "en", false);
369 EXPECT_EQ(ASCIIToUTF16("Spanish (Latin America)"), result); 369 EXPECT_EQ(ASCIIToUTF16("Spanish (Latin America)"), result);
370 370
371 result = l10n_util::GetDisplayNameForLocale("-BR", "en", false); 371 result = l10n_util::GetDisplayNameForLocale("-BR", "en", false);
372 EXPECT_EQ(ASCIIToUTF16("Brazil"), result); 372 EXPECT_EQ(ASCIIToUTF16("Brazil"), result);
373 373
374 result = l10n_util::GetDisplayNameForLocale("xyz-xyz", "en", false); 374 result = l10n_util::GetDisplayNameForLocale("xyz-xyz", "en", false);
375 EXPECT_EQ(ASCIIToUTF16("xyz (XYZ)"), result); 375 EXPECT_EQ(ASCIIToUTF16("xyz (XYZ)"), result);
376 376
377 #if !defined(TOOLKIT_GTK)
378 // Check for directional markers when using RTL languages to ensure that 377 // Check for directional markers when using RTL languages to ensure that
379 // direction neutral characters such as parentheses are properly formatted. 378 // direction neutral characters such as parentheses are properly formatted.
380 379
381 // Keep a copy of ICU's default locale before we overwrite it. 380 // Keep a copy of ICU's default locale before we overwrite it.
382 const std::string original_locale = base::i18n::GetConfiguredLocale(); 381 const std::string original_locale = base::i18n::GetConfiguredLocale();
383 382
384 base::i18n::SetICUDefaultLocale("he"); 383 base::i18n::SetICUDefaultLocale("he");
385 CheckUiDisplayNameForLocale("en-US", "en", false); 384 CheckUiDisplayNameForLocale("en-US", "en", false);
386 CheckUiDisplayNameForLocale("en-US", "he", true); 385 CheckUiDisplayNameForLocale("en-US", "he", true);
387 386
388 // Clean up. 387 // Clean up.
389 base::i18n::SetICUDefaultLocale(original_locale); 388 base::i18n::SetICUDefaultLocale(original_locale);
390 #endif
391 389
392 // ToUpper and ToLower should work with embedded NULLs. 390 // ToUpper and ToLower should work with embedded NULLs.
393 const size_t length_with_null = 4; 391 const size_t length_with_null = 4;
394 base::char16 buf_with_null[length_with_null] = { 0, 'a', 0, 'b' }; 392 base::char16 buf_with_null[length_with_null] = { 0, 'a', 0, 'b' };
395 base::string16 string16_with_null(buf_with_null, length_with_null); 393 base::string16 string16_with_null(buf_with_null, length_with_null);
396 394
397 base::string16 upper_with_null = base::i18n::ToUpper(string16_with_null); 395 base::string16 upper_with_null = base::i18n::ToUpper(string16_with_null);
398 ASSERT_EQ(length_with_null, upper_with_null.size()); 396 ASSERT_EQ(length_with_null, upper_with_null.size());
399 EXPECT_TRUE(upper_with_null[0] == 0 && upper_with_null[1] == 'A' && 397 EXPECT_TRUE(upper_with_null[0] == 0 && upper_with_null[1] == 'A' &&
400 upper_with_null[2] == 0 && upper_with_null[3] == 'B'); 398 upper_with_null[2] == 0 && upper_with_null[3] == 'B');
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("Latin")); 472 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("Latin"));
475 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("German")); 473 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("German"));
476 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("pt--BR")); 474 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("pt--BR"));
477 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("sl-macedonia")); 475 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("sl-macedonia"));
478 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("@")); 476 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("@"));
479 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@")); 477 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@"));
480 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x")); 478 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x"));
481 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x=")); 479 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x="));
482 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@=y")); 480 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@=y"));
483 } 481 }
OLDNEW
« no previous file with comments | « ui/base/clipboard/custom_data_helper_linux.cc ('k') | ui/gfx/gfx.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698