Chromium Code Reviews| Index: base/i18n/time_formatting_unittest.cc |
| diff --git a/base/i18n/time_formatting_unittest.cc b/base/i18n/time_formatting_unittest.cc |
| index 51a48513aca6c10d4610501f4f29a861dc0a1fb9..0c80d1026bf9c4c1f037a67919814a51c4193602 100644 |
| --- a/base/i18n/time_formatting_unittest.cc |
| +++ b/base/i18n/time_formatting_unittest.cc |
| @@ -265,5 +265,21 @@ TEST(TimeFormattingTest, TimeDurationFormat) { |
| EXPECT_EQ(fa_numeric, TimeDurationFormat(delta, DURATION_WIDTH_NUMERIC)); |
| } |
| +TEST(TimeFormattingTest, TimeDurationWFormatWithSecondPrecison) { |
| + test::ScopedRestoreICUDefaultLocale restore_locale; |
| + TimeDelta delta = TimeDelta::FromSeconds(15 * 3600 + 42 * 60 + 30); |
| + |
| + // US English. |
| + i18n::SetICUDefaultLocale("en_US"); |
| + EXPECT_EQ(ASCIIToUTF16("15 hours, 42 minutes, 30 seconds"), |
|
brucedawson
2016/12/19 21:51:05
Should add some tests for times like 15 hours, 0 m
chengx
2016/12/20 00:51:12
Done.
|
| + TimeDurationWFormatWithSecondPrecison(delta, DURATION_WIDTH_WIDE)); |
| + EXPECT_EQ(ASCIIToUTF16("15 hr, 42 min, 30 sec"), |
| + TimeDurationWFormatWithSecondPrecison(delta, DURATION_WIDTH_SHORT)); |
| + EXPECT_EQ(ASCIIToUTF16("15h 42m 30s"), TimeDurationWFormatWithSecondPrecison( |
| + delta, DURATION_WIDTH_NARROW)); |
| + EXPECT_EQ(ASCIIToUTF16("15:42:30"), TimeDurationWFormatWithSecondPrecison( |
|
stanisc
2016/12/19 22:44:10
Should add tests for times with greater than 24 or
chengx
2016/12/20 00:51:12
Actually we have a bug in //base that when the hou
|
| + delta, DURATION_WIDTH_NUMERIC)); |
| +} |
| + |
| } // namespace |
| } // namespace base |