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

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: Make variable names style guide consistent. Created 8 years, 12 months 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 | « no previous file | base/test/trace_event_analyzer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4d8904e49f92f4de15da6b3cbff475f8879d3ec5 100644
--- a/base/test/test_file_util_win.cc
+++ b/base/test/test_file_util_win.cc
@@ -63,7 +63,9 @@ 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 kIterations = 25;
+ const base::TimeDelta kTimeout = base::TimeDelta::FromSeconds(10) /
+ kIterations;
if (!file_util::PathExists(file))
return true;
@@ -71,10 +73,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 < kIterations; ++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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698