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

Unified Diff: ui/base/l10n/l10n_util_unittest.cc

Issue 2793613004: Add test for TimeDurationFormat() error. (Closed)
Patch Set: disable test Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/l10n/l10n_util_unittest.cc
diff --git a/ui/base/l10n/l10n_util_unittest.cc b/ui/base/l10n/l10n_util_unittest.cc
index ee81f036888feb8f1409e87b48f6152c94912afc..4d7a248e03aee051d160ca11c7c19cab1eb2da10 100644
--- a/ui/base/l10n/l10n_util_unittest.cc
+++ b/ui/base/l10n/l10n_util_unittest.cc
@@ -10,11 +10,13 @@
#include "base/files/file_util.h"
#include "base/i18n/case_conversion.h"
#include "base/i18n/rtl.h"
+#include "base/i18n/time_formatting.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/test/icu_test_util.h"
#include "base/test/scoped_path_override.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -584,3 +586,21 @@ TEST_F(L10nUtilTest, IsValidLocaleSyntax) {
EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@x="));
EXPECT_FALSE(l10n_util::IsValidLocaleSyntax("en-US@=y"));
}
+
+// TODO(jungshik): Enable after http://crbug.com/707515 is fixed.
+TEST_F(L10nUtilTest, DISABLED_TimeDurationFormatAllLocales) {
+ base::test::ScopedRestoreICUDefaultLocale restore_locale;
+
+ // Verify that base::TimeDurationFormat() works for all available locales:
+ // http://crbug.com/707515
+ base::TimeDelta kDelta = base::TimeDelta::FromMinutes(15 * 60 + 42);
+ for (const std::string& locale : l10n_util::GetAvailableLocales()) {
+ base::i18n::SetICUDefaultLocale(locale);
+ base::string16 str;
+ const bool result =
+ base::TimeDurationFormat(kDelta, base::DURATION_WIDTH_NUMERIC, &str);
+ EXPECT_TRUE(result) << "Failed to format duration for " << locale;
+ if (result)
+ EXPECT_FALSE(str.empty()) << "Got empty string for " << locale;
+ }
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698