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

Unified Diff: net/base/priority_queue_unittest.cc

Issue 23620058: Add a cap of six in-flight requests per host to the ResourceScheduler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 1 month 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
« net/base/priority_queue.h ('K') | « net/base/priority_queue.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/priority_queue_unittest.cc
diff --git a/net/base/priority_queue_unittest.cc b/net/base/priority_queue_unittest.cc
index 0baff6e005ce6c265fca489cf516dada331b86ea..7ac1fef0bfad428d66bc5a7defd7b9373b7d0051 100644
--- a/net/base/priority_queue_unittest.cc
+++ b/net/base/priority_queue_unittest.cc
@@ -105,6 +105,29 @@ TEST_F(PriorityQueueTest, LastMaxOrderErase) {
CheckEmpty();
}
+TEST_F(PriorityQueueTest, NextHighestIteration) {
+ PriorityQueue<int>::Pointer current = queue_.FirstMax();
+ for (size_t i = 0; i < kNumElements; ++i) {
+ EXPECT_FALSE(current.is_null());
+ EXPECT_EQ(kFirstMaxOrder[i], current.value());
+ current = queue_.NextHighest(current);
+ }
+ EXPECT_TRUE(current.is_null());
+}
+
+TEST_F(PriorityQueueTest, NextHighestIterationWithDeletion) {
+ PriorityQueue<int>::Pointer current = queue_.FirstMax();
+ for (size_t i = 0; i < kNumElements; ++i) {
+ EXPECT_FALSE(current.is_null());
+ EXPECT_EQ(kFirstMaxOrder[i], current.value());
+ PriorityQueue<int>::Pointer next = queue_.NextHighest(current);
+ queue_.Erase(current);
+ current = next;
+ }
+ EXPECT_TRUE(current.is_null());
+ CheckEmpty();
+}
+
TEST_F(PriorityQueueTest, EraseFromMiddle) {
queue_.Erase(pointers_[2]);
queue_.Erase(pointers_[3]);
« net/base/priority_queue.h ('K') | « net/base/priority_queue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698