Skip to content
Commit 470dc829 authored by Dana Fried's avatar Dana Fried Committed by Chromium LUCI CQ
Browse files

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: default avatarAllen Bauer <kylixrd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#906350}
parent 2057a13a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment