OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 TestClass2() : padding(0) { | 47 TestClass2() : padding(0) { |
48 static int test_ids = 0; | 48 static int test_ids = 0; |
49 id = test_ids++; | 49 id = test_ids++; |
50 } | 50 } |
51 int id; | 51 int id; |
52 int padding; | 52 int padding; |
53 }; | 53 }; |
54 | 54 |
55 } // anonymous namespace | 55 } // anonymous namespace |
56 | 56 |
57 class PODFreeListArenaTest : public testing::Test { | 57 class PODFreeListArenaTest : public ::testing::Test { |
58 protected: | 58 protected: |
59 int GetFreeListSize(PassRefPtr<PODFreeListArena<TestClass1>> arena) const { | 59 int GetFreeListSize(PassRefPtr<PODFreeListArena<TestClass1>> arena) const { |
60 return arena->GetFreeListSizeForTesting(); | 60 return arena->GetFreeListSizeForTesting(); |
61 } | 61 } |
62 }; | 62 }; |
63 | 63 |
64 // Make sure the arena can successfully allocate from more than one | 64 // Make sure the arena can successfully allocate from more than one |
65 // region. | 65 // region. |
66 TEST_F(PODFreeListArenaTest, CanAllocateFromMoreThanOneRegion) { | 66 TEST_F(PODFreeListArenaTest, CanAllocateFromMoreThanOneRegion) { |
67 RefPtr<TrackedAllocator> allocator = TrackedAllocator::Create(); | 67 RefPtr<TrackedAllocator> allocator = TrackedAllocator::Create(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 157 } |
158 for (int i = 0; i < 100; i++) { | 158 for (int i = 0; i < 100; i++) { |
159 TestClass2* cur = arena->AllocateObject(); | 159 TestClass2* cur = arena->AllocateObject(); |
160 EXPECT_TRUE(objects.find(cur) != objects.end()); | 160 EXPECT_TRUE(objects.find(cur) != objects.end()); |
161 EXPECT_TRUE(cur->id >= 100 && cur->id < 200); | 161 EXPECT_TRUE(cur->id >= 100 && cur->id < 200); |
162 objects.erase(cur); | 162 objects.erase(cur); |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 } // namespace blink | 166 } // namespace blink |
OLD | NEW |