Commit 3ffe34c6 authored by danakj's avatar danakj Committed by Commit Bot

Run android startup tasks asyncronously in browser tests as in prod

The android startup tasks were run synchronously when a |ui_task| was
present (ie in browser tests) because android browser tests were
expecting synchronous initialization, however java initialization is
asynchronous anyways. So we have a RunLoop in BrowserTestBase pumping
tasks and waiting for java initialization to complete, which is done
as a (possibly asynchronous) side effect of the |ui_task| running.

Thus we can stop branching here for tests and just post the startup
tasks in browser tests as we would do normally in production. And the
RunLoop in BrowserTestBase::SetUp() will run them all, eventually
running the |ui_task|.

R=avi@chromium.org

Bug: 961849
Change-Id: Ic4724895e7b3762c401f2e781907816e2048e1ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1671069
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672154}
parent 43680be2
......@@ -893,12 +893,7 @@ void BrowserMainLoop::CreateStartupTasks() {
startup_task_runner_->AddTask(std::move(pre_main_message_loop_run));
#if defined(OS_ANDROID)
if (parameters_.ui_task) {
// Running inside browser tests, which relies on synchronous start.
startup_task_runner_->RunAllTasksNow();
} else {
startup_task_runner_->StartRunningTasksAsync();
}
startup_task_runner_->StartRunningTasksAsync();
#else
startup_task_runner_->RunAllTasksNow();
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment