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

Issue 10479018: Add base::RunLoop and update ui_test_utils to use it to reduce flakiness (Closed)

Created:
8 years, 6 months ago by jbates
Modified:
8 years, 5 months ago
CC:
chromium-reviews
Visibility:
Public.

Description

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 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=144824

Patch Set 1 #

Patch Set 2 : remove printfs #

Patch Set 3 : change Quit to QuitNow in places where it makes sense #

Total comments: 6

Patch Set 4 : using QuitAfterPending instead of QuitNow #

Patch Set 5 : narrowed changes a bit and fixed a test #

Patch Set 6 : more test fixes #

Patch Set 7 : more test fixes #

Total comments: 9

Patch Set 8 : more test fixes #

Patch Set 9 : more test fixes, MessageLoop::QuitNowByID #

Patch Set 10 : cleanup #

Patch Set 11 : cleanup #

Patch Set 12 : added printfs to debug timeout which doesn't happen locally #

Total comments: 26

Patch Set 13 : checkpoint with MessageLoop::GetUniqueRunID #

Patch Set 14 : jar feedback #

Patch Set 15 : sync #

Patch Set 16 : jar feedback - RunID switch #

Patch Set 17 : clang, android compile #

Patch Set 18 : clang compile #

Patch Set 19 : win_shared build #

Total comments: 22

Patch Set 20 : jar, phajdan feedback #

Total comments: 2

Patch Set 21 : checkpoint #

Patch Set 22 : fetch/merge, no change #

Total comments: 1

Patch Set 23 : compile #

Patch Set 24 : android compile #

Total comments: 9

Patch Set 25 : darin feedback #

Total comments: 30

Patch Set 26 : jar feedback, compile errors #

Total comments: 6

Patch Set 27 : compile, 5->20 quit deferrals, reenabled throughput tests #

Patch Set 28 : jar, willchan, darin feedback #

Patch Set 29 : update/merge - no change #

Patch Set 30 : replaced usage of MLUI::RunWithDispatcher with RunLoop #

Patch Set 31 : aura compile #

Patch Set 32 : win compile #

Patch Set 33 : win compile #

Total comments: 10

