| Index: gpu/command_buffer/common/id_allocator_test.cc
|
| ===================================================================
|
| --- gpu/command_buffer/common/id_allocator_test.cc (revision 86796)
|
| +++ gpu/command_buffer/common/id_allocator_test.cc (working copy)
|
| @@ -49,6 +49,9 @@
|
| TEST_F(IdAllocatorTest, TestAdvanced) {
|
| IdAllocator *allocator = id_allocator();
|
|
|
| + // Allocate the highest possible ID, to make life awkward.
|
| + allocator->AllocateIDAtOrAbove(-1);
|
| +
|
| // Allocate a significant number of resources.
|
| const unsigned int kNumResources = 100;
|
| ResourceId ids[kNumResources];
|
| @@ -95,4 +98,16 @@
|
| EXPECT_GT(id3, kOffset);
|
| }
|
|
|
| +// Checks that AllocateIdAtOrAbove wraps around at the maximum 32-bit value.
|
| +TEST_F(IdAllocatorTest, AllocateIdAtOrAboveWrapsAround) {
|
| + const ResourceId kMaxPossibleOffset = -1;
|
| + IdAllocator* allocator = id_allocator();
|
| + ResourceId id1 = allocator->AllocateIDAtOrAbove(kMaxPossibleOffset);
|
| + EXPECT_EQ(kMaxPossibleOffset, id1);
|
| + ResourceId id2 = allocator->AllocateIDAtOrAbove(kMaxPossibleOffset);
|
| + EXPECT_EQ(1u, id2);
|
| + ResourceId id3 = allocator->AllocateIDAtOrAbove(kMaxPossibleOffset);
|
| + EXPECT_EQ(2u, id3);
|
| +}
|
| +
|
| } // namespace gpu
|
|
|