From 736f434fb17fd92e2856d7c2d5c28bea71fdebe3 Mon Sep 17 00:00:00 2001 From: "deanm@google.com" Date: Wed, 3 Sep 2008 18:18:32 +0000 Subject: Add at least some code that tests UnreliableHighResNow. I realize it can be broken, but we should test it if we're going to have the code. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1685 0039d316-1c4b-4281-b951-d872f2087c98 --- base/time_unittest.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'base/time_unittest.cc') diff --git a/base/time_unittest.cc b/base/time_unittest.cc index 3cd9595..039913b 100644 --- a/base/time_unittest.cc +++ b/base/time_unittest.cc @@ -95,6 +95,14 @@ TEST(TimeTicks, Deltas) { EXPECT_EQ(delta.InSeconds(), 0); } +TEST(TimeTicks, UnreliableHighResNow) { + TimeTicks ticks_start = TimeTicks::UnreliableHighResNow(); + PlatformThread::Sleep(10); + TimeTicks ticks_stop = TimeTicks::UnreliableHighResNow(); + TimeDelta delta = ticks_stop - ticks_start; + EXPECT_GE(delta.InMilliseconds(), 10); +} + TEST(TimeDelta, FromAndIn) { EXPECT_TRUE(TimeDelta::FromDays(2) == TimeDelta::FromHours(48)); EXPECT_TRUE(TimeDelta::FromHours(3) == TimeDelta::FromMinutes(180)); -- cgit v1.1