OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/i18n/time_formatting.h" | 5 #include "base/i18n/time_formatting.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 TEST(TimeFormattingTest, TimeFormatDateGB) { | 152 TEST(TimeFormattingTest, TimeFormatDateGB) { |
153 // See third_party/icu/source/data/locales/en_GB.txt. | 153 // See third_party/icu/source/data/locales/en_GB.txt. |
154 // The date patterns are "EEEE, d MMMM y", "d MMM y", and "dd/MM/yyyy". | 154 // The date patterns are "EEEE, d MMMM y", "d MMM y", and "dd/MM/yyyy". |
155 i18n::SetICUDefaultLocale("en_GB"); | 155 i18n::SetICUDefaultLocale("en_GB"); |
156 | 156 |
157 Time time(Time::FromLocalExploded(kTestDateTimeExploded)); | 157 Time time(Time::FromLocalExploded(kTestDateTimeExploded)); |
158 | 158 |
159 EXPECT_EQ(ASCIIToUTF16("30 Apr 2011"), TimeFormatShortDate(time)); | 159 EXPECT_EQ(ASCIIToUTF16("30 Apr 2011"), TimeFormatShortDate(time)); |
160 EXPECT_EQ(ASCIIToUTF16("30/04/2011"), TimeFormatShortDateNumeric(time)); | 160 EXPECT_EQ(ASCIIToUTF16("30/04/2011"), TimeFormatShortDateNumeric(time)); |
161 EXPECT_EQ(ASCIIToUTF16("30/04/2011 15:42:07"), | 161 EXPECT_EQ(ASCIIToUTF16("30/04/2011, 15:42:07"), |
162 TimeFormatShortDateAndTime(time)); | 162 TimeFormatShortDateAndTime(time)); |
163 EXPECT_EQ(ASCIIToUTF16("30/04/2011 15:42:07 ") + GetShortTimeZone(), | 163 EXPECT_EQ(ASCIIToUTF16("30/04/2011, 15:42:07 ") + GetShortTimeZone(), |
164 TimeFormatShortDateAndTimeWithTimeZone(time)); | 164 TimeFormatShortDateAndTimeWithTimeZone(time)); |
165 EXPECT_EQ(ASCIIToUTF16("Saturday, 30 April 2011 15:42:07"), | 165 EXPECT_EQ(ASCIIToUTF16("Saturday, 30 April 2011 at 15:42:07"), |
166 TimeFormatFriendlyDateAndTime(time)); | 166 TimeFormatFriendlyDateAndTime(time)); |
167 EXPECT_EQ(ASCIIToUTF16("Saturday, 30 April 2011"), | 167 EXPECT_EQ(ASCIIToUTF16("Saturday, 30 April 2011"), |
168 TimeFormatFriendlyDate(time)); | 168 TimeFormatFriendlyDate(time)); |
169 } | 169 } |
170 | 170 |
171 } // namespace | 171 } // namespace |
172 } // namespace base | 172 } // namespace base |
OLD | NEW |