Index: base/time_unittest.cc |
diff --git a/base/time_unittest.cc b/base/time_unittest.cc |
index cb1f839b5baa6adabcdd6bd4a6d66659b8d080aa..f89fc8bee3831f6c43125b61d57a021dd027f4aa 100644 |
--- a/base/time_unittest.cc |
+++ b/base/time_unittest.cc |
@@ -88,6 +88,16 @@ TEST_F(TimeTest, TimeT) { |
EXPECT_EQ(0, Time::FromTimeT(0).ToInternalValue()); |
} |
+// Test conversions to/from javascript time. |
+TEST_F(TimeTest, JsTime) { |
+ Time epoch = Time::FromJsTime(0.0); |
+ EXPECT_EQ(epoch, Time::UnixEpoch()); |
+ Time t = Time::FromJsTime(700000.3); |
+ EXPECT_EQ(700.0003, t.ToDoubleT()); |
+ t = Time::FromDoubleT(800.73); |
+ EXPECT_EQ(800730.0, t.ToJsTime()); |
+} |
+ |
TEST_F(TimeTest, FromExplodedWithMilliseconds) { |
// Some platform implementations of FromExploded are liable to drop |
// milliseconds if we aren't careful. |