Change Autofill Helper TaskScheduler::FlushForTesting() to Wait on TaskRunner tasks

base::TaskScheduler::GetInstance()->FlushForTesting() may have been too
big of a hammer to use here. I've moved this code back to a previous
style of waiting for the DB task runner to flush
(http://crrev.com/490312).

The main issue here is that FlushForTesting() often gets called on the
main thread, and with MessageLoop Task Scheduler redirection,
FlushForTesting will wait for MessageLoop tasks to complete. If a
MessageLoop task is waiting for the main thread to process a task and
the main thread is calling FlushForTesting(), a deadlock will occur.

If these components start using other task runners, a completion
callback mechanism will best support this file going forward.

BUG=667892,749310

Change-Id: I0693bf7a00b25be9a95e2bae89ec3b4167ba4d4a
Reviewed-on: https://chromium-review.googlesource.com/874817
Reviewed-by: Pavel Yatsuk <pavely@chromium.org>
Commit-Queue: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531624}
1 file changed