Skip to content

Commit

Permalink
Replace most RunLoop in CrostiniManagerRestartTest uses with TestFuture
Browse files Browse the repository at this point in the history
Most tests of the CrostiniRestarter currently use the helper function
RestartCrostiniCallback to wrap the QuitClosure of a RunLoop and store
the result of the restart into a member variable. This CL replaces
most of these with using TestFuture, which makes the flow easier to
follow as the helper function and associated members are not used.

Checks of restart_crostini_callback_count_ are no longer relevant and
removed. If we can get the TestFutures' results, we know that the
relevant result callbacks have been called, and it is not possible for
them to be called extra times as they are OnceCallbacks.

A few more minor changes while we're here:
- Prefer using container_id() to DefaultContainerId() in tests, so
we'd notice if we unintentionally expected the default container
somewhere in the restart flow.
- Add helper functions for restarting that just forward arguments on
to make things slightly more readable.
- Remove restart_id_ member, don't store the RestartId unless needed.

We continue to explicitly use RunLoop::RunUntilIdle in cases where we
don't have a callback to wait for.

Bug: b/227693911
Change-Id: Ie1013c901e572feb6a382c47b65430f6d7aca465
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4220776
Commit-Queue: Timothy Loh <timloh@chromium.org>
Reviewed-by: Sophia Lin <sophialin@google.com>
Cr-Commit-Position: refs/heads/main@{#1103685}
  • Loading branch information
tim-loh authored and Chromium LUCI CQ committed Feb 10, 2023
1 parent 7c4338b commit feaac75
Showing 1 changed file with 403 additions and 502 deletions.

0 comments on commit feaac75

Please sign in to comment.