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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_util_unittest.cc

Issue 10790124: chromeos: Add gdata::util::FormatTimeAsString(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/gdata/gdata_util.h" 5 #include "chrome/browser/chromeos/gdata/gdata_util.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/i18n/time_formatting.h" 8 #include "base/i18n/time_formatting.h"
9 #include "base/stringprintf.h"
9 #include "base/time.h" 10 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/chromeos/system/timezone_settings.h" 12 #include "chrome/browser/chromeos/system/timezone_settings.h"
12 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 namespace gdata { 16 namespace gdata {
16 namespace util { 17 namespace util {
17
18 namespace { 18 namespace {
19 19
20 std::string FormatTime(const base::Time& time) { 20 std::string FormatTime(const base::Time& time) {
21 return UTF16ToUTF8(TimeFormatShortDateAndTime(time)); 21 return UTF16ToUTF8(TimeFormatShortDateAndTime(time));
22 } 22 }
23 23
24 } // namespace 24 } // namespace
25 25
26 TEST(GDataUtilTest, IsUnderGDataMountPoint) { 26 TEST(GDataUtilTest, IsUnderGDataMountPoint) {
27 EXPECT_FALSE(IsUnderGDataMountPoint( 27 EXPECT_FALSE(IsUnderGDataMountPoint(
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 EXPECT_TRUE(GetTimeFromString("2005-08-09T09:57:00-08:00", &test_time)); 164 EXPECT_TRUE(GetTimeFromString("2005-08-09T09:57:00-08:00", &test_time));
165 EXPECT_EQ(FormatTime(base::Time::FromUTCExploded(target_time2)), 165 EXPECT_EQ(FormatTime(base::Time::FromUTCExploded(target_time2)),
166 FormatTime(test_time)); 166 FormatTime(test_time));
167 167
168 base::Time::Exploded target_time3 = {2005, 1, 0, 7, 8, 2, 0, 123}; 168 base::Time::Exploded target_time3 = {2005, 1, 0, 7, 8, 2, 0, 123};
169 EXPECT_TRUE(GetTimeFromString("2005-01-07T08:02:00.123Z", &test_time)); 169 EXPECT_TRUE(GetTimeFromString("2005-01-07T08:02:00.123Z", &test_time));
170 EXPECT_EQ(FormatTime(base::Time::FromUTCExploded(target_time3)), 170 EXPECT_EQ(FormatTime(base::Time::FromUTCExploded(target_time3)),
171 FormatTime(test_time)); 171 FormatTime(test_time));
172 } 172 }
173 173
174 TEST(GDataUtilTest, FormatTimeAsString) {
175 base::Time::Exploded exploded_time = {2012, 7, 0, 19, 15, 59, 13, 123};
176 base::Time time = base::Time::FromUTCExploded(exploded_time);
177 EXPECT_EQ("2012-07-19T15:59:13.123Z", FormatTimeAsString(time));
178 }
179
174 } // namespace util 180 } // namespace util
175 } // namespace gdata 181 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698