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

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

Issue 878723002: Upgrade ICU to 54.1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add en-GB display name test Created 5 years, 10 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
« no previous file with comments | « ui/base/l10n/l10n_util.cc ('k') | no next file » | 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 452
453 result = l10n_util::GetDisplayNameForLocale("es-419", "en", false); 453 result = l10n_util::GetDisplayNameForLocale("es-419", "en", false);
454 EXPECT_EQ(ASCIIToUTF16("Spanish (Latin America)"), result); 454 EXPECT_EQ(ASCIIToUTF16("Spanish (Latin America)"), result);
455 455
456 result = l10n_util::GetDisplayNameForLocale("-BR", "en", false); 456 result = l10n_util::GetDisplayNameForLocale("-BR", "en", false);
457 EXPECT_EQ(ASCIIToUTF16("Brazil"), result); 457 EXPECT_EQ(ASCIIToUTF16("Brazil"), result);
458 458
459 result = l10n_util::GetDisplayNameForLocale("xyz-xyz", "en", false); 459 result = l10n_util::GetDisplayNameForLocale("xyz-xyz", "en", false);
460 EXPECT_EQ(ASCIIToUTF16("xyz (XYZ)"), result); 460 EXPECT_EQ(ASCIIToUTF16("xyz (XYZ)"), result);
461 461
462 // Make sure that en-GB locale has the corect display names.
463 result = l10n_util::GetDisplayNameForLocale("en", "en-GB", false);
464 EXPECT_EQ(ASCIIToUTF16("English"), result);
465 result = l10n_util::GetDisplayNameForLocale("es-419", "en-GB", false);
466 EXPECT_EQ(ASCIIToUTF16("Spanish (Latin America)"), result);
467
462 // Check for directional markers when using RTL languages to ensure that 468 // Check for directional markers when using RTL languages to ensure that
463 // direction neutral characters such as parentheses are properly formatted. 469 // direction neutral characters such as parentheses are properly formatted.
464 470
465 // Keep a copy of ICU's default locale before we overwrite it. 471 // Keep a copy of ICU's default locale before we overwrite it.
466 const std::string original_locale = base::i18n::GetConfiguredLocale(); 472 const std::string original_locale = base::i18n::GetConfiguredLocale();
467 473
468 base::i18n::SetICUDefaultLocale("he"); 474 base::i18n::SetICUDefaultLocale("he");
469 CheckUiDisplayNameForLocale("en-US", "en", false); 475 CheckUiDisplayNameForLocale("en-US", "en", false);
470 CheckUiDisplayNameForLocale("en-US", "he", true); 476 CheckUiDisplayNameForLocale("en-US", "he", true);
471 477
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("Latin")); 563 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("Latin"));
558 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("German")); 564 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("German"));
559 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("pt--BR")); 565 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("pt--BR"));
560 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("sl-macedonia")); 566 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("sl-macedonia"));
561 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("@")); 567 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("@"));
562 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@")); 568 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@"));
563 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x")); 569 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x"));
564 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x=")); 570 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x="));
565 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@=y")); 571 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@=y"));
566 } 572 }
OLDNEW
« no previous file with comments | « ui/base/l10n/l10n_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698