Patch Set 34 : phajdan feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+991 lines, -386 lines) Patch
M ash/accelerators/nested_dispatcher_controller.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2 chunks +5 lines, -1 line 0 comments Download
M ash/drag_drop/drag_drop_controller.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2 chunks +4 lines, -0 lines 0 comments Download
M ash/drag_drop/drag_drop_controller.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 4 chunks +6 lines, -3 lines 0 comments Download
M ash/test/ash_test_base.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 2 chunks +4 lines, -2 lines 0 comments Download
M ash/wm/toplevel_window_event_filter.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2 chunks +3 lines, -0 lines 0 comments Download
M ash/wm/toplevel_window_event_filter.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 5 chunks +7 lines, -4 lines 0 comments Download
M base/base.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +2 lines, -0 lines 0 comments Download
M base/message_loop.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 6 chunks +39 lines, -45 lines 0 comments Download
M base/message_loop.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 13 chunks +23 lines, -60 lines 0 comments Download
M base/message_loop_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 11 chunks +360 lines, -18 lines 0 comments Download
M base/message_pump_android.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2 chunks +2 lines, -2 lines 0 comments Download
M base/message_pump_android.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 4 chunks +11 lines, -5 lines 0 comments Download
M base/message_pump_dispatcher.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +5 lines, -6 lines 0 comments Download
A base/run_loop.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 chunk +112 lines, -0 lines 0 comments Download
A base/run_loop.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 chunk +94 lines, -0 lines 0 comments Download
M base/test/test_support_android.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/autocomplete/search_provider_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/automation/automation_provider_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 4 chunks +20 lines, -3 lines 0 comments Download
M chrome/browser/chrome_browser_main.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2 chunks +7 lines, -8 lines 0 comments Download
M chrome/browser/referrer_policy_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 4 chunks +4 lines, -8 lines 0 comments Download
M chrome/browser/tab_contents/render_view_context_menu_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/tab_contents/render_view_context_menu_browsertest_util.h View 1 2 3 4 5 6 7 8 2 chunks +1 line, -10 lines 0 comments Download
M chrome/browser/tab_contents/render_view_context_menu_browsertest_util.cc View 1 2 3 4 5 6 7 8 14 15 16 17 18 19 20 21 22 23 24 25 3 chunks +2 lines, -27 lines 0 comments Download
M chrome/browser/ui/views/simple_message_box_views.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 2 chunks +3 lines, -1 line 0 comments Download
M chrome/browser/ui/views/uninstall_view.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 3 chunks +4 lines, -1 line 0 comments Download
M chrome/browser/ui/views/uninstall_view.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 3 chunks +11 lines, -5 lines 0 comments Download
M chrome/browser/ui/views/user_data_dir_dialog_view.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 2 chunks +4 lines, -1 line 0 comments Download
M chrome/test/base/bookmark_load_observer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 3 chunks +4 lines, -1 line 0 comments Download
M chrome/test/base/bookmark_load_observer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 chunk +4 lines, -3 lines 0 comments Download
M chrome/test/base/in_process_browser_test.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/test/base/test_web_dialog_observer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/test/base/test_web_dialog_observer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/test/base/testing_profile.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2 chunks +5 lines, -2 lines 0 comments Download
M chrome/test/base/tracing.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 3 chunks +5 lines, -2 lines 0 comments Download
M chrome/test/base/ui_test_utils.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 6 chunks +31 lines, -24 lines 0 comments Download
M chrome/test/base/ui_test_utils.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 25 chunks +110 lines, -82 lines 0 comments Download
M chrome/test/perf/rendering/throughput_tests.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 4 chunks +6 lines, -17 lines 0 comments Download
M chrome_frame/test/chrome_frame_automation_mock.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 4 chunks +8 lines, -4 lines 0 comments Download
M chrome_frame/test/chrome_frame_test_utils.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/browser_main_loop.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2 chunks +8 lines, -7 lines 0 comments Download
M content/test/test_navigation_observer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 4 chunks +26 lines, -5 lines 0 comments Download
M ui/aura/desktop/desktop_dispatcher_client.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2 chunks +4 lines, -1 line 0 comments Download
M ui/aura/env.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +2 lines, -3 lines 0 comments Download
M ui/aura/test/aura_test_helper.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2 chunks +5 lines, -2 lines 0 comments Download
M ui/views/controls/menu/menu_controller.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2 chunks +3 lines, -1 line 0 comments Download
M ui/views/examples/content_client/examples_browser_main_parts.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 2 chunks +4 lines, -2 lines 0 comments Download
M ui/views/focus/focus_manager_unittest_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 5 chunks +10 lines, -8 lines 0 comments Download
M ui/views/test/views_test_base.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2 chunks +5 lines, -4 lines 0 comments Download

Messages

