Chromium Code Reviews| Index: ui/base/l10n/time_format_unittest.cc |
| diff --git a/ui/base/l10n/time_format_unittest.cc b/ui/base/l10n/time_format_unittest.cc |
| index 6f6acc42cd6008e9ebef23af354c585b88490d89..6aa27812ac9ee7b82212a39f41244ad4c09d2645 100644 |
| --- a/ui/base/l10n/time_format_unittest.cc |
| +++ b/ui/base/l10n/time_format_unittest.cc |
| @@ -27,29 +27,32 @@ void TestTimeFormats(const TimeDelta& delta, const char* expected_ascii) { |
| } |
| TEST(TimeFormat, FormatTime) { |
| - const TimeDelta one_day = TimeDelta::FromDays(1); |
| - const TimeDelta three_days = TimeDelta::FromDays(3); |
| - const TimeDelta one_hour = TimeDelta::FromHours(1); |
| - const TimeDelta four_hours = TimeDelta::FromHours(4); |
| - const TimeDelta one_min = TimeDelta::FromMinutes(1); |
| - const TimeDelta three_mins = TimeDelta::FromMinutes(3); |
| - const TimeDelta one_sec = TimeDelta::FromSeconds(1); |
| - const TimeDelta five_secs = TimeDelta::FromSeconds(5); |
| - const TimeDelta twohundred_millisecs = TimeDelta::FromMilliseconds(200); |
| + const TimeDelta day = TimeDelta::FromDays(1); |
|
bartfab (slow)
2014/01/29 15:40:12
Please re-add the one_ prefixes.
Nit: Do not alig
Thiemo Nagel
2014/01/29 17:40:12
Done.
|
| + const TimeDelta hour = TimeDelta::FromHours(1); |
| + const TimeDelta min = TimeDelta::FromMinutes(1); |
| + const TimeDelta sec = TimeDelta::FromSeconds(1); |
| + const TimeDelta msec = TimeDelta::FromMilliseconds(1); |
| + const TimeDelta zero = TimeDelta::FromMilliseconds(0); |
|
bartfab (slow)
2014/01/29 15:40:12
Nit: You could also write const TimeDelta zero();
Thiemo Nagel
2014/01/29 17:40:12
Done.
|
| // TODO(jungshik) : These test only pass when the OS locale is 'en'. |
| // We need to add SetUp() and TearDown() to set the locale to 'en'. |
| - TestTimeFormats(twohundred_millisecs, "0 secs"); |
| - TestTimeFormats(one_sec - twohundred_millisecs, "0 secs"); |
| - TestTimeFormats(one_sec + twohundred_millisecs, "1 sec"); |
| - TestTimeFormats(five_secs + twohundred_millisecs, "5 secs"); |
| - TestTimeFormats(one_min + five_secs, "1 min"); |
| - TestTimeFormats(three_mins + twohundred_millisecs, "3 mins"); |
| - TestTimeFormats(one_hour + five_secs, "1 hour"); |
| - TestTimeFormats(four_hours + five_secs, "4 hours"); |
| - TestTimeFormats(one_day + five_secs, "1 day"); |
| - TestTimeFormats(three_days, "3 days"); |
| - TestTimeFormats(three_days + four_hours, "3 days"); |
| + TestTimeFormats(zero, "0 secs"); |
| + TestTimeFormats(499*msec, "0 secs"); |
|
bartfab (slow)
2014/01/29 15:40:12
You are missing spaces around the * operators.
Thiemo Nagel
2014/01/29 17:40:12
Done.
|
| + TestTimeFormats(500*msec, "1 sec"); |
| + TestTimeFormats(1*sec + 499*msec, "1 sec"); |
| + TestTimeFormats(1*sec + 500*msec, "2 secs"); |
| + TestTimeFormats(59*sec + 499*msec, "59 secs"); |
| + TestTimeFormats(59*sec + 500*msec, "1 min"); |
| + TestTimeFormats(1*min + 29*sec + 999*msec, "1 min"); |
| + TestTimeFormats(1*min + 30*sec, "2 mins"); |
| + TestTimeFormats(59*min + 29*sec + 999*msec, "59 mins"); |
| + TestTimeFormats(59*min + 30*sec, "1 hour"); |
| + TestTimeFormats(1*hour + 29*min + 59*sec + 999*msec, "1 hour"); |
| + TestTimeFormats(1*hour + 30*min, "2 hours"); |
| + TestTimeFormats(23*hour + 29*min + 59*sec + 999*msec, "23 hours"); |
|
bartfab (slow)
2014/01/29 15:40:12
Nit: Here and elsewhere: You could get the same nu
Thiemo Nagel
2014/01/29 17:40:12
Done.
|
| + TestTimeFormats(23*hour + 30*min, "1 day"); |
| + TestTimeFormats(1*day + 11*hour + 59*min + 59*sec + 999*msec, "1 day"); |
| + TestTimeFormats(1*day + 12*hour, "2 days"); |
| } |
| // crbug.com/159388: This test fails when daylight savings time ends. |