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

Unified Diff: base/i18n/time_formatting_unittest.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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') | base/ios/crb_protocol_observers.h » ('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 0c2a6e6b852e950201937f8cb681d10f6fb0466d..4739b62a740a7e91c0d74601babb3cd9b335dad5 100644
--- a/base/i18n/time_formatting_unittest.cc
+++ b/base/i18n/time_formatting_unittest.cc
@@ -5,10 +5,13 @@
#include "base/i18n/time_formatting.h"
#include "base/i18n/rtl.h"
+#include "base/memory/scoped_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/icu/source/common/unicode/uversion.h"
+#include "third_party/icu/source/i18n/unicode/calendar.h"
+#include "third_party/icu/source/i18n/unicode/timezone.h"
namespace base {
namespace {
@@ -18,6 +21,13 @@ const Time::Exploded kTestDateTimeExploded = {
15, 42, 7, 0 // 15:42:07.000
};
+base::string16 GetShortTimeZone() {
+ scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
+ icu::UnicodeString name;
+ zone->getDisplayName(true, icu::TimeZone::SHORT, name);
+ return base::string16(name.getBuffer(), name.length());
+}
+
TEST(TimeFormattingTest, TimeFormatTimeOfDayDefault12h) {
// Test for a locale defaulted to 12h clock.
// As an instance, we use third_party/icu/source/data/locales/en.txt.
@@ -129,6 +139,8 @@ TEST(TimeFormattingTest, TimeFormatDateUS) {
EXPECT_EQ(ASCIIToUTF16("4/30/11, 3:42:07 PM"),
TimeFormatShortDateAndTime(time));
+ EXPECT_EQ(ASCIIToUTF16("4/30/11, 3:42:07 PM ") + GetShortTimeZone(),
+ TimeFormatShortDateAndTimeWithTimeZone(time));
EXPECT_EQ(ASCIIToUTF16("Saturday, April 30, 2011 at 3:42:07 PM"),
TimeFormatFriendlyDateAndTime(time));
@@ -148,6 +160,8 @@ TEST(TimeFormattingTest, TimeFormatDateGB) {
EXPECT_EQ(ASCIIToUTF16("30/04/2011"), TimeFormatShortDateNumeric(time));
EXPECT_EQ(ASCIIToUTF16("30/04/2011 15:42:07"),
TimeFormatShortDateAndTime(time));
+ EXPECT_EQ(ASCIIToUTF16("30/04/2011 15:42:07 ") + GetShortTimeZone(),
+ TimeFormatShortDateAndTimeWithTimeZone(time));
EXPECT_EQ(ASCIIToUTF16("Saturday, 30 April 2011 15:42:07"),
TimeFormatFriendlyDateAndTime(time));
EXPECT_EQ(ASCIIToUTF16("Saturday, 30 April 2011"),
« no previous file with comments | « base/i18n/time_formatting.cc ('k') | base/ios/crb_protocol_observers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698