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

Unified Diff: test/cctest/test-time.cc

Issue 23748003: Cleanup Semaphore class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Build fix for Mac OS X. Created 7 years, 3 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 | « test/cctest/test-threads.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-time.cc
diff --git a/test/cctest/test-time.cc b/test/cctest/test-time.cc
index b53ee73ce31f71e397f73c362105694eb00a8ae1..8b92d8d32ac0024409503c0030b95fba4a72c978 100644
--- a/test/cctest/test-time.cc
+++ b/test/cctest/test-time.cc
@@ -56,6 +56,18 @@ TEST(TimeDeltaFromAndIn) {
}
+#if V8_OS_MACOSX
+TEST(TimeDeltaFromMachTimespec) {
+ TimeDelta null = TimeDelta();
+ CHECK(null == TimeDelta::FromMachTimespec(null.ToMachTimespec()));
+ TimeDelta delta1 = TimeDelta::FromMilliseconds(42);
+ CHECK(delta1 == TimeDelta::FromMachTimespec(delta1.ToMachTimespec()));
+ TimeDelta delta2 = TimeDelta::FromDays(42);
+ CHECK(delta2 == TimeDelta::FromMachTimespec(delta2.ToMachTimespec()));
+}
+#endif
+
+
TEST(TimeJsTime) {
Time t = Time::FromJsTime(700000.3);
CHECK_EQ(700000.3, t.ToJsTime());
@@ -63,7 +75,23 @@ TEST(TimeJsTime) {
#if V8_OS_POSIX
-TEST(TimeFromTimeVal) {
+TEST(TimeFromTimespec) {
+ Time null;
+ CHECK(null.IsNull());
+ CHECK(null == Time::FromTimespec(null.ToTimespec()));
+ Time now = Time::Now();
+ CHECK(now == Time::FromTimespec(now.ToTimespec()));
+ Time now_sys = Time::NowFromSystemTime();
+ CHECK(now_sys == Time::FromTimespec(now_sys.ToTimespec()));
+ Time unix_epoch = Time::UnixEpoch();
+ CHECK(unix_epoch == Time::FromTimespec(unix_epoch.ToTimespec()));
+ Time max = Time::Max();
+ CHECK(max.IsMax());
+ CHECK(max == Time::FromTimespec(max.ToTimespec()));
+}
+
+
+TEST(TimeFromTimeval) {
Time null;
CHECK(null.IsNull());
CHECK(null == Time::FromTimeval(null.ToTimeval()));
« no previous file with comments | « test/cctest/test-threads.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698