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

Side by Side Diff: base/task_scheduler/sequence_unittest.cc

Issue 1890163003: TaskScheduler: Add delayed run time to the constructor of Task. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@7_sequenced
Patch Set: self review Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « base/task_scheduler/scheduler_worker_thread_unittest.cc ('k') | base/task_scheduler/task.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/task_scheduler/sequence.h" 5 #include "base/task_scheduler/sequence.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace base { 11 namespace base {
12 namespace internal { 12 namespace internal {
13 13
14 namespace { 14 namespace {
15 15
16 class TaskSchedulerSequenceTest : public testing::Test { 16 class TaskSchedulerSequenceTest : public testing::Test {
17 public: 17 public:
18 TaskSchedulerSequenceTest() 18 TaskSchedulerSequenceTest()
19 : task_a_owned_( 19 : task_a_owned_(
20 new Task(FROM_HERE, 20 new Task(FROM_HERE,
21 Closure(), 21 Closure(),
22 TaskTraits().WithPriority(TaskPriority::BACKGROUND))), 22 TaskTraits().WithPriority(TaskPriority::BACKGROUND),
23 TimeTicks())),
23 task_b_owned_( 24 task_b_owned_(
24 new Task(FROM_HERE, 25 new Task(FROM_HERE,
25 Closure(), 26 Closure(),
26 TaskTraits().WithPriority(TaskPriority::USER_VISIBLE))), 27 TaskTraits().WithPriority(TaskPriority::USER_VISIBLE),
28 TimeTicks())),
27 task_c_owned_( 29 task_c_owned_(
28 new Task(FROM_HERE, 30 new Task(FROM_HERE,
29 Closure(), 31 Closure(),
30 TaskTraits().WithPriority(TaskPriority::USER_BLOCKING))), 32 TaskTraits().WithPriority(TaskPriority::USER_BLOCKING),
33 TimeTicks())),
31 task_d_owned_( 34 task_d_owned_(
32 new Task(FROM_HERE, 35 new Task(FROM_HERE,
33 Closure(), 36 Closure(),
34 TaskTraits().WithPriority(TaskPriority::USER_BLOCKING))), 37 TaskTraits().WithPriority(TaskPriority::USER_BLOCKING),
38 TimeTicks())),
35 task_e_owned_( 39 task_e_owned_(
36 new Task(FROM_HERE, 40 new Task(FROM_HERE,
37 Closure(), 41 Closure(),
38 TaskTraits().WithPriority(TaskPriority::BACKGROUND))), 42 TaskTraits().WithPriority(TaskPriority::BACKGROUND),
43 TimeTicks())),
39 task_a_(task_a_owned_.get()), 44 task_a_(task_a_owned_.get()),
40 task_b_(task_b_owned_.get()), 45 task_b_(task_b_owned_.get()),
41 task_c_(task_c_owned_.get()), 46 task_c_(task_c_owned_.get()),
42 task_d_(task_d_owned_.get()), 47 task_d_(task_d_owned_.get()),
43 task_e_(task_e_owned_.get()) {} 48 task_e_(task_e_owned_.get()) {}
44 49
45 protected: 50 protected:
46 // Tasks to be handed off to a Sequence for testing. 51 // Tasks to be handed off to a Sequence for testing.
47 std::unique_ptr<Task> task_a_owned_; 52 std::unique_ptr<Task> task_a_owned_;
48 std::unique_ptr<Task> task_b_owned_; 53 std::unique_ptr<Task> task_b_owned_;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 180
176 // Pop task D. The highest priority is now from task E (BACKGROUND). The 181 // Pop task D. The highest priority is now from task E (BACKGROUND). The
177 // task in front of the sequence is now task E. 182 // task in front of the sequence is now task E.
178 sequence->PopTask(); 183 sequence->PopTask();
179 ExpectSortKey(TaskPriority::BACKGROUND, task_e_->sequenced_time, 184 ExpectSortKey(TaskPriority::BACKGROUND, task_e_->sequenced_time,
180 sequence->GetSortKey()); 185 sequence->GetSortKey());
181 } 186 }
182 187
183 } // namespace internal 188 } // namespace internal
184 } // namespace base 189 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/scheduler_worker_thread_unittest.cc ('k') | base/task_scheduler/task.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698