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

Unified Diff: base/i18n/time_formatting_unittest.cc

Issue 2607043002: [Autofill] Credit Card Autofill Last Used Date Experiment (Closed)
Patch Set: Added unittest dependency 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
Index: base/i18n/time_formatting_unittest.cc
diff --git a/base/i18n/time_formatting_unittest.cc b/base/i18n/time_formatting_unittest.cc
index 06cd77284a61b388e0f12f13778dda8da3f4862b..74d0e4fa3897b1b8a395b9056809b555b25e5f1f 100644
--- a/base/i18n/time_formatting_unittest.cc
+++ b/base/i18n/time_formatting_unittest.cc
@@ -224,6 +224,33 @@ TEST(TimeFormattingTest, MAYBE_TimeFormatDateGB) {
TimeFormatFriendlyDate(time));
}
+TEST(TimeFormattingTest, TimeFormatWithPattern) {
+ test::ScopedRestoreICUDefaultLocale restore_locale;
+
+ Time time;
+ EXPECT_TRUE(Time::FromLocalExploded(kTestDateTimeExploded, &time));
+
+ i18n::SetICUDefaultLocale("en_US");
+ EXPECT_EQ(ASCIIToUTF16("Apr 30, 2011"), TimeFormatWithPattern(time, "yMMMd"));
+ EXPECT_EQ(ASCIIToUTF16("April 30, 3:42:07 PM"),
+ TimeFormatWithPattern(time, "MMMMdjmmss"));
+
+ i18n::SetICUDefaultLocale("en_GB");
+ EXPECT_EQ(ASCIIToUTF16("30 Apr 2011"), TimeFormatWithPattern(time, "yMMMd"));
+ EXPECT_EQ(ASCIIToUTF16("30 April, 15:42:07"),
+ TimeFormatWithPattern(time, "MMMMdjmmss"));
+
+ i18n::SetICUDefaultLocale("ja_JP");
+ EXPECT_EQ(WideToUTF16(L"2011\x5e74"
+ L"4\x6708"
+ L"30\x65e5"),
+ TimeFormatWithPattern(time, "yMMMd"));
+ EXPECT_EQ(WideToUTF16(L"4\x6708"
+ L"30\x65e5") +
+ ASCIIToUTF16(" 15:42:07"),
+ TimeFormatWithPattern(time, "MMMMdjmmss"));
+}
+
TEST(TimeFormattingTest, TimeDurationFormat) {
test::ScopedRestoreICUDefaultLocale restore_locale;
TimeDelta delta = TimeDelta::FromMinutes(15 * 60 + 42);

Powered by Google App Engine
This is Rietveld 408576698