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

Side by Side Diff: base/time_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/platform_thread.h" 7 #include "base/platform_thread.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 using base::Time;
13 using base::TimeDelta;
14 using base::TimeTicks;
15
12 // Test conversions to/from time_t and exploding/unexploding. 16 // Test conversions to/from time_t and exploding/unexploding.
13 TEST(Time, TimeT) { 17 TEST(Time, TimeT) {
14 // C library time and exploded time. 18 // C library time and exploded time.
15 time_t now_t_1 = time(NULL); 19 time_t now_t_1 = time(NULL);
16 struct tm tms; 20 struct tm tms;
17 #if defined(OS_WIN) 21 #if defined(OS_WIN)
18 localtime_s(&tms, &now_t_1); 22 localtime_s(&tms, &now_t_1);
19 #elif defined(OS_POSIX) 23 #elif defined(OS_POSIX)
20 localtime_r(&now_t_1, &tms); 24 localtime_r(&now_t_1, &tms);
21 #endif 25 #endif
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 TimeDelta::FromMicroseconds(2000)); 133 TimeDelta::FromMicroseconds(2000));
130 EXPECT_EQ(13, TimeDelta::FromDays(13).InDays()); 134 EXPECT_EQ(13, TimeDelta::FromDays(13).InDays());
131 EXPECT_EQ(13, TimeDelta::FromHours(13).InHours()); 135 EXPECT_EQ(13, TimeDelta::FromHours(13).InHours());
132 EXPECT_EQ(13, TimeDelta::FromMinutes(13).InMinutes()); 136 EXPECT_EQ(13, TimeDelta::FromMinutes(13).InMinutes());
133 EXPECT_EQ(13, TimeDelta::FromSeconds(13).InSeconds()); 137 EXPECT_EQ(13, TimeDelta::FromSeconds(13).InSeconds());
134 EXPECT_EQ(13.0, TimeDelta::FromSeconds(13).InSecondsF()); 138 EXPECT_EQ(13.0, TimeDelta::FromSeconds(13).InSecondsF());
135 EXPECT_EQ(13, TimeDelta::FromMilliseconds(13).InMilliseconds()); 139 EXPECT_EQ(13, TimeDelta::FromMilliseconds(13).InMilliseconds());
136 EXPECT_EQ(13.0, TimeDelta::FromMilliseconds(13).InMillisecondsF()); 140 EXPECT_EQ(13.0, TimeDelta::FromMilliseconds(13).InMillisecondsF());
137 EXPECT_EQ(13, TimeDelta::FromMicroseconds(13).InMicroseconds()); 141 EXPECT_EQ(13, TimeDelta::FromMicroseconds(13).InMicroseconds());
138 } 142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698