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..d9881c64d1fb9cf833e476b6f1edd0447ff762ff 100644 |
--- a/base/i18n/time_formatting_unittest.cc |
+++ b/base/i18n/time_formatting_unittest.cc |
@@ -188,6 +188,8 @@ TEST(TimeFormattingTest, MAYBE_TimeFormatDateUS) { |
EXPECT_EQ(ASCIIToUTF16("4/30/11, 3:42:07 PM ") + GetShortTimeZone(time), |
TimeFormatShortDateAndTimeWithTimeZone(time)); |
+ EXPECT_EQ(ASCIIToUTF16("April 2011"), TimeFormatMonthAndYear(time)); |
+ |
EXPECT_EQ(ASCIIToUTF16("Saturday, April 30, 2011 at 3:42:07 PM"), |
TimeFormatFriendlyDateAndTime(time)); |
@@ -215,6 +217,7 @@ TEST(TimeFormattingTest, MAYBE_TimeFormatDateGB) { |
TimeFormatShortDateAndTime(time)); |
EXPECT_EQ(ASCIIToUTF16("30/04/2011, 15:42:07 ") + GetShortTimeZone(time), |
TimeFormatShortDateAndTimeWithTimeZone(time)); |
+ EXPECT_EQ(ASCIIToUTF16("April 2011"), TimeFormatMonthAndYear(time)); |
EXPECT_EQ(ASCIIToUTF16("Saturday, 30 April 2011 at 15:42:07"), |
TimeFormatFriendlyDateAndTime(time)); |
EXPECT_EQ(ASCIIToUTF16("Saturday, 30 April 2011"), |
@@ -265,5 +268,24 @@ TEST(TimeFormattingTest, TimeDurationFormat) { |
EXPECT_EQ(fa_numeric, TimeDurationFormat(delta, DURATION_WIDTH_NUMERIC)); |
} |
+TEST(TimeFormattingTest, TimeIntervalFormat) { |
+ test::ScopedRestoreICUDefaultLocale restore_locale; |
+ i18n::SetICUDefaultLocale("en_US"); |
+ |
+ const Time::Exploded kTestIntervalEndTimeExploded = { |
+ 2011, 5, 6, 28, // Sat, Apr 30, 2012 |
+ 15, 42, 7, 0 // 15:42:07.000 |
+ }; |
+ |
+ Time begin_time; |
+ EXPECT_TRUE(Time::FromLocalExploded(kTestDateTimeExploded, &begin_time)); |
+ Time end_time; |
+ EXPECT_TRUE(Time::FromLocalExploded(kTestIntervalEndTimeExploded, &end_time)); |
+ |
+ EXPECT_EQ( |
+ WideToUTF16(L"Saturday, April 30 – Saturday, May 28"), |
+ DateIntervalFormat(begin_time, end_time, DATE_FORMAT_MONTH_WEEKDAY_DAY)); |
+} |
+ |
} // namespace |
} // namespace base |