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

Unified Diff: base/process_util_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/process_util_posix.cc ('k') | base/shared_memory_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_unittest.cc
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index 36d48b6e4027ae2513a88aafabdb56495457ff6f..426a78fe5943e294af01b04c955cb79ca9160dd5 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -74,7 +74,7 @@ const int kExpectedStillRunningExitCode = 0;
void WaitToDie(const char* filename) {
FILE *fp;
do {
- base::PlatformThread::Sleep(10);
+ base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10));
fp = fopen(filename, "r");
} while (!fp);
fclose(fp);
@@ -95,14 +95,14 @@ base::TerminationStatus WaitForChildTermination(base::ProcessHandle handle,
int* exit_code) {
// Now we wait until the result is something other than STILL_RUNNING.
base::TerminationStatus status = base::TERMINATION_STATUS_STILL_RUNNING;
- const int kIntervalMs = 20;
- int waited = 0;
+ const base::TimeDelta kInterval = base::TimeDelta::FromMilliseconds(20);
+ base::TimeDelta waited;
do {
status = base::GetTerminationStatus(handle, exit_code);
- base::PlatformThread::Sleep(kIntervalMs);
- waited += kIntervalMs;
+ base::PlatformThread::Sleep(kInterval);
+ waited += kInterval;
} while (status == base::TERMINATION_STATUS_STILL_RUNNING &&
- waited < TestTimeouts::action_max_timeout_ms());
+ waited.InMilliseconds() < TestTimeouts::action_max_timeout_ms());
return status;
}
« no previous file with comments | « base/process_util_posix.cc ('k') | base/shared_memory_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698