diff options
author | jbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-28 22:57:30 +0000 |
---|---|---|
committer | jbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-28 22:57:30 +0000 |
commit | 8e937c1e6a1cf0bdce081324965e105a6b17a3fc (patch) | |
tree | ffec2c670d3ceb188c0c1244b846b15adbe7838e /chrome/test/base/tracing.cc | |
parent | ed50d3ee0ed2e26da0ff805dc52ee0c03f80df2e (diff) | |
download | chromium_src-8e937c1e6a1cf0bdce081324965e105a6b17a3fc.zip chromium_src-8e937c1e6a1cf0bdce081324965e105a6b17a3fc.tar.gz chromium_src-8e937c1e6a1cf0bdce081324965e105a6b17a3fc.tar.bz2 |
Add base::RunLoop and update ui_test_utils to use it to reduce flakiness
Timeout flakiness has been observed in multiple tests that use Quit. This changes various test utility APIs to use QuitNow via base::RunLoop instead. Some instances of Quit are left as-is where it appears they may have a use case.
The ui_test_utils QuitThisRunLoop function does a safer form of MessageLoop::QuitWhenIdle that allows a few generations of tasks to run before actually quitting the MessageLoop. This addresses the design assumptions of many existing tests while hopefully reducing flaky timeouts by moving away from QuitWhenIdle.
This fixes throughput_tests.cc which is currently timing out on Mac.
BUG=124906,130141,131220,128305,132932
Review URL: https://chromiumcodereview.appspot.com/10479018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144824 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/base/tracing.cc')
-rw-r--r-- | chrome/test/base/tracing.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/chrome/test/base/tracing.cc b/chrome/test/base/tracing.cc index 790ab3c..3c29bba 100644 --- a/chrome/test/base/tracing.cc +++ b/chrome/test/base/tracing.cc @@ -38,7 +38,8 @@ class InProcessTraceController : public content::TraceSubscriber { return false; // Wait for OnEndTracingComplete() to quit the message loop. // OnTraceDataCollected may be called multiple times while blocking here. - ui_test_utils::RunMessageLoop(); + message_loop_runner_ = new ui_test_utils::MessageLoopRunner; + message_loop_runner_->Run(); trace_buffer_.Finish(); trace_buffer_.SetOutputCallback(TraceResultBuffer::OutputCallback()); @@ -51,7 +52,7 @@ class InProcessTraceController : public content::TraceSubscriber { // TraceSubscriber virtual void OnEndTracingComplete() OVERRIDE { - MessageLoopForUI::current()->Quit(); + message_loop_runner_->Quit(); } // TraceSubscriber @@ -63,6 +64,8 @@ class InProcessTraceController : public content::TraceSubscriber { // For collecting trace data asynchronously. base::debug::TraceResultBuffer trace_buffer_; + scoped_refptr<ui_test_utils::MessageLoopRunner> message_loop_runner_; + DISALLOW_COPY_AND_ASSIGN(InProcessTraceController); }; |