1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/base/list_container.h"
8 #include "cc/quads/draw_quad.h"
9 #include "cc/quads/largest_draw_quad.h"
10 #include "cc/quads/render_pass_draw_quad.h"
11 #include "cc/quads/shared_quad_state.h"
12 #include "cc/quads/stream_video_draw_quad.h"
13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h"
16 // TODO(jbroman): This unit test should be made generic and moved to cc/base/.
21 int kMagicNumberToUseForDrawQuadOne
= 42;
22 int kMagicNumberToUseForDrawQuadTwo
= 314;
24 bool isConstSharedQuadStatePointer(const SharedQuadState
* ptr
) {
28 bool isConstSharedQuadStatePointer(SharedQuadState
* ptr
) {
32 class SimpleDrawQuad
: public DrawQuad
{
34 ~SimpleDrawQuad() override
{}
35 void IterateResources(const ResourceIteratorCallback
& callback
) override
{}
37 void set_value(int val
) { value
= val
; }
38 int get_value() { return value
; }
39 void ExtendValue(base::trace_event::TracedValue
* value
) const override
{}
45 class SimpleDrawQuadConstructMagicNumberOne
: public SimpleDrawQuad
{
47 SimpleDrawQuadConstructMagicNumberOne() : SimpleDrawQuad() {
48 set_value(kMagicNumberToUseForDrawQuadOne
);
52 class SimpleDrawQuadConstructMagicNumberTwo
: public SimpleDrawQuad
{
54 SimpleDrawQuadConstructMagicNumberTwo() : SimpleDrawQuad() {
55 set_value(kMagicNumberToUseForDrawQuadTwo
);
59 class MockDrawQuad
: public SimpleDrawQuadConstructMagicNumberOne
{
61 ~MockDrawQuad() override
{ Destruct(); }
62 MOCK_METHOD0(Destruct
, void());
65 class MockDrawQuadSubclass
: public MockDrawQuad
{
67 MockDrawQuadSubclass() { set_value(kMagicNumberToUseForDrawQuadTwo
); }
70 const size_t kLargestQuadSize
=
71 std::max(LargestDrawQuadSize(), sizeof(MockDrawQuadSubclass
));
73 TEST(ListContainerTest
, ConstructorCalledInAllocateAndConstruct
) {
74 ListContainer
<DrawQuad
> list(kLargestQuadSize
);
77 SimpleDrawQuadConstructMagicNumberOne
* dq_1
=
78 list
.AllocateAndConstruct
<SimpleDrawQuadConstructMagicNumberOne
>();
79 SimpleDrawQuadConstructMagicNumberTwo
* dq_2
=
80 list
.AllocateAndConstruct
<SimpleDrawQuadConstructMagicNumberTwo
>();
82 EXPECT_EQ(size
, list
.size());
83 EXPECT_EQ(dq_1
, list
.front());
84 EXPECT_EQ(dq_2
, list
.back());
86 EXPECT_EQ(kMagicNumberToUseForDrawQuadOne
, dq_1
->get_value());
87 EXPECT_EQ(kMagicNumberToUseForDrawQuadTwo
, dq_2
->get_value());
90 TEST(ListContainerTest
, DestructorCalled
) {
91 ListContainer
<DrawQuad
> list(kLargestQuadSize
);
94 MockDrawQuad
* dq_1
= list
.AllocateAndConstruct
<MockDrawQuad
>();
96 EXPECT_CALL(*dq_1
, Destruct());
97 EXPECT_EQ(size
, list
.size());
98 EXPECT_EQ(dq_1
, list
.front());
101 TEST(ListContainerTest
, DestructorCalledOnceWhenClear
) {
102 ListContainer
<DrawQuad
> list(kLargestQuadSize
);
104 MockDrawQuad
* dq_1
= list
.AllocateAndConstruct
<MockDrawQuad
>();
106 EXPECT_EQ(size
, list
.size());
107 EXPECT_EQ(dq_1
, list
.front());
109 // Make sure destructor is called once during clear, and won't be called
111 testing::MockFunction
<void()> separator
;
113 testing::InSequence s
;
114 EXPECT_CALL(*dq_1
, Destruct());
115 EXPECT_CALL(separator
, Call());
116 EXPECT_CALL(*dq_1
, Destruct()).Times(0);
123 TEST(ListContainerTest
, ReplaceExistingElement
) {
124 ListContainer
<DrawQuad
> list(kLargestQuadSize
);
126 MockDrawQuad
* dq_1
= list
.AllocateAndConstruct
<MockDrawQuad
>();
128 EXPECT_EQ(size
, list
.size());
129 EXPECT_EQ(dq_1
, list
.front());
131 // Make sure destructor is called once during clear, and won't be called
133 testing::MockFunction
<void()> separator
;
135 testing::InSequence s
;
136 EXPECT_CALL(*dq_1
, Destruct());
137 EXPECT_CALL(separator
, Call());
138 EXPECT_CALL(*dq_1
, Destruct()).Times(0);
141 list
.ReplaceExistingElement
<MockDrawQuadSubclass
>(list
.begin());
142 EXPECT_EQ(kMagicNumberToUseForDrawQuadTwo
, dq_1
->get_value());
145 EXPECT_CALL(*dq_1
, Destruct());
149 TEST(ListContainerTest
, DestructorCalledOnceWhenErase
) {
150 ListContainer
<DrawQuad
> list(kLargestQuadSize
);
152 MockDrawQuad
* dq_1
= list
.AllocateAndConstruct
<MockDrawQuad
>();
154 EXPECT_EQ(size
, list
.size());
155 EXPECT_EQ(dq_1
, list
.front());
157 // Make sure destructor is called once during clear, and won't be called
159 testing::MockFunction
<void()> separator
;
161 testing::InSequence s
;
162 EXPECT_CALL(*dq_1
, Destruct());
163 EXPECT_CALL(separator
, Call());
164 EXPECT_CALL(*dq_1
, Destruct()).Times(0);
167 list
.EraseAndInvalidateAllPointers(list
.begin());
171 TEST(ListContainerTest
, SimpleIndexAccessSharedQuadState
) {
172 ListContainer
<SharedQuadState
> list
;
175 SharedQuadState
* sqs_1
= list
.AllocateAndConstruct
<SharedQuadState
>();
176 SharedQuadState
* sqs_2
= list
.AllocateAndConstruct
<SharedQuadState
>();
177 SharedQuadState
* sqs_3
= list
.AllocateAndConstruct
<SharedQuadState
>();
179 EXPECT_EQ(size
, list
.size());
180 EXPECT_EQ(sqs_1
, list
.front());
181 EXPECT_EQ(sqs_3
, list
.back());
182 EXPECT_EQ(list
.front(), list
.ElementAt(0));
183 EXPECT_EQ(sqs_2
, list
.ElementAt(1));
184 EXPECT_EQ(list
.back(), list
.ElementAt(2));
187 TEST(ListContainerTest
, SimpleInsertionSharedQuadState
) {
188 ListContainer
<SharedQuadState
> list
;
191 SharedQuadState
* sqs_1
= list
.AllocateAndConstruct
<SharedQuadState
>();
192 list
.AllocateAndConstruct
<SharedQuadState
>();
193 SharedQuadState
* sqs_3
= list
.AllocateAndConstruct
<SharedQuadState
>();
195 EXPECT_EQ(size
, list
.size());
196 EXPECT_EQ(sqs_1
, list
.front());
197 EXPECT_EQ(sqs_3
, list
.back());
200 TEST(ListContainerTest
, SimpleInsertionAndClearSharedQuadState
) {
201 ListContainer
<SharedQuadState
> list
;
202 EXPECT_TRUE(list
.empty());
203 EXPECT_EQ(0u, list
.size());
206 SharedQuadState
* sqs_1
= list
.AllocateAndConstruct
<SharedQuadState
>();
207 list
.AllocateAndConstruct
<SharedQuadState
>();
208 SharedQuadState
* sqs_3
= list
.AllocateAndConstruct
<SharedQuadState
>();
210 EXPECT_EQ(size
, list
.size());
211 EXPECT_EQ(sqs_1
, list
.front());
212 EXPECT_EQ(sqs_3
, list
.back());
213 EXPECT_FALSE(list
.empty());
216 EXPECT_TRUE(list
.empty());
217 EXPECT_EQ(0u, list
.size());
220 TEST(ListContainerTest
, SimpleInsertionClearAndInsertAgainSharedQuadState
) {
221 ListContainer
<SharedQuadState
> list
;
222 EXPECT_TRUE(list
.empty());
223 EXPECT_EQ(0u, list
.size());
226 SharedQuadState
* sqs_front
= list
.AllocateAndConstruct
<SharedQuadState
>();
227 SharedQuadState
* sqs_back
= list
.AllocateAndConstruct
<SharedQuadState
>();
229 EXPECT_EQ(size
, list
.size());
230 EXPECT_EQ(sqs_front
, list
.front());
231 EXPECT_EQ(sqs_back
, list
.back());
232 EXPECT_FALSE(list
.empty());
235 EXPECT_TRUE(list
.empty());
236 EXPECT_EQ(0u, list
.size());
239 sqs_front
= list
.AllocateAndConstruct
<SharedQuadState
>();
240 list
.AllocateAndConstruct
<SharedQuadState
>();
241 sqs_back
= list
.AllocateAndConstruct
<SharedQuadState
>();
243 EXPECT_EQ(size
, list
.size());
244 EXPECT_EQ(sqs_front
, list
.front());
245 EXPECT_EQ(sqs_back
, list
.back());
246 EXPECT_FALSE(list
.empty());
249 // This test is used to test when there is more than one allocation needed
250 // for, ListContainer can still perform like normal vector.
251 TEST(ListContainerTest
,
252 SimpleInsertionTriggerMoreThanOneAllocationSharedQuadState
) {
253 ListContainer
<SharedQuadState
> list(sizeof(SharedQuadState
), 2);
254 std::vector
<SharedQuadState
*> sqs_list
;
256 for (size_t i
= 0; i
< size
; ++i
) {
257 sqs_list
.push_back(list
.AllocateAndConstruct
<SharedQuadState
>());
259 EXPECT_EQ(size
, list
.size());
261 ListContainer
<SharedQuadState
>::Iterator iter
= list
.begin();
262 for (std::vector
<SharedQuadState
*>::const_iterator sqs_iter
=
264 sqs_iter
!= sqs_list
.end(); ++sqs_iter
) {
265 EXPECT_EQ(*sqs_iter
, *iter
);
270 TEST(ListContainerTest
,
271 CorrectAllocationSizeForMoreThanOneAllocationSharedQuadState
) {
272 // Constructor sets the allocation size to 2. Every time ListContainer needs
273 // to allocate again, it doubles allocation size. In this test, 10 elements is
274 // needed, thus ListContainerShould allocate spaces 2, 4 and 8 elements.
275 ListContainer
<SharedQuadState
> list(sizeof(SharedQuadState
), 2);
276 std::vector
<SharedQuadState
*> sqs_list
;
278 for (size_t i
= 0; i
< size
; ++i
) {
279 // Before asking for a new element, space available without another
280 // allocation follows.
284 EXPECT_EQ(0u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
288 EXPECT_EQ(1u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
292 EXPECT_EQ(2u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
295 EXPECT_EQ(3u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
298 EXPECT_EQ(5u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
301 EXPECT_EQ(6u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
304 EXPECT_EQ(7u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
309 sqs_list
.push_back(list
.AllocateAndConstruct
<SharedQuadState
>());
310 // After asking for a new element, space available without another
311 // allocation follows.
315 EXPECT_EQ(0u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
319 EXPECT_EQ(1u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
322 EXPECT_EQ(2u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
325 EXPECT_EQ(3u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
328 EXPECT_EQ(4u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
331 EXPECT_EQ(5u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
334 EXPECT_EQ(6u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
337 EXPECT_EQ(7u, list
.AvailableSizeWithoutAnotherAllocationForTesting());
343 EXPECT_EQ(size
, list
.size());
345 ListContainer
<SharedQuadState
>::Iterator iter
= list
.begin();
346 for (std::vector
<SharedQuadState
*>::const_iterator sqs_iter
=
348 sqs_iter
!= sqs_list
.end(); ++sqs_iter
) {
349 EXPECT_EQ(*sqs_iter
, *iter
);
354 TEST(ListContainerTest
, SimpleIterationSharedQuadState
) {
355 ListContainer
<SharedQuadState
> list
;
356 std::vector
<SharedQuadState
*> sqs_list
;
358 for (size_t i
= 0; i
< size
; ++i
) {
359 sqs_list
.push_back(list
.AllocateAndConstruct
<SharedQuadState
>());
361 EXPECT_EQ(size
, list
.size());
363 size_t num_iters_in_list
= 0;
365 std::vector
<SharedQuadState
*>::const_iterator sqs_iter
= sqs_list
.begin();
366 for (ListContainer
<SharedQuadState
>::Iterator iter
= list
.begin();
367 iter
!= list
.end(); ++iter
) {
368 EXPECT_EQ(*sqs_iter
, *iter
);
374 size_t num_iters_in_vector
= 0;
376 ListContainer
<SharedQuadState
>::Iterator iter
= list
.begin();
377 for (std::vector
<SharedQuadState
*>::const_iterator sqs_iter
=
379 sqs_iter
!= sqs_list
.end(); ++sqs_iter
) {
380 EXPECT_EQ(*sqs_iter
, *iter
);
381 ++num_iters_in_vector
;
386 EXPECT_EQ(num_iters_in_vector
, num_iters_in_list
);
389 TEST(ListContainerTest
, SimpleConstIteratorIterationSharedQuadState
) {
390 ListContainer
<SharedQuadState
> list
;
391 std::vector
<const SharedQuadState
*> sqs_list
;
393 for (size_t i
= 0; i
< size
; ++i
) {
394 sqs_list
.push_back(list
.AllocateAndConstruct
<SharedQuadState
>());
396 EXPECT_EQ(size
, list
.size());
399 std::vector
<const SharedQuadState
*>::const_iterator sqs_iter
=
401 for (ListContainer
<SharedQuadState
>::ConstIterator iter
= list
.begin();
402 iter
!= list
.end(); ++iter
) {
403 EXPECT_TRUE(isConstSharedQuadStatePointer(*iter
));
404 EXPECT_EQ(*sqs_iter
, *iter
);
410 std::vector
<const SharedQuadState
*>::const_iterator sqs_iter
=
412 for (ListContainer
<SharedQuadState
>::Iterator iter
= list
.begin();
413 iter
!= list
.end(); ++iter
) {
414 EXPECT_FALSE(isConstSharedQuadStatePointer(*iter
));
415 EXPECT_EQ(*sqs_iter
, *iter
);
421 ListContainer
<SharedQuadState
>::ConstIterator iter
= list
.begin();
422 for (std::vector
<const SharedQuadState
*>::const_iterator sqs_iter
=
424 sqs_iter
!= sqs_list
.end(); ++sqs_iter
) {
425 EXPECT_EQ(*sqs_iter
, *iter
);
431 TEST(ListContainerTest
, SimpleReverseInsertionSharedQuadState
) {
432 ListContainer
<SharedQuadState
> list
;
433 std::vector
<SharedQuadState
*> sqs_list
;
435 for (size_t i
= 0; i
< size
; ++i
) {
436 sqs_list
.push_back(list
.AllocateAndConstruct
<SharedQuadState
>());
438 EXPECT_EQ(size
, list
.size());
441 std::vector
<SharedQuadState
*>::const_reverse_iterator sqs_iter
=
443 for (ListContainer
<SharedQuadState
>::ReverseIterator iter
= list
.rbegin();
444 iter
!= list
.rend(); ++iter
) {
445 EXPECT_EQ(*sqs_iter
, *iter
);
451 ListContainer
<SharedQuadState
>::ReverseIterator iter
= list
.rbegin();
452 for (std::vector
<SharedQuadState
*>::reverse_iterator sqs_iter
=
454 sqs_iter
!= sqs_list
.rend(); ++sqs_iter
) {
455 EXPECT_EQ(*sqs_iter
, *iter
);
461 TEST(ListContainerTest
, SimpleDeletion
) {
462 ListContainer
<DrawQuad
> list(kLargestQuadSize
);
463 std::vector
<SimpleDrawQuad
*> sdq_list
;
465 for (size_t i
= 0; i
< size
; ++i
) {
466 sdq_list
.push_back(list
.AllocateAndConstruct
<SimpleDrawQuad
>());
467 sdq_list
.back()->set_value(i
);
469 EXPECT_EQ(size
, list
.size());
471 list
.EraseAndInvalidateAllPointers(list
.begin());
473 EXPECT_EQ(size
, list
.size());
475 for (ListContainer
<DrawQuad
>::Iterator iter
= list
.begin();
476 iter
!= list
.end(); ++iter
) {
477 EXPECT_EQ(i
, static_cast<SimpleDrawQuad
*>(*iter
)->get_value());
482 TEST(ListContainerTest
, DeletionAllInAllocation
) {
483 const size_t kReserve
= 10;
484 ListContainer
<DrawQuad
> list(kLargestQuadSize
, kReserve
);
485 std::vector
<SimpleDrawQuad
*> sdq_list
;
486 // Add enough quads to cause another allocation.
487 for (size_t i
= 0; i
< kReserve
+ 1; ++i
) {
488 sdq_list
.push_back(list
.AllocateAndConstruct
<SimpleDrawQuad
>());
489 sdq_list
.back()->set_value(static_cast<int>(i
));
491 EXPECT_EQ(kReserve
+ 1, list
.size());
493 // Remove everything in the first allocation.
494 for (size_t i
= 0; i
< kReserve
; ++i
)
495 list
.EraseAndInvalidateAllPointers(list
.begin());
496 EXPECT_EQ(1u, list
.size());
498 // The last quad is left.
499 SimpleDrawQuad
* quad
= static_cast<SimpleDrawQuad
*>(*list
.begin());
500 EXPECT_EQ(static_cast<int>(kReserve
), quad
->get_value());
502 // Remove the quad from the 2nd allocation.
503 list
.EraseAndInvalidateAllPointers(list
.begin());
504 EXPECT_EQ(0u, list
.size());
507 TEST(ListContainerTest
, DeletionAllInAllocationReversed
) {
508 const size_t kReserve
= 10;
509 ListContainer
<DrawQuad
> list(kLargestQuadSize
, kReserve
);
510 std::vector
<SimpleDrawQuad
*> sdq_list
;
511 // Add enough quads to cause another allocation.
512 for (size_t i
= 0; i
< kReserve
+ 1; ++i
) {
513 sdq_list
.push_back(list
.AllocateAndConstruct
<SimpleDrawQuad
>());
514 sdq_list
.back()->set_value(static_cast<int>(i
));
516 EXPECT_EQ(kReserve
+ 1, list
.size());
518 // Remove everything in the 2nd allocation.
519 auto it
= list
.begin();
520 for (size_t i
= 0; i
< kReserve
; ++i
)
522 list
.EraseAndInvalidateAllPointers(it
);
524 // The 2nd-last quad is next, and the rest of the quads exist.
525 size_t i
= kReserve
- 1;
526 for (auto it
= list
.rbegin(); it
!= list
.rend(); ++it
) {
527 SimpleDrawQuad
* quad
= static_cast<SimpleDrawQuad
*>(*it
);
528 EXPECT_EQ(static_cast<int>(i
), quad
->get_value());
532 // Can forward iterate too.
534 for (auto it
= list
.begin(); it
!= list
.end(); ++it
) {
535 SimpleDrawQuad
* quad
= static_cast<SimpleDrawQuad
*>(*it
);
536 EXPECT_EQ(static_cast<int>(i
), quad
->get_value());
540 // Remove the last thing from the 1st allocation.
542 for (size_t i
= 0; i
< kReserve
- 1; ++i
)
544 list
.EraseAndInvalidateAllPointers(it
);
546 // The 2nd-last quad is next, and the rest of the quads exist.
548 for (auto it
= list
.rbegin(); it
!= list
.rend(); ++it
) {
549 SimpleDrawQuad
* quad
= static_cast<SimpleDrawQuad
*>(*it
);
550 EXPECT_EQ(static_cast<int>(i
), quad
->get_value());
554 // Can forward iterate too.
556 for (auto it
= list
.begin(); it
!= list
.end(); ++it
) {
557 SimpleDrawQuad
* quad
= static_cast<SimpleDrawQuad
*>(*it
);
558 EXPECT_EQ(static_cast<int>(i
), quad
->get_value());
563 TEST(ListContainerTest
, SimpleIterationAndManipulation
) {
564 ListContainer
<DrawQuad
> list(kLargestQuadSize
);
565 std::vector
<SimpleDrawQuad
*> sdq_list
;
567 for (size_t i
= 0; i
< size
; ++i
) {
568 SimpleDrawQuad
* simple_dq
= list
.AllocateAndConstruct
<SimpleDrawQuad
>();
569 sdq_list
.push_back(simple_dq
);
571 EXPECT_EQ(size
, list
.size());
573 ListContainer
<DrawQuad
>::Iterator iter
= list
.begin();
574 for (int i
= 0; i
< 10; ++i
) {
575 static_cast<SimpleDrawQuad
*>(*iter
)->set_value(i
);
580 for (std::vector
<SimpleDrawQuad
*>::const_iterator sdq_iter
= sdq_list
.begin();
581 sdq_iter
< sdq_list
.end(); ++sdq_iter
) {
582 EXPECT_EQ(i
, (*sdq_iter
)->get_value());
587 TEST(ListContainerTest
, SimpleManipulationWithIndexSimpleDrawQuad
) {
588 ListContainer
<DrawQuad
> list(kLargestQuadSize
);
589 std::vector
<SimpleDrawQuad
*> dq_list
;
591 for (size_t i
= 0; i
< size
; ++i
) {
592 dq_list
.push_back(list
.AllocateAndConstruct
<SimpleDrawQuad
>());
594 EXPECT_EQ(size
, list
.size());
596 for (size_t i
= 0; i
< size
; ++i
) {
597 static_cast<SimpleDrawQuad
*>(list
.ElementAt(i
))->set_value(i
);
601 for (std::vector
<SimpleDrawQuad
*>::const_iterator dq_iter
= dq_list
.begin();
602 dq_iter
!= dq_list
.end(); ++dq_iter
, ++i
) {
603 EXPECT_EQ(i
, (*dq_iter
)->get_value());
607 TEST(ListContainerTest
,
608 SimpleManipulationWithIndexMoreThanOneAllocationSimpleDrawQuad
) {
609 ListContainer
<DrawQuad
> list(LargestDrawQuadSize(), 2);
610 std::vector
<SimpleDrawQuad
*> dq_list
;
612 for (size_t i
= 0; i
< size
; ++i
) {
613 dq_list
.push_back(list
.AllocateAndConstruct
<SimpleDrawQuad
>());
615 EXPECT_EQ(size
, list
.size());
617 for (size_t i
= 0; i
< size
; ++i
) {
618 static_cast<SimpleDrawQuad
*>(list
.ElementAt(i
))->set_value(i
);
622 for (std::vector
<SimpleDrawQuad
*>::const_iterator dq_iter
= dq_list
.begin();
623 dq_iter
!= dq_list
.end(); ++dq_iter
, ++i
) {
624 EXPECT_EQ(i
, (*dq_iter
)->get_value());
628 TEST(ListContainerTest
,
629 SimpleIterationAndReverseIterationWithIndexSharedQuadState
) {
630 ListContainer
<SharedQuadState
> list
;
631 std::vector
<SharedQuadState
*> sqs_list
;
633 for (size_t i
= 0; i
< size
; ++i
) {
634 sqs_list
.push_back(list
.AllocateAndConstruct
<SharedQuadState
>());
636 EXPECT_EQ(size
, list
.size());
639 for (ListContainer
<SharedQuadState
>::Iterator iter
= list
.begin();
640 iter
!= list
.end(); ++iter
) {
641 EXPECT_EQ(i
, iter
.index());
646 for (ListContainer
<SharedQuadState
>::ReverseIterator iter
= list
.rbegin();
647 iter
!= list
.rend(); ++iter
) {
648 EXPECT_EQ(i
, iter
.index());