summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/test/test_file_util_win.cc10
-rw-r--r--base/test/trace_event_analyzer_unittest.cc8
2 files changed, 10 insertions, 8 deletions
diff --git a/base/test/test_file_util_win.cc b/base/test/test_file_util_win.cc
index 90df710..70ca907 100644
--- a/base/test/test_file_util_win.cc
+++ b/base/test/test_file_util_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -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;
}
diff --git a/base/test/trace_event_analyzer_unittest.cc b/base/test/trace_event_analyzer_unittest.cc
index 18cf4cb..4c7c73c 100644
--- a/base/test/trace_event_analyzer_unittest.cc
+++ b/base/test/trace_event_analyzer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -389,10 +389,10 @@ TEST_F(TraceEventAnalyzerTest, Duration) {
using namespace trace_analyzer;
ManualSetUp();
- int sleep_time_us = 200000;
+ const base::TimeDelta kSleepTime = base::TimeDelta::FromMilliseconds(200);
// We will search for events that have a duration of greater than 90% of the
// sleep time, so that there is no flakiness.
- int duration_cutoff_us = (sleep_time_us * 9) / 10;
+ int duration_cutoff_us = (kSleepTime.InMicroseconds() * 9) / 10;
BeginTracing();
{
@@ -401,7 +401,7 @@ TEST_F(TraceEventAnalyzerTest, Duration) {
{
TRACE_EVENT0("cat2", "name3"); // found by duration query
TRACE_EVENT_INSTANT0("noise", "name4"); // not searched for, just noise
- base::PlatformThread::Sleep(sleep_time_us / 1000);
+ base::PlatformThread::Sleep(kSleepTime);
TRACE_EVENT0("cat2", "name5"); // not found (duration too short)
}
}