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

Unified Diff: base/test/scoped_task_scheduler_unittest.cc

Issue 2859053006: Use constexpr TaskTraits constructor in base (part 2). (Closed)
Patch Set: self-review Created 3 years, 7 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 | « base/task_scheduler/task_unittest.cc ('k') | base/threading/sequenced_worker_pool.cc » ('j') | 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 3323ebffb1966e023a32e45dfe941dcd26f4f76f..6a14bdab08b398940e5b6329f9d1cfff54ce0f77 100644
--- a/base/test/scoped_task_scheduler_unittest.cc
+++ b/base/test/scoped_task_scheduler_unittest.cc
@@ -257,18 +257,15 @@ TEST(ScopedTaskSchedulerTest, COMSTAAvailable) {
TEST(ScopedTaskSchedulerTest, NonBlockShutdownTasksPostedAfterShutdownDontRun) {
ScopedTaskScheduler scoped_task_scheduler;
TaskScheduler::GetInstance()->Shutdown();
- PostTaskWithTraits(FROM_HERE,
- TaskTraits().WithShutdownBehavior(
- TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
+ PostTaskWithTraits(FROM_HERE, {TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
BindOnce([]() {
ADD_FAILURE()
<< "CONTINUE_ON_SHUTDOWN task should not run";
}));
- PostTaskWithTraits(
- FROM_HERE,
- TaskTraits().WithShutdownBehavior(TaskShutdownBehavior::SKIP_ON_SHUTDOWN),
- BindOnce(
- []() { ADD_FAILURE() << "SKIP_ON_SHUTDOWN task should not run"; }));
+ PostTaskWithTraits(FROM_HERE, {TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
+ BindOnce([]() {
+ ADD_FAILURE() << "SKIP_ON_SHUTDOWN task should not run";
+ }));
// This should not run anything.
RunLoop().RunUntilIdle();
@@ -278,28 +275,22 @@ TEST(ScopedTaskSchedulerTest, DestructorRunsBlockShutdownTasksOnly) {
bool block_shutdown_task_ran = false;
{
ScopedTaskScheduler scoped_task_scheduler;
- PostTaskWithTraits(FROM_HERE,
- TaskTraits().WithShutdownBehavior(
- TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN),
+ PostTaskWithTraits(FROM_HERE, {TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
BindOnce([]() {
ADD_FAILURE()
<< "CONTINUE_ON_SHUTDOWN task should not run";
}));
- PostTaskWithTraits(FROM_HERE,
- TaskTraits().WithShutdownBehavior(
- TaskShutdownBehavior::SKIP_ON_SHUTDOWN),
+ PostTaskWithTraits(FROM_HERE, {TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
BindOnce([]() {
ADD_FAILURE()
<< "SKIP_ON_SHUTDOWN task should not run";
}));
- PostTaskWithTraits(
- FROM_HERE,
- TaskTraits().WithShutdownBehavior(TaskShutdownBehavior::BLOCK_SHUTDOWN),
- BindOnce(
- [](bool* block_shutdown_task_ran) {
- *block_shutdown_task_ran = true;
- },
- Unretained(&block_shutdown_task_ran)));
+ PostTaskWithTraits(FROM_HERE, {TaskShutdownBehavior::BLOCK_SHUTDOWN},
+ BindOnce(
+ [](bool* block_shutdown_task_ran) {
+ *block_shutdown_task_ran = true;
+ },
+ Unretained(&block_shutdown_task_ran)));
}
EXPECT_TRUE(block_shutdown_task_ran);
}
« no previous file with comments | « base/task_scheduler/task_unittest.cc ('k') | base/threading/sequenced_worker_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698