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)"), result); | 360 EXPECT_EQ(ASCIIToUTF16("Chinese (Simplified Han)"), 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)"), result); | 363 EXPECT_EQ(ASCIIToUTF16("Chinese (Traditional Han)"), 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); | |
369 | 364 |
370 result = l10n_util::GetDisplayNameForLocale("pt-BR", "en", false); | 365 result = l10n_util::GetDisplayNameForLocale("pt-BR", "en", false); |
371 EXPECT_EQ(ASCIIToUTF16("Portuguese (Brazil)"), result); | 366 EXPECT_EQ(ASCIIToUTF16("Portuguese (Brazil)"), result); |
372 | 367 |
373 result = l10n_util::GetDisplayNameForLocale("es-419", "en", false); | 368 result = l10n_util::GetDisplayNameForLocale("es-419", "en", false); |
374 EXPECT_EQ(ASCIIToUTF16("Spanish (Latin America)"), result); | 369 EXPECT_EQ(ASCIIToUTF16("Spanish (Latin America)"), result); |
375 | 370 |
376 result = l10n_util::GetDisplayNameForLocale("-BR", "en", false); | 371 result = l10n_util::GetDisplayNameForLocale("-BR", "en", false); |
377 EXPECT_EQ(ASCIIToUTF16("Brazil"), result); | 372 EXPECT_EQ(ASCIIToUTF16("Brazil"), result); |
378 | 373 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("Latin")); | 472 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("Latin")); |
478 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("German")); | 473 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("German")); |
479 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("pt--BR")); | 474 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("pt--BR")); |
480 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("sl-macedonia")); | 475 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("sl-macedonia")); |
481 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("@")); | 476 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("@")); |
482 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@")); | 477 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@")); |
483 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x")); | 478 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x")); |
484 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x=")); | 479 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x=")); |
485 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@=y")); | 480 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@=y")); |
486 } | 481 } |
OLD | NEW |