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

Side by Side Diff: chrome/common/time_format_unittest.cc

Issue 7995: Move Time, TimeDelta and TimeTicks into namespace base. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <time.h> 5 #include <time.h>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "chrome/common/l10n_util.h" 9 #include "chrome/common/l10n_util.h"
10 #include "chrome/common/time_format.h" 10 #include "chrome/common/time_format.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 using base::Time;
14 using base::TimeDelta;
15
13 TEST(TimeFormat, RelativeDate) { 16 TEST(TimeFormat, RelativeDate) {
14 Time now = Time::Now(); 17 Time now = Time::Now();
15 std::wstring today_str = TimeFormat::RelativeDate(now, NULL); 18 std::wstring today_str = TimeFormat::RelativeDate(now, NULL);
16 EXPECT_EQ(L"Today", today_str); 19 EXPECT_EQ(L"Today", today_str);
17 20
18 Time yesterday = now - TimeDelta::FromDays(1); 21 Time yesterday = now - TimeDelta::FromDays(1);
19 std::wstring yesterday_str = TimeFormat::RelativeDate(yesterday, NULL); 22 std::wstring yesterday_str = TimeFormat::RelativeDate(yesterday, NULL);
20 EXPECT_EQ(L"Yesterday", yesterday_str); 23 EXPECT_EQ(L"Yesterday", yesterday_str);
21 24
22 Time two_days_ago = now - TimeDelta::FromDays(2); 25 Time two_days_ago = now - TimeDelta::FromDays(2);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 TestRemainingTime(one_min + five_secs, L"1 min", L"1 min left"); 61 TestRemainingTime(one_min + five_secs, L"1 min", L"1 min left");
59 TestRemainingTime(three_mins + twohundred_millisecs, 62 TestRemainingTime(three_mins + twohundred_millisecs,
60 L"3 mins", L"3 mins left"); 63 L"3 mins", L"3 mins left");
61 TestRemainingTime(one_hour + five_secs, L"1 hour", L"1 hour left"); 64 TestRemainingTime(one_hour + five_secs, L"1 hour", L"1 hour left");
62 TestRemainingTime(four_hours + five_secs, L"4 hours", L"4 hours left"); 65 TestRemainingTime(four_hours + five_secs, L"4 hours", L"4 hours left");
63 TestRemainingTime(one_day + five_secs, L"1 day", L"1 day left"); 66 TestRemainingTime(one_day + five_secs, L"1 day", L"1 day left");
64 TestRemainingTime(three_days, L"3 days", L"3 days left"); 67 TestRemainingTime(three_days, L"3 days", L"3 days left");
65 TestRemainingTime(three_days + four_hours, L"3 days", L"3 days left"); 68 TestRemainingTime(three_days + four_hours, L"3 days", L"3 days left");
66 } 69 }
67 70
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698