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

Unified Diff: base/i18n/time_formatting_unittest.cc

Issue 2570253002: [MD History] Fix toolbar dates in grouped mode. (Closed)
Patch Set: rebase Created 3 years, 11 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 | « base/i18n/time_formatting.cc ('k') | chrome/browser/resources/history/externs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/i18n/time_formatting_unittest.cc
diff --git a/base/i18n/time_formatting_unittest.cc b/base/i18n/time_formatting_unittest.cc
index e57ac3b5fc302af0c237458eb1d86800688ff1d0..06cd77284a61b388e0f12f13778dda8da3f4862b 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"),
@@ -314,5 +317,24 @@ TEST(TimeFormattingTest, TimeDurationFormatWithSeconds) {
TimeDurationFormatWithSeconds(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
« no previous file with comments | « base/i18n/time_formatting.cc ('k') | chrome/browser/resources/history/externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698