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

Unified Diff: chrome/browser/chromeos/gdata/gdata_util_unittest.cc

Issue 10542076: ABANDONED: chromeos: Download contacts (work in progress). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor changes Created 8 years, 5 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 | « chrome/browser/chromeos/gdata/gdata_util.cc ('k') | chrome/browser/chromeos/gdata/operations_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/gdata_util_unittest.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_util_unittest.cc b/chrome/browser/chromeos/gdata/gdata_util_unittest.cc
index c37df86dcdbb96c0d168d7382a8b48e599c701e7..5a198f7d100996d822b0da1cd9994f7a02c91d7b 100644
--- a/chrome/browser/chromeos/gdata/gdata_util_unittest.cc
+++ b/chrome/browser/chromeos/gdata/gdata_util_unittest.cc
@@ -6,6 +6,7 @@
#include "base/file_path.h"
#include "base/i18n/time_formatting.h"
+#include "base/stringprintf.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/system/timezone_settings.h"
@@ -14,6 +15,19 @@
namespace gdata {
namespace util {
+namespace {
+
+// Formats |time|'s UTC representation as "2012-07-16 15:25:13:528".
+std::string FormatTimeAsUTCString(const base::Time& time) {
+ base::Time::Exploded exploded;
+ time.UTCExplode(&exploded);
+ return base::StringPrintf(
+ "%04d-%02d-%02d %02d:%02d:%02d.%03d",
+ exploded.year, exploded.month, exploded.day_of_month,
+ exploded.hour, exploded.minute, exploded.second, exploded.millisecond);
+}
+
+} // namespace
namespace {
@@ -171,5 +185,11 @@ TEST(GDataUtilTest, GetTimeFromString) {
FormatTime(test_time));
}
+TEST(GDataUtilTest, FormatTimeAsString) {
+ base::Time::Exploded exploded_time = {2012, 7, 0, 19, 15, 59, 13, 123};
+ base::Time time = base::Time::FromUTCExploded(exploded_time);
+ EXPECT_EQ("2012-07-19T15:59:13.123Z", FormatTimeAsString(time));
+}
+
} // namespace util
} // namespace gdata
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_util.cc ('k') | chrome/browser/chromeos/gdata/operations_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698