Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: content/public/test/test_utils.cc

Issue 2750823002: Flush TaskScheduler in content::RunAllBlockingPoolTasksUntilIdle(). (Closed)
Patch Set: add rununtilidle in TestTaskScheduler::FlushForTesting Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/test/test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/test_utils.cc
diff --git a/content/public/test/test_utils.cc b/content/public/test/test_utils.cc
index 4afe2321e9f3f4c021831dc3857db3582e9991a7..95c8d987d619b0c124c2b2b2ace9c2c2a43492cb 100644
--- a/content/public/test/test_utils.cc
+++ b/content/public/test/test_utils.cc
@@ -13,6 +13,7 @@
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/task_scheduler/task_scheduler.h"
#include "base/threading/sequenced_worker_pool.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
@@ -157,8 +158,13 @@ void RunAllPendingInMessageLoop(BrowserThread::ID thread_id) {
void RunAllBlockingPoolTasksUntilIdle() {
while (true) {
+ // Flush blocking pool tasks.
robliao 2017/03/17 01:00:14 Remove this comment as it's stating what the next
fdoray 2017/03/31 20:26:04 Removed unnecessary comment. I have a few CLs to
content::BrowserThread::GetBlockingPool()->FlushForTesting();
+ // Also flush TaskScheduler tasks since all blocking pool call sites are
+ // being migrated to TaskScheduler.
+ base::TaskScheduler::GetInstance()->FlushForTesting();
+
TaskObserver task_observer;
base::MessageLoop::current()->AddTaskObserver(&task_observer);
base::RunLoop().RunUntilIdle();
« no previous file with comments | « content/public/test/test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698