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

Unified Diff: base/test/scoped_task_scheduler_unittest.cc

Issue 2713513003: Use the saved task runner if TestTaskScheduler is re-entered from a task executed by RunTask. (Closed)
Patch Set: Unit test Created 3 years, 10 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
« base/test/scoped_task_scheduler.cc ('K') | « base/test/scoped_task_scheduler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/scoped_task_scheduler_unittest.cc
diff --git a/base/test/scoped_task_scheduler_unittest.cc b/base/test/scoped_task_scheduler_unittest.cc
index cc0ffbbe62d5625aba5e3e7d2bed934ef8c442b2..b10e4f7cfd2d43d005adeca65ed3a8e5017f14e4 100644
--- a/base/test/scoped_task_scheduler_unittest.cc
+++ b/base/test/scoped_task_scheduler_unittest.cc
@@ -297,5 +297,20 @@ TEST(ScopedTaskSchedulerTest, ReassignCurrentTaskRunner) {
EXPECT_TRUE(second_task_ran);
}
fdoray 2017/02/22 16:23:52 // Verify that a task can be posted from a task ru
+TEST(ScopedTaskSchedulerTest, ReentrantTaskRunner) {
+ bool task_ran = false;
+ ScopedTaskScheduler scoped_task_scheduler;
+ PostTask(FROM_HERE, Bind(
+ [](bool* task_ran) {
+ PostTask(
+ FROM_HERE,
+ Bind([](bool* task_ran) { *task_ran = true; },
+ Unretained(task_ran)));
+ },
+ Unretained(&task_ran)));
+ RunLoop().RunUntilIdle();
+ EXPECT_TRUE(task_ran);
+}
+
fdoray 2017/02/22 16:23:52 // Verify that ScopedTaskScheduler posts to the la
Joe Mason 2017/02/22 20:23:30 This test does the same thing as ReassignCurrentTa
} // namespace test
} // namespace base
« base/test/scoped_task_scheduler.cc ('K') | « base/test/scoped_task_scheduler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698