Total messages: 33 (0 generated)
jbates
8 years, 6 months ago (2012-06-05 01:19:24 UTC) #1
jbates
phajdan: chrome/test/OWNERS jar: base/OWNERS
8 years, 6 months ago (2012-06-05 01:20:04 UTC) #2
jar (doing other things)
One of the reasons for doing a Quit() is to ensure you run the pending ...
8 years, 6 months ago (2012-06-05 02:10:53 UTC) #3
Paweł Hajdan Jr.
LGTM https://chromiumcodereview.appspot.com/10479018/diff/7001/chrome/test/base/ui_test_utils.cc File chrome/test/base/ui_test_utils.cc (right): https://chromiumcodereview.appspot.com/10479018/diff/7001/chrome/test/base/ui_test_utils.cc#newcode334 chrome/test/base/ui_test_utils.cc:334: base::Bind(&MessageLoop::QuitNow, nit: Would QuitNowClosure be slightly prettier here? ...
8 years, 6 months ago (2012-06-05 11:57:44 UTC) #4
jbates
After discussing things with Jim and observing the test failures, it's clear that this can't ...
8 years, 6 months ago (2012-06-07 00:24:02 UTC) #5
jar (doing other things)
https://chromiumcodereview.appspot.com/10479018/diff/24004/base/message_loop.h File base/message_loop.h (right): https://chromiumcodereview.appspot.com/10479018/diff/24004/base/message_loop.h#newcode252 base/message_loop.h:252: void QuitAfterPending(); nit: I think this is now too ...
8 years, 6 months ago (2012-06-08 01:05:37 UTC) #6
jbates
PTAL, I've added the ability to Quit a specific nesting level of MessageLoop::Run so that ...
8 years, 6 months ago (2012-06-13 22:11:20 UTC) #7
jbates
https://chromiumcodereview.appspot.com/10479018/diff/20024/chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc File chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc (right): https://chromiumcodereview.appspot.com/10479018/diff/20024/chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc#newcode88 chrome/browser/ui/fullscreen_controller_interactive_browsertest.cc:88: fprintf(stderr, "global %s:%s:%d\n", __FILE__, __FUNCTION__, (int)__LINE__); Of course, I'll ...
8 years, 6 months ago (2012-06-13 22:12:27 UTC) #8
jar (doing other things)
Aside from some nits, the major request is a suggested change in your new API. ...
8 years, 6 months ago (2012-06-14 04:50:28 UTC) #9
jbates
jar: ptal I ended up with a simple RefCounted class to store the data for ...
8 years, 6 months ago (2012-06-15 02:20:38 UTC) #10
jbates
phajdan: ptal (ui_test_utils changes)
8 years, 6 months ago (2012-06-16 01:27:32 UTC) #11
Paweł Hajdan Jr.
+Darin, the MessageLoop changes look quite complex; feel free to defer the review to Jim, ...
8 years, 6 months ago (2012-06-18 15:56:25 UTC) #12
jar (doing other things)
I just focused on the actual message_loop changes (not on all the api uses). Comments ...
8 years, 6 months ago (2012-06-18 19:43:21 UTC) #13
jbates
https://chromiumcodereview.appspot.com/10479018/diff/39002/base/message_loop.cc File base/message_loop.cc (right): https://chromiumcodereview.appspot.com/10479018/diff/39002/base/message_loop.cc#newcode313 base/message_loop.cc:313: if (run_id->quit_now_received_) On 2012/06/18 19:43:21, jar wrote: > If ...
8 years, 6 months ago (2012-06-18 23:14:02 UTC) #14
darin (slow to review)
https://chromiumcodereview.appspot.com/10479018/diff/43001/base/message_loop.h File base/message_loop.h (right): https://chromiumcodereview.appspot.com/10479018/diff/43001/base/message_loop.h#newcode252 base/message_loop.h:252: void RunWithID(const RunID& run_id); [Sorry, detour incoming!!] I think ...
8 years, 6 months ago (2012-06-19 17:55:51 UTC) #15
jbates
ptal, getting closer... https://chromiumcodereview.appspot.com/10479018/diff/43001/base/message_loop.h File base/message_loop.h (right): https://chromiumcodereview.appspot.com/10479018/diff/43001/base/message_loop.h#newcode252 base/message_loop.h:252: void RunWithID(const RunID& run_id); On 2012/06/19 ...
8 years, 6 months ago (2012-06-22 02:12:51 UTC) #16
darin (slow to review)
I'm happy with Run() too. It is also more consistent with the current mental model ...
8 years, 6 months ago (2012-06-22 04:35:45 UTC) #17
darin (slow to review)
https://chromiumcodereview.appspot.com/10479018/diff/51008/base/message_loop.h File base/message_loop.h (right): https://chromiumcodereview.appspot.com/10479018/diff/51008/base/message_loop.h#newcode221 base/message_loop.h:221: class RunLoop : public base::SupportsWeakPtr<RunLoop> { this can be ...
8 years, 6 months ago (2012-06-22 04:42:23 UTC) #18
jbates
https://chromiumcodereview.appspot.com/10479018/diff/51008/base/message_loop.h File base/message_loop.h (right): https://chromiumcodereview.appspot.com/10479018/diff/51008/base/message_loop.h#newcode221 base/message_loop.h:221: class RunLoop : public base::SupportsWeakPtr<RunLoop> { On 2012/06/22 04:42:23, ...
8 years, 6 months ago (2012-06-22 23:21:01 UTC) #19
jar (doing other things)
You wrote a lot of nice code here!! ;-) A few questions, and a few ...
8 years, 6 months ago (2012-06-23 02:43:19 UTC) #20
jbates
Thanks Jim, addressed your feedback. https://chromiumcodereview.appspot.com/10479018/diff/63001/base/message_loop.cc File base/message_loop.cc (right): https://chromiumcodereview.appspot.com/10479018/diff/63001/base/message_loop.cc#newcode368 base/message_loop.cc:368: return !!run_loop_; On 2012/06/23 ...
8 years, 6 months ago (2012-06-25 20:04:57 UTC) #21
jar (doing other things)
LGTM with nits (and a potentially insignificant question). https://chromiumcodereview.appspot.com/10479018/diff/63001/content/test/test_navigation_observer.cc File content/test/test_navigation_observer.cc (right): https://chromiumcodereview.appspot.com/10479018/diff/63001/content/test/test_navigation_observer.cc#newcode106 content/test/test_navigation_observer.cc:106: const ...
8 years, 6 months ago (2012-06-25 21:19:43 UTC) #22
jbates
sky: OWNERS for: ui/views ash ui/aura chrome/browser/ui https://chromiumcodereview.appspot.com/10479018/diff/63001/content/test/test_navigation_observer.cc File content/test/test_navigation_observer.cc (right): https://chromiumcodereview.appspot.com/10479018/diff/63001/content/test/test_navigation_observer.cc#newcode106 content/test/test_navigation_observer.cc:106: const int ...
8 years, 6 months ago (2012-06-27 02:06:37 UTC) #23
Paweł Hajdan Jr.
LGTM - this is an impressive change I'm going on vacation, so please do not ...
8 years, 6 months ago (2012-06-27 07:33:28 UTC) #24
sky
https://chromiumcodereview.appspot.com/10479018/diff/92003/base/message_loop.h File base/message_loop.h (right): https://chromiumcodereview.appspot.com/10479018/diff/92003/base/message_loop.h#newcode259 base/message_loop.h:259: static base::Closure QuitWhenIdleClosure(); MenuController, which runs a nested message ...
8 years, 5 months ago (2012-06-27 14:02:09 UTC) #25
sky
Here's a patch that resulted in the QuitNow: http://codereview.chromium.org/10143001/ along with discussion. -Scott On Wed, ...
8 years, 5 months ago (2012-06-27 14:05:24 UTC) #26
jbates
https://chromiumcodereview.appspot.com/10479018/diff/92003/base/message_loop.h File base/message_loop.h (right): https://chromiumcodereview.appspot.com/10479018/diff/92003/base/message_loop.h#newcode259 base/message_loop.h:259: static base::Closure QuitWhenIdleClosure(); On 2012/06/27 14:02:10, sky wrote: > ...
8 years, 5 months ago (2012-06-27 17:23:46 UTC) #27
sky
On Wed, Jun 27, 2012 at 10:23 AM, <jbates@chromium.org> wrote: > > https://chromiumcodereview.appspot.com/10479018/diff/92003/base/message_loop.h > File ...
8 years, 5 months ago (2012-06-27 21:11:00 UTC) #28
jbates
On 2012/06/27 21:11:00, sky wrote: > On Wed, Jun 27, 2012 at 10:23 AM, <mailto:jbates@chromium.org> ...
8 years, 5 months ago (2012-06-27 21:46:26 UTC) #29
sky
LGTM
8 years, 5 months ago (2012-06-27 23:09:36 UTC) #30
jbates
https://chromiumcodereview.appspot.com/10479018/diff/92003/chrome/test/base/in_process_browser_test.cc File chrome/test/base/in_process_browser_test.cc (right): https://chromiumcodereview.appspot.com/10479018/diff/92003/chrome/test/base/in_process_browser_test.cc#newcode376 chrome/test/base/in_process_browser_test.cc:376: // Sometimes tests leave Quit tasks in the MessageLoop ...
8 years, 5 months ago (2012-06-28 20:46:11 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jbates@chromium.org/10479018/96003
8 years, 5 months ago (2012-06-28 20:48:20 UTC) #32
commit-bot: I haz the power
8 years, 5 months ago (2012-06-28 22:57:32 UTC) #33
Change committed as 144824

Powered by Google App Engine
This is Rietveld 408576698