OLD | NEW |
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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 EXPECT_EQ(is_rtl, rtl_direction); | 350 EXPECT_EQ(is_rtl, rtl_direction); |
351 } | 351 } |
352 } | 352 } |
353 } | 353 } |
354 | 354 |
355 TEST_F(L10nUtilTest, GetDisplayNameForLocale) { | 355 TEST_F(L10nUtilTest, GetDisplayNameForLocale) { |
356 // TODO(jungshik): Make this test more extensive. | 356 // TODO(jungshik): Make this test more extensive. |
357 // Test zh-CN and zh-TW are treated as zh-Hans and zh-Hant. | 357 // Test zh-CN and zh-TW are treated as zh-Hans and zh-Hant. |
358 base::string16 result = | 358 base::string16 result = |
359 l10n_util::GetDisplayNameForLocale("zh-CN", "en", false); | 359 l10n_util::GetDisplayNameForLocale("zh-CN", "en", false); |
360 EXPECT_EQ(ASCIIToUTF16("Chinese (Simplified Han)"), result); | 360 EXPECT_EQ(ASCIIToUTF16("Chinese (Simplified)"), result); |
361 | 361 |
362 result = l10n_util::GetDisplayNameForLocale("zh-TW", "en", false); | 362 result = l10n_util::GetDisplayNameForLocale("zh-TW", "en", false); |
363 EXPECT_EQ(ASCIIToUTF16("Chinese (Traditional Han)"), result); | 363 EXPECT_EQ(ASCIIToUTF16("Chinese (Traditional)"), result); |
| 364 |
| 365 // tl and fil are not identical to be strict, but we treat them as |
| 366 // synonyms. |
| 367 result = l10n_util::GetDisplayNameForLocale("tl", "en", false); |
| 368 EXPECT_EQ(l10n_util::GetDisplayNameForLocale("fil", "en", false), result); |
364 | 369 |
365 result = l10n_util::GetDisplayNameForLocale("pt-BR", "en", false); | 370 result = l10n_util::GetDisplayNameForLocale("pt-BR", "en", false); |
366 EXPECT_EQ(ASCIIToUTF16("Portuguese (Brazil)"), result); | 371 EXPECT_EQ(ASCIIToUTF16("Portuguese (Brazil)"), result); |
367 | 372 |
368 result = l10n_util::GetDisplayNameForLocale("es-419", "en", false); | 373 result = l10n_util::GetDisplayNameForLocale("es-419", "en", false); |
369 EXPECT_EQ(ASCIIToUTF16("Spanish (Latin America)"), result); | 374 EXPECT_EQ(ASCIIToUTF16("Spanish (Latin America)"), result); |
370 | 375 |
371 result = l10n_util::GetDisplayNameForLocale("-BR", "en", false); | 376 result = l10n_util::GetDisplayNameForLocale("-BR", "en", false); |
372 EXPECT_EQ(ASCIIToUTF16("Brazil"), result); | 377 EXPECT_EQ(ASCIIToUTF16("Brazil"), result); |
373 | 378 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("Latin")); | 477 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("Latin")); |
473 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("German")); | 478 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("German")); |
474 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("pt--BR")); | 479 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("pt--BR")); |
475 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("sl-macedonia")); | 480 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("sl-macedonia")); |
476 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("@")); | 481 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("@")); |
477 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@")); | 482 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@")); |
478 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x")); | 483 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x")); |
479 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x=")); | 484 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x=")); |
480 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@=y")); | 485 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@=y")); |
481 } | 486 } |
OLD | NEW |