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

Unified Diff: base/threading/thread_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
« no previous file with comments | « base/threading/thread_collision_warner_unittest.cc ('k') | base/threading/watchdog_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/thread_unittest.cc
diff --git a/base/threading/thread_unittest.cc b/base/threading/thread_unittest.cc
index be5ad90fde48c7dd12d414b7469f638f7e57fed0..0444947d4bf491395e42af2797ca8bb97aac477b 100644
--- a/base/threading/thread_unittest.cc
+++ b/base/threading/thread_unittest.cc
@@ -36,7 +36,7 @@ class SleepInsideInitThread : public Thread {
}
virtual void Init() {
- base::PlatformThread::Sleep(500);
+ base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(500));
init_called_ = true;
}
bool InitCalled() { return init_called_; }
@@ -162,7 +162,7 @@ TEST_F(ThreadTest, StartWithOptions_StackSize) {
// instead to avoid busy waiting, but this is sufficient for
// testing purposes).
for (int i = 100; i >= 0 && !was_invoked; --i) {
- base::PlatformThread::Sleep(10);
+ base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10));
}
EXPECT_TRUE(was_invoked);
}
@@ -179,8 +179,10 @@ TEST_F(ThreadTest, TwoTasks) {
// event that will toggle our sentinel value.
a.message_loop()->PostTask(
FROM_HERE,
- base::Bind(static_cast<void (*)(int)>(&base::PlatformThread::Sleep),
- 20));
+ base::Bind(
+ static_cast<void (*)(base::TimeDelta)>(
+ &base::PlatformThread::Sleep),
+ base::TimeDelta::FromMilliseconds(20)));
a.message_loop()->PostTask(FROM_HERE, base::Bind(&ToggleValue,
&was_invoked));
}
« no previous file with comments | « base/threading/thread_collision_warner_unittest.cc ('k') | base/threading/watchdog_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698