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

Unified Diff: base/task_scheduler/priority_queue_unittest.cc

Issue 2801673002: Separate the create and start phases in SchedulerWorkerPoolImpl. (Closed)
Patch Set: self-review Created 3 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 side-by-side diff with in-line comments
Download patch
Index: base/task_scheduler/priority_queue_unittest.cc
diff --git a/base/task_scheduler/priority_queue_unittest.cc b/base/task_scheduler/priority_queue_unittest.cc
index afaeafb644ed6bee80db97768c0d918cccb3cc5a..ad453b173870b7073a6ace377d07eb37ca6f6d46 100644
--- a/base/task_scheduler/priority_queue_unittest.cc
+++ b/base/task_scheduler/priority_queue_unittest.cc
@@ -87,45 +87,54 @@ TEST(TaskSchedulerPriorityQueueTest, PushPopPeek) {
PriorityQueue pq;
auto transaction(pq.BeginTransaction());
EXPECT_TRUE(transaction->IsEmpty());
+ EXPECT_EQ(0U, transaction->Size());
// Push |sequence_a| in the PriorityQueue. It becomes the sequence with the
// highest priority.
transaction->Push(sequence_a, sort_key_a);
EXPECT_EQ(sort_key_a, transaction->PeekSortKey());
+ EXPECT_EQ(1U, transaction->Size());
// Push |sequence_b| in the PriorityQueue. It becomes the sequence with the
// highest priority.
transaction->Push(sequence_b, sort_key_b);
EXPECT_EQ(sort_key_b, transaction->PeekSortKey());
+ EXPECT_EQ(2U, transaction->Size());
// Push |sequence_c| in the PriorityQueue. |sequence_b| is still the sequence
// with the highest priority.
transaction->Push(sequence_c, sort_key_c);
EXPECT_EQ(sort_key_b, transaction->PeekSortKey());
+ EXPECT_EQ(3U, transaction->Size());
// Push |sequence_d| in the PriorityQueue. |sequence_b| is still the sequence
// with the highest priority.
transaction->Push(sequence_d, sort_key_d);
EXPECT_EQ(sort_key_b, transaction->PeekSortKey());
+ EXPECT_EQ(4U, transaction->Size());
// Pop |sequence_b| from the PriorityQueue. |sequence_c| becomes the sequence
// with the highest priority.
EXPECT_EQ(sequence_b, transaction->PopSequence());
EXPECT_EQ(sort_key_c, transaction->PeekSortKey());
+ EXPECT_EQ(3U, transaction->Size());
// Pop |sequence_c| from the PriorityQueue. |sequence_a| becomes the sequence
// with the highest priority.
EXPECT_EQ(sequence_c, transaction->PopSequence());
EXPECT_EQ(sort_key_a, transaction->PeekSortKey());
+ EXPECT_EQ(2U, transaction->Size());
// Pop |sequence_a| from the PriorityQueue. |sequence_d| becomes the sequence
// with the highest priority.
EXPECT_EQ(sequence_a, transaction->PopSequence());
EXPECT_EQ(sort_key_d, transaction->PeekSortKey());
+ EXPECT_EQ(1U, transaction->Size());
// Pop |sequence_d| from the PriorityQueue. It is now empty.
EXPECT_EQ(sequence_d, transaction->PopSequence());
EXPECT_TRUE(transaction->IsEmpty());
+ EXPECT_EQ(0U, transaction->Size());
}
// Check that creating Transactions on the same thread for 2 unrelated

Powered by Google App Engine
This is Rietveld 408576698