Support for common testing use case
When using InteractionSequence for interactive testing, there is a common usage pattern which looks like: base::RunLoop run_loop; sequence = ... .SetCompletedCallback(run_loop.QuitClosure()) .SetAbortedCallback( /* something that aborts the test */ ) ... sequence->Start(); run_loop.Run(); We would like to make this pattern simpler and not force the caller to use their CompletedCallback on exiting the run loop. This CL provides a method called RunSynchronouslyForTesting() which effectively does just this - it creates a temporary RunLoop, starts the sequence, and then waits for the loop to quit, which happens automagically after the sequence either completes or aborts. Effectively, the method doesn't return until the sequence ends, but ensures that events on the current thread continue to be processed even while the call is pending. Change-Id: I492e2de8a6e40d701d94923265322c8e4c9f0fde Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3055776 Commit-Queue: Allen Bauer <kylixrd@chromium.org> Reviewed-by:Allen Bauer <kylixrd@chromium.org> Cr-Commit-Position: refs/heads/master@{#906350}
Loading
Please register or sign in to comment