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

Unified Diff: third_party/WebKit/Source/wtf/TimeTest.cpp

Issue 2543663002: Provide simple wrappers for base/time types in WTF (Closed)
Patch Set: Consistent mocking Created 4 years 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 | « third_party/WebKit/Source/wtf/Time.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/TimeTest.cpp
diff --git a/third_party/WebKit/Source/wtf/TimeTest.cpp b/third_party/WebKit/Source/wtf/TimeTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f39176c40a2fcb1c8f98c021e7a794844ad2d734
--- /dev/null
+++ b/third_party/WebKit/Source/wtf/TimeTest.cpp
@@ -0,0 +1,31 @@
+#include "wtf/Time.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace WTF {
+namespace {
+
+TEST(TimeTicks, NumericOperations) {
+ TimeTicks zero;
+ ASSERT_EQ(0, zero.ToInternalValueForTesting());
+
+ TimeTicks t1 = zero + TimeDelta::FromMilliseconds(1001);
+ ASSERT_EQ(1001000, t1.ToInternalValueForTesting());
+
+ TimeTicks t2 = zero + TimeDelta::FromSeconds(1);
+ ASSERT_EQ(TimeDelta::FromMilliseconds(1), t1 - t2);
+}
+
+TEST(Time, NumericOperations) {
+ Time zero;
+ ASSERT_EQ(0, zero.ToInternalValueForTesting());
+
+ Time t1 = zero + TimeDelta::FromMilliseconds(1001);
+ ASSERT_EQ(1001000, t1.ToInternalValueForTesting());
+
+ Time t2 = zero + TimeDelta::FromSeconds(1);
+ ASSERT_EQ(TimeDelta::FromMilliseconds(1), t1 - t2);
+}
+
+} // namespace
+} // namespace WTF
« no previous file with comments | « third_party/WebKit/Source/wtf/Time.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698