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

Unified Diff: base/test/test_file_util_win.cc

Issue 9057001: Update Sleep() calls in base/test to use TimeDelta instead of int. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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/test/test_file_util_win.cc
diff --git a/base/test/test_file_util_win.cc b/base/test/test_file_util_win.cc
index 90df710d22ccf6160e5c234c24399270eecd1d21..884a3afe195c80815afc246c0b1b2b21298d8e4b 100644
--- a/base/test/test_file_util_win.cc
+++ b/base/test/test_file_util_win.cc
@@ -63,7 +63,8 @@ bool DenyFilePermission(const FilePath& path, DWORD permission) {
bool DieFileDie(const FilePath& file, bool recurse) {
// It turns out that to not induce flakiness a long timeout is needed.
- const int kTimeoutMs = 10000;
+ const int iters = 25;
Paweł Hajdan Jr. 2012/01/03 08:06:46 nit: No abbreviations, also if this is a constant
+ const base::TimeDelta kTimeout = base::TimeDelta::FromSeconds(10) / iters;
if (!file_util::PathExists(file))
return true;
@@ -71,10 +72,10 @@ bool DieFileDie(const FilePath& file, bool recurse) {
// Sometimes Delete fails, so try a few more times. Divide the timeout
// into short chunks, so that if a try succeeds, we won't delay the test
// for too long.
- for (int i = 0; i < 25; ++i) {
+ for (int i = 0; i < iters; ++i) {
if (file_util::Delete(file, recurse))
return true;
- base::PlatformThread::Sleep(kTimeoutMs / 25);
+ base::PlatformThread::Sleep(kTimeout);
}
return false;
}
« no previous file with comments | « no previous file | base/test/trace_event_analyzer_unittest.cc » ('j') | base/test/trace_event_analyzer_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698