Do not flush TaskScheduler in ~TestBrowserThreadBundle if it's not managed by it.

This fixes hangs in https://codereview.chromium.org/2890853002/.

New regression test hangs without matching test_browser_thread.cc 
changes.

We support adding a TestBrowserThreadBundle on top of an explicit
ScopedTaskEnvironment (i.e. to add named threads in unit tests that
already otherwise inherit a ScopedTaskEnvironment or need to provide a
custom one). However if the ScopedTaskEnvironment uses a QUEUED mode,
trying to flush it in ~TestBrowserThreadBundle() results in a hang.
Flushing TaskScheduler when it's not managed by that
TestBrowserThreadBundle was wrong anyways.

Bug: 708584, 689520
Change-Id: I3087537ad4f1065fc974170b00c25a676ff5e4c9
Reviewed-on: https://chromium-review.googlesource.com/575593
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487481}
2 files changed