service worker: Prefer RunLoop over RunUntilIdle for storage unittest.
The test was using RunUntilIdle() to run the tasks posted to the IO thread as well as the database thread. It's better to use explicit RunLoops so it's clear what tasks are being waited on. This also helps remove the requirement in tests to set the database thread to the UI/IO thread[1], which will help unblock creating StoragePartitionImpl for tests, which will help unblock ServiceWorkerOnUI. As part of that direction, the CL also changes the test to use the database task runner explicitly when needed. However many other tests also use RunUntilIdle() like the background sync tests and depend on it to pump the database tasks, so I might not complete this work fully. [1] EmbeddedWorkerTestHelper's constructor creates ServiceWorkerContextWrapper and does: scoped_refptr<base::SequencedTaskRunner> database_task_runner = base::ThreadTaskRunnerHandle::Get(); wrapper_->InitOnCoreThread(..., std::move(database_task_runner), ... Bug: 1000141 Change-Id: I61efe2925a33b2b1afd62c407caee4c373476ce4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1782458Reviewed-by:Makoto Shimazu <shimazu@chromium.org> Commit-Queue: Matt Falkenhagen <falken@chromium.org> Cr-Commit-Position: refs/heads/master@{#693024}
Showing
This diff is collapsed.
Please register or sign in to comment