| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/i18n/case_conversion.h" | 11 #include "base/i18n/case_conversion.h" |
| 12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 13 #include "base/i18n/time_formatting.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 16 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/test/icu_test_util.h" |
| 18 #include "base/test/scoped_path_override.h" | 20 #include "base/test/scoped_path_override.h" |
| 19 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "testing/platform_test.h" | 23 #include "testing/platform_test.h" |
| 22 #include "third_party/icu/source/common/unicode/locid.h" | 24 #include "third_party/icu/source/common/unicode/locid.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/l10n/l10n_util_collator.h" | 26 #include "ui/base/l10n/l10n_util_collator.h" |
| 25 #include "ui/base/ui_base_paths.h" | 27 #include "ui/base/ui_base_paths.h" |
| 26 | 28 |
| 27 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 29 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("Latin")); | 579 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("Latin")); |
| 578 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("German")); | 580 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("German")); |
| 579 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("pt--BR")); | 581 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("pt--BR")); |
| 580 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("sl-macedonia")); | 582 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("sl-macedonia")); |
| 581 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("@")); | 583 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("@")); |
| 582 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@")); | 584 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@")); |
| 583 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x")); | 585 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x")); |
| 584 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x=")); | 586 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x=")); |
| 585 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@=y")); | 587 EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@=y")); |
| 586 } | 588 } |
| 589 |
| 590 // TODO(jungshik): Enable after http://crbug.com/707515 is fixed. |
| 591 TEST_F(L10nUtilTest, DISABLED_TimeDurationFormatAllLocales) { |
| 592 base::test::ScopedRestoreICUDefaultLocale restore_locale; |
| 593 |
| 594 // Verify that base::TimeDurationFormat() works for all available locales: |
| 595 // http://crbug.com/707515 |
| 596 base::TimeDelta kDelta = base::TimeDelta::FromMinutes(15 * 60 + 42); |
| 597 for (const std::string& locale : l10n_util::GetAvailableLocales()) { |
| 598 base::i18n::SetICUDefaultLocale(locale); |
| 599 base::string16 str; |
| 600 const bool result = |
| 601 base::TimeDurationFormat(kDelta, base::DURATION_WIDTH_NUMERIC, &str); |
| 602 EXPECT_TRUE(result) << "Failed to format duration for " << locale; |
| 603 if (result) |
| 604 EXPECT_FALSE(str.empty()) << "Got empty string for " << locale; |
| 605 } |
| 606 } |
| OLD | NEW |