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

Side by Side Diff: trunk/src/net/base/priority_queue_unittest.cc

Issue 23102009: Revert 218616 "[net/dns] Perform A/AAAA queries for AF_UNSPEC re..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « trunk/src/net/base/priority_queue.h ('k') | trunk/src/net/dns/dns_test_util.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/base/priority_queue.h" 5 #include "net/base/priority_queue.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace net { 8 namespace net {
9 9
10 namespace { 10 namespace {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 EXPECT_EQ(kLastMaxOrder[i], queue_.LastMax().value()); 84 EXPECT_EQ(kLastMaxOrder[i], queue_.LastMax().value());
85 queue_.Erase(queue_.LastMax()); 85 queue_.Erase(queue_.LastMax());
86 } 86 }
87 CheckEmpty(); 87 CheckEmpty();
88 } 88 }
89 89
90 TEST_F(PriorityQueueTest, EraseFromMiddle) { 90 TEST_F(PriorityQueueTest, EraseFromMiddle) {
91 queue_.Erase(pointers_[2]); 91 queue_.Erase(pointers_[2]);
92 queue_.Erase(pointers_[3]); 92 queue_.Erase(pointers_[3]);
93 93
94 const int expected_order[] = { 8, 1, 6, 0, 5, 4, 7 }; 94 int expected_order[] = { 8, 1, 6, 0, 5, 4, 7 };
95 95
96 for (size_t i = 0; i < arraysize(expected_order); ++i) { 96 for (size_t i = 0; i < arraysize(expected_order); ++i) {
97 EXPECT_EQ(expected_order[i], queue_.FirstMin().value()); 97 EXPECT_EQ(expected_order[i], queue_.FirstMin().value());
98 queue_.Erase(queue_.FirstMin()); 98 queue_.Erase(queue_.FirstMin());
99 } 99 }
100 CheckEmpty(); 100 CheckEmpty();
101 } 101 }
102 102
103 TEST_F(PriorityQueueTest, InsertAtFront) {
104 queue_.InsertAtFront(9, 2);
105 queue_.InsertAtFront(10, 0);
106 queue_.InsertAtFront(11, 1);
107 queue_.InsertAtFront(12, 1);
108
109 const int expected_order[] = { 10, 3, 8, 12, 11, 1, 6, 9, 0, 2, 5, 4, 7 };
110
111 for (size_t i = 0; i < arraysize(expected_order); ++i) {
112 EXPECT_EQ(expected_order[i], queue_.FirstMin().value());
113 queue_.Erase(queue_.FirstMin());
114 }
115 CheckEmpty();
116 }
117
118 } // namespace 103 } // namespace
119 104
120 } // namespace net 105 } // namespace net
OLDNEW
« no previous file with comments | « trunk/src/net/base/priority_queue.h ('k') | trunk/src/net/dns/dns_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698