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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/base/intrusive_heap_unittest.cc

Issue 2469653002: Fix incorrect usage of std::is_heap in blink::scheduler::IntrusiveHeap. (Closed)
Patch Set: Attempt to appease the Android compiler. Created 4 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/scheduler/base/intrusive_heap.h ('k') | no next file » | 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 "platform/scheduler/base/intrusive_heap.h" 5 #include "platform/scheduler/base/intrusive_heap.h"
6 #include "testing/gmock/include/gmock/gmock.h" 6 #include "testing/gmock/include/gmock/gmock.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace blink { 9 namespace blink {
10 namespace scheduler { 10 namespace scheduler {
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 void ClearHeapHandle() { 24 void ClearHeapHandle() {
25 if (handle) 25 if (handle)
26 *handle = HeapHandle(); 26 *handle = HeapHandle();
27 } 27 }
28 }; 28 };
29 29
30 } // namespace 30 } // namespace
31 31
32 using IntrusiveHeapTest = ::testing::Test; 32 class IntrusiveHeapTest : public ::testing::Test {
33 protected:
34 static bool CompareNodes(const TestElement& a, const TestElement& b) {
35 return IntrusiveHeap<TestElement>::CompareNodes(a, b);
36 }
37 };
33 38
34 TEST(IntrusiveHeapTest, Basic) { 39 TEST_F(IntrusiveHeapTest, Basic) {
35 IntrusiveHeap<TestElement> heap; 40 IntrusiveHeap<TestElement> heap;
36 41
37 EXPECT_TRUE(heap.empty()); 42 EXPECT_TRUE(heap.empty());
38 EXPECT_EQ(0u, heap.size()); 43 EXPECT_EQ(0u, heap.size());
39 } 44 }
40 45
41 TEST(IntrusiveHeapTest, Clear) { 46 TEST_F(IntrusiveHeapTest, Clear) {
42 IntrusiveHeap<TestElement> heap; 47 IntrusiveHeap<TestElement> heap;
43 HeapHandle index1; 48 HeapHandle index1;
44 49
45 heap.insert({11, &index1}); 50 heap.insert({11, &index1});
46 EXPECT_EQ(1u, heap.size()); 51 EXPECT_EQ(1u, heap.size());
47 EXPECT_TRUE(index1.IsValid()); 52 EXPECT_TRUE(index1.IsValid());
48 53
49 heap.clear(); 54 heap.clear();
50 EXPECT_EQ(0u, heap.size()); 55 EXPECT_EQ(0u, heap.size());
51 EXPECT_FALSE(index1.IsValid()); 56 EXPECT_FALSE(index1.IsValid());
52 } 57 }
53 58
54 TEST(IntrusiveHeapTest, Destructor) { 59 TEST_F(IntrusiveHeapTest, Destructor) {
55 HeapHandle index1; 60 HeapHandle index1;
56 61
57 { 62 {
58 IntrusiveHeap<TestElement> heap; 63 IntrusiveHeap<TestElement> heap;
59 64
60 heap.insert({11, &index1}); 65 heap.insert({11, &index1});
61 EXPECT_EQ(1u, heap.size()); 66 EXPECT_EQ(1u, heap.size());
62 EXPECT_TRUE(index1.IsValid()); 67 EXPECT_TRUE(index1.IsValid());
63 } 68 }
64 69
65 EXPECT_FALSE(index1.IsValid()); 70 EXPECT_FALSE(index1.IsValid());
66 } 71 }
67 72
68 TEST(IntrusiveHeapTest, Min) { 73 TEST_F(IntrusiveHeapTest, Min) {
69 IntrusiveHeap<TestElement> heap; 74 IntrusiveHeap<TestElement> heap;
70 75
71 heap.insert({9, nullptr}); 76 heap.insert({9, nullptr});
72 heap.insert({10, nullptr}); 77 heap.insert({10, nullptr});
73 heap.insert({8, nullptr}); 78 heap.insert({8, nullptr});
74 heap.insert({2, nullptr}); 79 heap.insert({2, nullptr});
75 heap.insert({7, nullptr}); 80 heap.insert({7, nullptr});
76 heap.insert({15, nullptr}); 81 heap.insert({15, nullptr});
77 heap.insert({22, nullptr}); 82 heap.insert({22, nullptr});
78 heap.insert({3, nullptr}); 83 heap.insert({3, nullptr});
79 84
80 EXPECT_FALSE(heap.empty()); 85 EXPECT_FALSE(heap.empty());
81 EXPECT_EQ(8u, heap.size()); 86 EXPECT_EQ(8u, heap.size());
82 EXPECT_EQ(2, heap.min().key); 87 EXPECT_EQ(2, heap.min().key);
83 } 88 }
84 89
85 TEST(IntrusiveHeapTest, InsertAscending) { 90 TEST_F(IntrusiveHeapTest, InsertAscending) {
86 IntrusiveHeap<TestElement> heap; 91 IntrusiveHeap<TestElement> heap;
87 HeapHandle index1; 92 HeapHandle index1;
88 93
89 for (int i = 0; i < 50; i++) 94 for (int i = 0; i < 50; i++)
90 heap.insert({i, nullptr}); 95 heap.insert({i, nullptr});
91 96
92 EXPECT_EQ(0, heap.min().key); 97 EXPECT_EQ(0, heap.min().key);
93 EXPECT_EQ(50u, heap.size()); 98 EXPECT_EQ(50u, heap.size());
94 } 99 }
95 100
96 TEST(IntrusiveHeapTest, InsertDescending) { 101 TEST_F(IntrusiveHeapTest, InsertDescending) {
97 IntrusiveHeap<TestElement> heap; 102 IntrusiveHeap<TestElement> heap;
98 103
99 for (int i = 0; i < 50; i++) 104 for (int i = 0; i < 50; i++)
100 heap.insert({50 - i, nullptr}); 105 heap.insert({50 - i, nullptr});
101 106
102 EXPECT_EQ(1, heap.min().key); 107 EXPECT_EQ(1, heap.min().key);
103 EXPECT_EQ(50u, heap.size()); 108 EXPECT_EQ(50u, heap.size());
104 } 109 }
105 110
106 TEST(IntrusiveHeapTest, HeapIndex) { 111 TEST_F(IntrusiveHeapTest, HeapIndex) {
107 HeapHandle index5; 112 HeapHandle index5;
108 HeapHandle index4; 113 HeapHandle index4;
109 HeapHandle index3; 114 HeapHandle index3;
110 HeapHandle index2; 115 HeapHandle index2;
111 HeapHandle index1; 116 HeapHandle index1;
112 IntrusiveHeap<TestElement> heap; 117 IntrusiveHeap<TestElement> heap;
113 118
114 EXPECT_FALSE(index1.IsValid()); 119 EXPECT_FALSE(index1.IsValid());
115 EXPECT_FALSE(index2.IsValid()); 120 EXPECT_FALSE(index2.IsValid());
116 EXPECT_FALSE(index3.IsValid()); 121 EXPECT_FALSE(index3.IsValid());
117 EXPECT_FALSE(index4.IsValid()); 122 EXPECT_FALSE(index4.IsValid());
118 EXPECT_FALSE(index5.IsValid()); 123 EXPECT_FALSE(index5.IsValid());
119 124
120 heap.insert({15, &index5}); 125 heap.insert({15, &index5});
121 heap.insert({14, &index4}); 126 heap.insert({14, &index4});
122 heap.insert({13, &index3}); 127 heap.insert({13, &index3});
123 heap.insert({12, &index2}); 128 heap.insert({12, &index2});
124 heap.insert({11, &index1}); 129 heap.insert({11, &index1});
125 130
126 EXPECT_TRUE(index1.IsValid()); 131 EXPECT_TRUE(index1.IsValid());
127 EXPECT_TRUE(index2.IsValid()); 132 EXPECT_TRUE(index2.IsValid());
128 EXPECT_TRUE(index3.IsValid()); 133 EXPECT_TRUE(index3.IsValid());
129 EXPECT_TRUE(index4.IsValid()); 134 EXPECT_TRUE(index4.IsValid());
130 EXPECT_TRUE(index5.IsValid()); 135 EXPECT_TRUE(index5.IsValid());
131 136
132 EXPECT_FALSE(heap.empty()); 137 EXPECT_FALSE(heap.empty());
133 } 138 }
134 139
135 TEST(IntrusiveHeapTest, Pop) { 140 TEST_F(IntrusiveHeapTest, Pop) {
136 IntrusiveHeap<TestElement> heap; 141 IntrusiveHeap<TestElement> heap;
137 HeapHandle index1; 142 HeapHandle index1;
138 HeapHandle index2; 143 HeapHandle index2;
139 144
140 heap.insert({11, &index1}); 145 heap.insert({11, &index1});
141 heap.insert({12, &index2}); 146 heap.insert({12, &index2});
142 EXPECT_EQ(2u, heap.size()); 147 EXPECT_EQ(2u, heap.size());
143 EXPECT_TRUE(index1.IsValid()); 148 EXPECT_TRUE(index1.IsValid());
144 EXPECT_TRUE(index2.IsValid()); 149 EXPECT_TRUE(index2.IsValid());
145 150
146 heap.pop(); 151 heap.pop();
147 EXPECT_EQ(1u, heap.size()); 152 EXPECT_EQ(1u, heap.size());
148 EXPECT_FALSE(index1.IsValid()); 153 EXPECT_FALSE(index1.IsValid());
149 EXPECT_TRUE(index2.IsValid()); 154 EXPECT_TRUE(index2.IsValid());
150 155
151 heap.pop(); 156 heap.pop();
152 EXPECT_EQ(0u, heap.size()); 157 EXPECT_EQ(0u, heap.size());
153 EXPECT_FALSE(index1.IsValid()); 158 EXPECT_FALSE(index1.IsValid());
154 EXPECT_FALSE(index2.IsValid()); 159 EXPECT_FALSE(index2.IsValid());
155 } 160 }
156 161
157 TEST(IntrusiveHeapTest, PopMany) { 162 TEST_F(IntrusiveHeapTest, PopMany) {
158 IntrusiveHeap<TestElement> heap; 163 IntrusiveHeap<TestElement> heap;
159 164
160 for (int i = 0; i < 500; i++) 165 for (int i = 0; i < 500; i++)
161 heap.insert({i, nullptr}); 166 heap.insert({i, nullptr});
162 167
163 EXPECT_FALSE(heap.empty()); 168 EXPECT_FALSE(heap.empty());
164 EXPECT_EQ(500u, heap.size()); 169 EXPECT_EQ(500u, heap.size());
165 for (int i = 0; i < 500; i++) { 170 for (int i = 0; i < 500; i++) {
166 EXPECT_EQ(i, heap.min().key); 171 EXPECT_EQ(i, heap.min().key);
167 heap.pop(); 172 heap.pop();
168 } 173 }
169 EXPECT_TRUE(heap.empty()); 174 EXPECT_TRUE(heap.empty());
170 } 175 }
171 176
172 TEST(IntrusiveHeapTest, Erase) { 177 TEST_F(IntrusiveHeapTest, Erase) {
173 IntrusiveHeap<TestElement> heap; 178 IntrusiveHeap<TestElement> heap;
174 179
175 HeapHandle index12; 180 HeapHandle index12;
176 181
177 heap.insert({15, nullptr}); 182 heap.insert({15, nullptr});
178 heap.insert({14, nullptr}); 183 heap.insert({14, nullptr});
179 heap.insert({13, nullptr}); 184 heap.insert({13, nullptr});
180 heap.insert({12, &index12}); 185 heap.insert({12, &index12});
181 heap.insert({11, nullptr}); 186 heap.insert({11, nullptr});
182 187
183 EXPECT_EQ(5u, heap.size()); 188 EXPECT_EQ(5u, heap.size());
184 EXPECT_TRUE(index12.IsValid()); 189 EXPECT_TRUE(index12.IsValid());
185 heap.erase(index12); 190 heap.erase(index12);
186 EXPECT_EQ(4u, heap.size()); 191 EXPECT_EQ(4u, heap.size());
187 EXPECT_FALSE(index12.IsValid()); 192 EXPECT_FALSE(index12.IsValid());
188 193
189 EXPECT_EQ(11, heap.min().key); 194 EXPECT_EQ(11, heap.min().key);
190 heap.pop(); 195 heap.pop();
191 EXPECT_EQ(13, heap.min().key); 196 EXPECT_EQ(13, heap.min().key);
192 heap.pop(); 197 heap.pop();
193 EXPECT_EQ(14, heap.min().key); 198 EXPECT_EQ(14, heap.min().key);
194 heap.pop(); 199 heap.pop();
195 EXPECT_EQ(15, heap.min().key); 200 EXPECT_EQ(15, heap.min().key);
196 heap.pop(); 201 heap.pop();
197 EXPECT_TRUE(heap.empty()); 202 EXPECT_TRUE(heap.empty());
198 } 203 }
199 204
200 TEST(IntrusiveHeapTest, ReplaceMin) { 205 TEST_F(IntrusiveHeapTest, ReplaceMin) {
201 IntrusiveHeap<TestElement> heap; 206 IntrusiveHeap<TestElement> heap;
202 207
203 for (int i = 0; i < 500; i++) 208 for (int i = 0; i < 500; i++)
204 heap.insert({500 - i, nullptr}); 209 heap.insert({500 - i, nullptr});
205 210
206 EXPECT_EQ(1, heap.min().key); 211 EXPECT_EQ(1, heap.min().key);
207 212
208 for (int i = 0; i < 500; i++) 213 for (int i = 0; i < 500; i++)
209 heap.ReplaceMin({1000 + i, nullptr}); 214 heap.ReplaceMin({1000 + i, nullptr});
210 215
211 EXPECT_EQ(1000, heap.min().key); 216 EXPECT_EQ(1000, heap.min().key);
212 } 217 }
213 218
214 TEST(IntrusiveHeapTest, ReplaceMinWithNonLeafNode) { 219 TEST_F(IntrusiveHeapTest, ReplaceMinWithNonLeafNode) {
215 IntrusiveHeap<TestElement> heap; 220 IntrusiveHeap<TestElement> heap;
216 221
217 for (int i = 0; i < 50; i++) { 222 for (int i = 0; i < 50; i++) {
218 heap.insert({i, nullptr}); 223 heap.insert({i, nullptr});
219 heap.insert({200 + i, nullptr}); 224 heap.insert({200 + i, nullptr});
220 } 225 }
221 226
222 EXPECT_EQ(0, heap.min().key); 227 EXPECT_EQ(0, heap.min().key);
223 228
224 for (int i = 0; i < 50; i++) 229 for (int i = 0; i < 50; i++)
225 heap.ReplaceMin({100 + i, nullptr}); 230 heap.ReplaceMin({100 + i, nullptr});
226 231
227 for (int i = 0; i < 50; i++) { 232 for (int i = 0; i < 50; i++) {
228 EXPECT_EQ((100 + i), heap.min().key); 233 EXPECT_EQ((100 + i), heap.min().key);
229 heap.pop(); 234 heap.pop();
230 } 235 }
231 for (int i = 0; i < 50; i++) { 236 for (int i = 0; i < 50; i++) {
232 EXPECT_EQ((200 + i), heap.min().key); 237 EXPECT_EQ((200 + i), heap.min().key);
233 heap.pop(); 238 heap.pop();
234 } 239 }
235 EXPECT_TRUE(heap.empty()); 240 EXPECT_TRUE(heap.empty());
236 } 241 }
237 242
238 TEST(IntrusiveHeapTest, ReplaceMinCheckAllFinalPositions) { 243 TEST_F(IntrusiveHeapTest, ReplaceMinCheckAllFinalPositions) {
239 HeapHandle index[100]; 244 HeapHandle index[100];
240 245
241 for (int j = -1; j <= 201; j += 2) { 246 for (int j = -1; j <= 201; j += 2) {
242 IntrusiveHeap<TestElement> heap; 247 IntrusiveHeap<TestElement> heap;
243 for (size_t i = 0; i < 100; i++) { 248 for (size_t i = 0; i < 100; i++) {
244 heap.insert({static_cast<int>(i) * 2, &index[i]}); 249 heap.insert({static_cast<int>(i) * 2, &index[i]});
245 } 250 }
246 251
247 heap.ReplaceMin({j, &index[40]}); 252 heap.ReplaceMin({j, &index[40]});
248 253
249 int prev = -2; 254 int prev = -2;
250 while (!heap.empty()) { 255 while (!heap.empty()) {
251 DCHECK_GT(heap.min().key, prev); 256 DCHECK_GT(heap.min().key, prev);
252 DCHECK(heap.min().key == j || (heap.min().key % 2) == 0); 257 DCHECK(heap.min().key == j || (heap.min().key % 2) == 0);
253 DCHECK_NE(heap.min().key, 0); 258 DCHECK_NE(heap.min().key, 0);
254 prev = heap.min().key; 259 prev = heap.min().key;
255 heap.pop(); 260 heap.pop();
256 } 261 }
257 } 262 }
258 } 263 }
259 264
260 TEST(IntrusiveHeapTest, ChangeKeyUp) { 265 TEST_F(IntrusiveHeapTest, ChangeKeyUp) {
261 IntrusiveHeap<TestElement> heap; 266 IntrusiveHeap<TestElement> heap;
262 HeapHandle index[10]; 267 HeapHandle index[10];
263 268
264 for (size_t i = 0; i < 10; i++) { 269 for (size_t i = 0; i < 10; i++) {
265 heap.insert({static_cast<int>(i) * 2, &index[i]}); 270 heap.insert({static_cast<int>(i) * 2, &index[i]});
266 } 271 }
267 272
268 heap.ChangeKey(index[5], {17, &index[5]}); 273 heap.ChangeKey(index[5], {17, &index[5]});
269 274
270 std::vector<int> results; 275 std::vector<int> results;
271 while (!heap.empty()) { 276 while (!heap.empty()) {
272 results.push_back(heap.min().key); 277 results.push_back(heap.min().key);
273 heap.pop(); 278 heap.pop();
274 } 279 }
275 280
276 EXPECT_THAT(results, testing::ElementsAre(0, 2, 4, 6, 8, 12, 14, 16, 17, 18)); 281 EXPECT_THAT(results, testing::ElementsAre(0, 2, 4, 6, 8, 12, 14, 16, 17, 18));
277 } 282 }
278 283
279 TEST(IntrusiveHeapTest, ChangeKeyUpButDoesntMove) { 284 TEST_F(IntrusiveHeapTest, ChangeKeyUpButDoesntMove) {
280 IntrusiveHeap<TestElement> heap; 285 IntrusiveHeap<TestElement> heap;
281 HeapHandle index[10]; 286 HeapHandle index[10];
282 287
283 for (size_t i = 0; i < 10; i++) { 288 for (size_t i = 0; i < 10; i++) {
284 heap.insert({static_cast<int>(i) * 2, &index[i]}); 289 heap.insert({static_cast<int>(i) * 2, &index[i]});
285 } 290 }
286 291
287 heap.ChangeKey(index[5], {11, &index[5]}); 292 heap.ChangeKey(index[5], {11, &index[5]});
288 293
289 std::vector<int> results; 294 std::vector<int> results;
290 while (!heap.empty()) { 295 while (!heap.empty()) {
291 results.push_back(heap.min().key); 296 results.push_back(heap.min().key);
292 heap.pop(); 297 heap.pop();
293 } 298 }
294 299
295 EXPECT_THAT(results, testing::ElementsAre(0, 2, 4, 6, 8, 11, 12, 14, 16, 18)); 300 EXPECT_THAT(results, testing::ElementsAre(0, 2, 4, 6, 8, 11, 12, 14, 16, 18));
296 } 301 }
297 302
298 TEST(IntrusiveHeapTest, ChangeKeyDown) { 303 TEST_F(IntrusiveHeapTest, ChangeKeyDown) {
299 IntrusiveHeap<TestElement> heap; 304 IntrusiveHeap<TestElement> heap;
300 HeapHandle index[10]; 305 HeapHandle index[10];
301 306
302 for (size_t i = 0; i < 10; i++) { 307 for (size_t i = 0; i < 10; i++) {
303 heap.insert({static_cast<int>(i) * 2, &index[i]}); 308 heap.insert({static_cast<int>(i) * 2, &index[i]});
304 } 309 }
305 310
306 heap.ChangeKey(index[5], {1, &index[5]}); 311 heap.ChangeKey(index[5], {1, &index[5]});
307 312
308 std::vector<int> results; 313 std::vector<int> results;
309 while (!heap.empty()) { 314 while (!heap.empty()) {
310 results.push_back(heap.min().key); 315 results.push_back(heap.min().key);
311 heap.pop(); 316 heap.pop();
312 } 317 }
313 318
314 EXPECT_THAT(results, testing::ElementsAre(0, 1, 2, 4, 6, 8, 12, 14, 16, 18)); 319 EXPECT_THAT(results, testing::ElementsAre(0, 1, 2, 4, 6, 8, 12, 14, 16, 18));
315 } 320 }
316 321
317 TEST(IntrusiveHeapTest, ChangeKeyDownButDoesntMove) { 322 TEST_F(IntrusiveHeapTest, ChangeKeyDownButDoesntMove) {
318 IntrusiveHeap<TestElement> heap; 323 IntrusiveHeap<TestElement> heap;
319 HeapHandle index[10]; 324 HeapHandle index[10];
320 325
321 for (size_t i = 0; i < 10; i++) { 326 for (size_t i = 0; i < 10; i++) {
322 heap.insert({static_cast<int>(i) * 2, &index[i]}); 327 heap.insert({static_cast<int>(i) * 2, &index[i]});
323 } 328 }
324 329
325 heap.ChangeKey(index[5], {9, &index[5]}); 330 heap.ChangeKey(index[5], {9, &index[5]});
326 331
327 std::vector<int> results; 332 std::vector<int> results;
328 while (!heap.empty()) { 333 while (!heap.empty()) {
329 results.push_back(heap.min().key); 334 results.push_back(heap.min().key);
330 heap.pop(); 335 heap.pop();
331 } 336 }
332 337
333 EXPECT_THAT(results, testing::ElementsAre(0, 2, 4, 6, 8, 9, 12, 14, 16, 18)); 338 EXPECT_THAT(results, testing::ElementsAre(0, 2, 4, 6, 8, 9, 12, 14, 16, 18));
334 } 339 }
335 340
336 TEST(IntrusiveHeapTest, ChangeKeyCheckAllFinalPositions) { 341 TEST_F(IntrusiveHeapTest, ChangeKeyCheckAllFinalPositions) {
337 HeapHandle index[100]; 342 HeapHandle index[100];
338 343
339 for (int j = -1; j <= 201; j += 2) { 344 for (int j = -1; j <= 201; j += 2) {
340 IntrusiveHeap<TestElement> heap; 345 IntrusiveHeap<TestElement> heap;
341 for (size_t i = 0; i < 100; i++) { 346 for (size_t i = 0; i < 100; i++) {
342 heap.insert({static_cast<int>(i) * 2, &index[i]}); 347 heap.insert({static_cast<int>(i) * 2, &index[i]});
343 } 348 }
344 349
345 heap.ChangeKey(index[40], {j, &index[40]}); 350 heap.ChangeKey(index[40], {j, &index[40]});
346 351
347 int prev = -2; 352 int prev = -2;
348 while (!heap.empty()) { 353 while (!heap.empty()) {
349 DCHECK_GT(heap.min().key, prev); 354 DCHECK_GT(heap.min().key, prev);
350 DCHECK(heap.min().key == j || (heap.min().key % 2) == 0); 355 DCHECK(heap.min().key == j || (heap.min().key % 2) == 0);
351 DCHECK_NE(heap.min().key, 80); 356 DCHECK_NE(heap.min().key, 80);
352 prev = heap.min().key; 357 prev = heap.min().key;
353 heap.pop(); 358 heap.pop();
354 } 359 }
355 } 360 }
356 } 361 }
357 362
363 TEST_F(IntrusiveHeapTest, CompareNodes) {
364 TestElement five{5, nullptr}, six{6, nullptr};
365
366 // This is the stdlibc++ assertion that fails in http://crbug.com/661080
367 EXPECT_FALSE(IntrusiveHeapTest::CompareNodes(six, six));
368
369 EXPECT_FALSE(IntrusiveHeapTest::CompareNodes(five, six));
370 EXPECT_TRUE(IntrusiveHeapTest::CompareNodes(six, five));
371 }
372
358 } // namespace scheduler 373 } // namespace scheduler
359 } // namespace blink 374 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/scheduler/base/intrusive_heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698