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

Unified Diff: base/synchronization/lock_unittest.cc

Issue 9055001: Change code in base (primarily unit tests) to use Sleep(TimeDelta). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Qualify windows Sleep calls to go through PlatformThread. Created 9 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
Index: base/synchronization/lock_unittest.cc
diff --git a/base/synchronization/lock_unittest.cc b/base/synchronization/lock_unittest.cc
index 5ac3e6b7b1ff7e9c7bba76459dedf3c0424e26b6..1dae49b0437732a18595b37237a76733f10db910 100644
--- a/base/synchronization/lock_unittest.cc
+++ b/base/synchronization/lock_unittest.cc
@@ -25,13 +25,13 @@ class BasicLockTestThread : public PlatformThread::Delegate {
for (int i = 0; i < 10; i++) {
lock_->Acquire();
acquired_++;
- PlatformThread::Sleep(rand() % 20);
+ PlatformThread::Sleep(TimeDelta::FromMilliseconds(rand() % 20));
lock_->Release();
}
for (int i = 0; i < 10; i++) {
if (lock_->Try()) {
acquired_++;
- PlatformThread::Sleep(rand() % 20);
+ PlatformThread::Sleep(TimeDelta::FromMilliseconds(rand() % 20));
lock_->Release();
}
}
@@ -62,20 +62,20 @@ TEST(LockTest, Basic) {
for (int i = 0; i < 10; i++) {
lock.Acquire();
acquired++;
- PlatformThread::Sleep(rand() % 20);
+ PlatformThread::Sleep(TimeDelta::FromMilliseconds(rand() % 20));
lock.Release();
}
for (int i = 0; i < 10; i++) {
if (lock.Try()) {
acquired++;
- PlatformThread::Sleep(rand() % 20);
+ PlatformThread::Sleep(TimeDelta::FromMilliseconds(rand() % 20));
lock.Release();
}
}
for (int i = 0; i < 5; i++) {
lock.Acquire();
acquired++;
- PlatformThread::Sleep(rand() % 20);
+ PlatformThread::Sleep(TimeDelta::FromMilliseconds(rand() % 20));
lock.Release();
}
@@ -154,7 +154,7 @@ class MutexLockTestThread : public PlatformThread::Delegate {
for (int i = 0; i < 40; i++) {
lock->Acquire();
int v = *value;
- PlatformThread::Sleep(rand() % 10);
+ PlatformThread::Sleep(TimeDelta::FromMilliseconds(rand() % 10));
*value = v + 1;
lock->Release();
}
« no previous file with comments | « base/synchronization/condition_variable_unittest.cc ('k') | base/synchronization/waitable_event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698