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

Unified Diff: base/task_scheduler/task_scheduler_impl_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/sequence_unittest.cc ('k') | base/task_scheduler/task_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/task_scheduler_impl_unittest.cc
diff --git a/base/task_scheduler/task_scheduler_impl_unittest.cc b/base/task_scheduler/task_scheduler_impl_unittest.cc
index cc71fdfa03bbd3b1d614bf8e9927fd1d40f7cbf0..baa3baf5013efeac9741f57652fed250aa8a011c 100644
--- a/base/task_scheduler/task_scheduler_impl_unittest.cc
+++ b/base/task_scheduler/task_scheduler_impl_unittest.cc
@@ -175,10 +175,8 @@ std::vector<TraitsExecutionModePair> GetTraitsExecutionModePairs() {
priority_index <= static_cast<size_t>(TaskPriority::HIGHEST);
++priority_index) {
const TaskPriority priority = static_cast<TaskPriority>(priority_index);
- params.push_back(TraitsExecutionModePair(
- TaskTraits().WithPriority(priority), execution_mode));
- params.push_back(TraitsExecutionModePair(
- TaskTraits().WithPriority(priority).MayBlock(), execution_mode));
+ params.push_back(TraitsExecutionModePair({priority}, execution_mode));
+ params.push_back(TraitsExecutionModePair({MayBlock()}, execution_mode));
}
}
@@ -368,22 +366,17 @@ TEST_F(TaskSchedulerImplTest, MultipleTraitsExecutionModePairs) {
TEST_F(TaskSchedulerImplTest, GetMaxConcurrentTasksWithTraitsDeprecated) {
StartTaskScheduler();
EXPECT_EQ(1, scheduler_.GetMaxConcurrentTasksWithTraitsDeprecated(
- TaskTraits().WithPriority(TaskPriority::BACKGROUND)));
- EXPECT_EQ(
- 3, scheduler_.GetMaxConcurrentTasksWithTraitsDeprecated(
- TaskTraits().WithPriority(TaskPriority::BACKGROUND).MayBlock()));
+ {TaskPriority::BACKGROUND}));
+ EXPECT_EQ(3, scheduler_.GetMaxConcurrentTasksWithTraitsDeprecated(
+ {MayBlock(), TaskPriority::BACKGROUND}));
EXPECT_EQ(4, scheduler_.GetMaxConcurrentTasksWithTraitsDeprecated(
- TaskTraits().WithPriority(TaskPriority::USER_VISIBLE)));
- EXPECT_EQ(
- 12,
- scheduler_.GetMaxConcurrentTasksWithTraitsDeprecated(
- TaskTraits().WithPriority(TaskPriority::USER_VISIBLE).MayBlock()));
+ {TaskPriority::USER_VISIBLE}));
+ EXPECT_EQ(12, scheduler_.GetMaxConcurrentTasksWithTraitsDeprecated(
+ {MayBlock(), TaskPriority::USER_VISIBLE}));
EXPECT_EQ(4, scheduler_.GetMaxConcurrentTasksWithTraitsDeprecated(
- TaskTraits().WithPriority(TaskPriority::USER_BLOCKING)));
- EXPECT_EQ(
- 12,
- scheduler_.GetMaxConcurrentTasksWithTraitsDeprecated(
- TaskTraits().WithPriority(TaskPriority::USER_BLOCKING).MayBlock()));
+ {TaskPriority::USER_BLOCKING}));
+ EXPECT_EQ(12, scheduler_.GetMaxConcurrentTasksWithTraitsDeprecated(
+ {MayBlock(), TaskPriority::USER_BLOCKING}));
}
// Verify that the RunsTasksOnCurrentThread() method of a SequencedTaskRunner
@@ -488,8 +481,7 @@ TEST_F(TaskSchedulerImplTest, FileDescriptorWatcherNoOpsAfterShutdown) {
scoped_refptr<TaskRunner> blocking_task_runner =
scheduler_.CreateSequencedTaskRunnerWithTraits(
- TaskTraits().WithShutdownBehavior(
- TaskShutdownBehavior::BLOCK_SHUTDOWN));
+ {TaskShutdownBehavior::BLOCK_SHUTDOWN});
blocking_task_runner->PostTask(
FROM_HERE,
BindOnce(
« no previous file with comments | « base/task_scheduler/sequence_unittest.cc ('k') | base/task_scheduler/task_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698