diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-12 16:33:54 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-12 16:33:54 +0000 |
commit | daa87a6fb3f716a03449d5fd13b82f7698b4a5eb (patch) | |
tree | b03651bc120f1692a86c2baba2a4698fdf87272a /net/disk_cache | |
parent | c78c0e3bee827222b34cd72dcaba23d2fc6bf07e (diff) | |
download | chromium_src-daa87a6fb3f716a03449d5fd13b82f7698b4a5eb.zip chromium_src-daa87a6fb3f716a03449d5fd13b82f7698b4a5eb.tar.gz chromium_src-daa87a6fb3f716a03449d5fd13b82f7698b4a5eb.tar.bz2 |
Fix net_perftests
Without this, I am reliably getting the following crash. It looks like the timer may fire (in the nested MessageLoop run call inside TestCompletionCallback::WaitForResult) before the expected num_callbacks_ gets set.
[ RUN ] DiskCacheTest.CacheBackendPerformance
[18893:18893:0511/165403:1994535049146:FATAL:disk_cache_test_util.cc(174)] Check failed: false.
Backtrace:
base::debug::StackTrace::StackTrace() [0x4ed37e]
logging::LogMessage::~LogMessage() [0x4fdd12]
MessageLoopHelper::TimerExpired() [0x4d2589]
DispatchToMethod<>() [0x4d2b42]
base::BaseTimer<>::TimerTask::Run() [0x4d29d2]
(anonymous namespace)::TaskClosureAdapter::Run() [0x4ffac9]
base::internal::Invoker1<>::DoInvoke() [0x503624]
base::Callback<>::Run() [0x504799]
MessageLoop::RunTask() [0x50241c]
MessageLoop::DeferOrRunPendingTask() [0x502553]
MessageLoop::DoDelayedWork() [0x502f49]
base::MessagePumpLibevent::Run() [0x4d9e8b]
MessageLoop::RunInternal() [0x50222b]
MessageLoop::RunHandler() [0x5020de]
MessageLoop::Run() [0x501af9]
TestCompletionCallback::WaitForResult() [0x4d1681]
TestCompletionCallback::GetResult() [0x4d16e6]
(anonymous namespace)::TimeWrite() [0x4136cc]
DiskCacheTest_CacheBackendPerformance_Test::TestBody() [0x41407b]
testing::internal::HandleSehExceptionsInMethodIfSupported<>() [0x588785]
testing::internal::HandleExceptionsInMethodIfSupported<>() [0x585206]
testing::Test::Run() [0x579066]
testing::TestInfo::Run() [0x57988a]
testing::TestCase::Run() [0x579f80]
testing::internal::UnitTestImpl::RunAllTests() [0x57ed57]
BUG=None
TEST=net_perftests
Review URL: http://codereview.chromium.org/7001028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r-- | net/disk_cache/disk_cache_test_util.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc index 4110f04..aa3efef 100644 --- a/net/disk_cache/disk_cache_test_util.cc +++ b/net/disk_cache/disk_cache_test_util.cc @@ -150,9 +150,6 @@ MessageLoopHelper::MessageLoopHelper() num_iterations_(0), last_(0), completed_(false) { - // Create a recurrent timer of 50 mS. - timer_.Start( - TimeDelta::FromMilliseconds(50), this, &MessageLoopHelper::TimerExpired); } MessageLoopHelper::~MessageLoopHelper() { @@ -163,6 +160,10 @@ bool MessageLoopHelper::WaitUntilCacheIoFinished(int num_callbacks) { return true; ExpectCallbacks(num_callbacks); + // Create a recurrent timer of 50 mS. + if (!timer_.IsRunning()) + timer_.Start(TimeDelta::FromMilliseconds(50), this, + &MessageLoopHelper::TimerExpired); MessageLoop::current()->Run(); return completed_; } @@ -170,9 +171,8 @@ bool MessageLoopHelper::WaitUntilCacheIoFinished(int num_callbacks) { // Quits the message loop when all callbacks are called or we've been waiting // too long for them (2 secs without a callback). void MessageLoopHelper::TimerExpired() { - if (g_cache_tests_received > num_callbacks_) { - NOTREACHED(); - } else if (g_cache_tests_received == num_callbacks_) { + CHECK_LE(g_cache_tests_received, num_callbacks_); + if (g_cache_tests_received == num_callbacks_) { completed_ = true; MessageLoop::current()->Quit(); } else { |