[base] Clarify RunUntilIdle() docs further

Bring the existing warnings from RunLoop::RunUntilIdle() to
ScopedTaskEnvironment::RunUntilIdle() and clarify that it's still okay
and sometimes necessary to RunUntilIdle() in the TearDown() phase.

As part of https://docs.google.com/a/google.com/document/d/1APvtM1m-0m2Fl8S2DcbYZqtju0Nypk8fEl6uv00et3Y/edit?disco=AAAACp43MZU
I debated getting rid of automatic RunUntilIdle() in
~ScopedTaskEnvironment() and ~TestBrowserThreadBundle() to avoid the
conundrum where we say don't-run-until-idle but recommend it in
TearDown(). In the end I think it's better to keep the automatic flush
otherwise we risk leaks (e.g. with DeleteSoon()-like destruction) which
increase the likelihood of test flakes caused by previous tests and
therefore we have to explain why it's okay to RunUntilIdle() manually
in TearDown() when binding Unretained() state.

R=fdoray@chromium.org

Change-Id: Ifd045b8922a9637efe39f5007e8667953f7dd4cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1532307
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642512}
2 files changed