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

Unified Diff: base/time/time_unittest.cc

Issue 56973012: Implement Time::ThreadNow() on Mac. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: exclude OS_IOS from the IsThreadNowSupported check Created 7 years, 1 month 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 | « base/time/time_mac.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/time/time_unittest.cc
===================================================================
--- base/time/time_unittest.cc (revision 232726)
+++ base/time/time_unittest.cc (working copy)
@@ -639,12 +639,17 @@
if (TimeTicks::IsThreadNowSupported()) {
TimeTicks begin = TimeTicks::Now();
TimeTicks begin_thread = TimeTicks::ThreadNow();
- // Sleep for 10 milliseconds to get the thread de-scheduled
+ // Make sure that ThreadNow value is non-zero.
+ EXPECT_GT(begin_thread, TimeTicks());
+ // Sleep for 10 milliseconds to get the thread de-scheduled.
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10));
TimeTicks end_thread = TimeTicks::ThreadNow();
TimeTicks end = TimeTicks::Now();
TimeDelta delta = end - begin;
TimeDelta delta_thread = end_thread - begin_thread;
+ // Make sure that some thread time have elapsed.
Nico 2013/11/05 23:20:06 s/have/has/
+ EXPECT_GT(delta_thread.InMicroseconds(), 0);
+ // But the thread time is at least 9ms less than clock time.
TimeDelta difference = delta - delta_thread;
EXPECT_GE(difference.InMicroseconds(), 9000);
}
« no previous file with comments | « base/time/time_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698