OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 17 matching lines...) Expand all Loading... |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 | 32 |
33 // This file has the unit tests for the IdAllocator class. | 33 // This file has the unit tests for the IdAllocator class. |
34 | 34 |
35 #include "gpu/command_buffer/client/id_allocator.h" | 35 #include "gpu/command_buffer/client/id_allocator.h" |
36 #include "testing/gtest/include/gtest/gtest.h" | 36 #include "testing/gtest/include/gtest/gtest.h" |
37 | 37 |
38 namespace command_buffer { | 38 namespace gpu { |
39 | 39 |
40 using command_buffer::ResourceId; | 40 using gpu::ResourceId; |
41 | 41 |
42 class IdAllocatorTest : public testing::Test { | 42 class IdAllocatorTest : public testing::Test { |
43 protected: | 43 protected: |
44 virtual void SetUp() {} | 44 virtual void SetUp() {} |
45 virtual void TearDown() {} | 45 virtual void TearDown() {} |
46 | 46 |
47 IdAllocator* id_allocator() { return &id_allocator_; } | 47 IdAllocator* id_allocator() { return &id_allocator_; } |
48 | 48 |
49 private: | 49 private: |
50 IdAllocator id_allocator_; | 50 IdAllocator id_allocator_; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 // Check that a new allocation re-uses the resource we just freed. | 103 // Check that a new allocation re-uses the resource we just freed. |
104 ResourceId id1 = ids[kNumResources / 2]; | 104 ResourceId id1 = ids[kNumResources / 2]; |
105 allocator->FreeID(id1); | 105 allocator->FreeID(id1); |
106 EXPECT_FALSE(allocator->InUse(id1)); | 106 EXPECT_FALSE(allocator->InUse(id1)); |
107 ResourceId id2 = allocator->AllocateID(); | 107 ResourceId id2 = allocator->AllocateID(); |
108 EXPECT_TRUE(allocator->InUse(id2)); | 108 EXPECT_TRUE(allocator->InUse(id2)); |
109 EXPECT_EQ(id1, id2); | 109 EXPECT_EQ(id1, id2); |
110 } | 110 } |
111 | 111 |
112 } // namespace command_buffer | 112 } // namespace gpu |
OLD | NEW |