Index: third_party/WebKit/Source/platform/heap/HeapTest.cpp |
diff --git a/third_party/WebKit/Source/platform/heap/HeapTest.cpp b/third_party/WebKit/Source/platform/heap/HeapTest.cpp |
index 87fdcaa18331296c7c03e9537de14ed1f26e1592..340b1cf0d002ed9ff07eee6918d1908a86f49192 100644 |
--- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp |
+++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp |
@@ -6434,4 +6434,34 @@ TEST(HeapTest, CrossThreadWeakPersistent) |
parkMainThread(); |
} |
+class TestPersistentHeapVectorWithUnusedSlots : public PersistentHeapVector<VectorObject, 16> { |
+public: |
+ void checkUnused() |
+ { |
+ checkUnusedSlots(end(), end() + (capacity() - size())); |
+ } |
+}; |
+ |
+TEST(HeapTest, TestPersistentHeapVectorWithUnusedSlots) |
+{ |
+ TestPersistentHeapVectorWithUnusedSlots vector1; |
+ TestPersistentHeapVectorWithUnusedSlots vector2(vector1); |
+ |
+ vector1.checkUnused(); |
+ vector2.checkUnused(); |
+ |
+ vector2.append(VectorObject()); |
+ vector2.checkUnused(); |
+ |
+ EXPECT_EQ(0u, vector1.size()); |
+ |
+ EXPECT_EQ(1u, vector2.size()); |
+// TODO(Oilpan): when Vector.h's contiguous container support no longer disables |
+// Vector<>s with inline capacity, remove. |
+#if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) |
+ EXPECT_EQ(16u, vector1.capacity()); |
+ EXPECT_EQ(16u, vector2.capacity()); |
+#endif |
+} |
+ |
} // namespace blink |