| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file has the unit tests for the IdAllocator class. | 5 // This file has the unit tests for the IdAllocator class. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/common/id_allocator.h" | 7 #include "gpu/command_buffer/common/id_allocator.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace gpu { | 10 namespace gpu { |
| 11 | 11 |
| 12 class IdAllocatorTest : public testing::Test { | 12 class IdAllocatorTest : public testing::Test { |
| 13 protected: | 13 protected: |
| 14 virtual void SetUp() {} | 14 void SetUp() override {} |
| 15 virtual void TearDown() {} | 15 void TearDown() override {} |
| 16 | 16 |
| 17 IdAllocator* id_allocator() { return &id_allocator_; } | 17 IdAllocator* id_allocator() { return &id_allocator_; } |
| 18 | 18 |
| 19 private: | 19 private: |
| 20 IdAllocator id_allocator_; | 20 IdAllocator id_allocator_; |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 // Checks basic functionality: AllocateID, FreeID, InUse. | 23 // Checks basic functionality: AllocateID, FreeID, InUse. |
| 24 TEST_F(IdAllocatorTest, TestBasic) { | 24 TEST_F(IdAllocatorTest, TestBasic) { |
| 25 IdAllocator *allocator = id_allocator(); | 25 IdAllocator *allocator = id_allocator(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 allocator->FreeID(id1 + 1); | 119 allocator->FreeID(id1 + 1); |
| 120 | 120 |
| 121 ResourceId id2 = allocator->AllocateID(); | 121 ResourceId id2 = allocator->AllocateID(); |
| 122 ResourceId id3 = allocator->AllocateID(); | 122 ResourceId id3 = allocator->AllocateID(); |
| 123 EXPECT_NE(id2, id3); | 123 EXPECT_NE(id2, id3); |
| 124 EXPECT_NE(kInvalidResource, id2); | 124 EXPECT_NE(kInvalidResource, id2); |
| 125 EXPECT_NE(kInvalidResource, id3); | 125 EXPECT_NE(kInvalidResource, id3); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace gpu | 128 } // namespace gpu |
| OLD | NEW |