Refactor ScopedTaskEnvironment::MainThreadHasPendingTask and tests using it

Previously this API behaved differently depending on whether mock time was used or
not.  If mock time was used, it only returned false if there where no pending tasks
at all.  If mock time wasn't used it returned false if there where no tasks to run
now.  This is confusing so we replaced it with MainThreadHasPendingTask which checks
if there are any tasks to run now.

We also fix a problem with ~TestBrowserThreadBundle which was flaking if
CHECK(!MainThreadHasPendingTask()) if a delay expired between the last RunUntilIdle()
and it.

TBR=mfoltz@chromium.org, rouslan@chromium.org, bajones@chromium.org, bnc@chromium.org

Bug: 925315
Change-Id: I664615b43882f94126309e1355f5045305bd02c1
Reviewed-on: https://chromium-review.googlesource.com/c/1454363
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: mark a. foltz <mfoltz@chromium.org>
Reviewed-by: Bence Béky <bnc@chromium.org>
Reviewed-by: Rouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634354}
18 files changed