| Index: base/time_unittest.cc
|
| diff --git a/base/time_unittest.cc b/base/time_unittest.cc
|
| index 9823147a33dac223d224726b3c988676cf8e7be6..b4b166be75ee1c9deaeab9bcb07b09f4ab7e1eaa 100644
|
| --- a/base/time_unittest.cc
|
| +++ b/base/time_unittest.cc
|
| @@ -464,7 +464,7 @@ TEST(TimeTicks, Deltas) {
|
| }
|
| }
|
|
|
| -TEST(TimeTicks, HighResNow) {
|
| +static void HighResClockTest(TimeTicks (*GetTicks)()) {
|
| #if defined(OS_WIN)
|
| // HighResNow doesn't work on some systems. Since the product still works
|
| // even if it doesn't work, it makes this entire test questionable.
|
| @@ -486,12 +486,12 @@ TEST(TimeTicks, HighResNow) {
|
| int retries = 100; // Arbitrary.
|
| TimeDelta delta;
|
| while (!success && retries--) {
|
| - TimeTicks ticks_start = TimeTicks::HighResNow();
|
| + TimeTicks ticks_start = GetTicks();
|
| // Loop until we can detect that the clock has changed. Non-HighRes timers
|
| // will increment in chunks, e.g. 15ms. By spinning until we see a clock
|
| // change, we detect the minimum time between measurements.
|
| do {
|
| - delta = TimeTicks::HighResNow() - ticks_start;
|
| + delta = GetTicks() - ticks_start;
|
| } while (delta.InMilliseconds() == 0);
|
|
|
| if (delta.InMicroseconds() <= kTargetGranularityUs)
|
| @@ -503,6 +503,15 @@ TEST(TimeTicks, HighResNow) {
|
| EXPECT_TRUE(success);
|
| }
|
|
|
| +TEST(TimeTicks, HighResNow) {
|
| + HighResClockTest(&TimeTicks::HighResNow);
|
| +}
|
| +
|
| +TEST(TimeTicks, NowFromSystemTraceTime) {
|
| + // Re-use HighResNow test for now since clock properties are identical.
|
| + HighResClockTest(&TimeTicks::NowFromSystemTraceTime);
|
| +}
|
| +
|
| TEST(TimeDelta, FromAndIn) {
|
| EXPECT_TRUE(TimeDelta::FromDays(2) == TimeDelta::FromHours(48));
|
| EXPECT_TRUE(TimeDelta::FromHours(3) == TimeDelta::FromMinutes(180));
|
|
|