Chromium Code Reviews| Index: Source/heap/HeapTest.cpp |
| diff --git a/Source/heap/HeapTest.cpp b/Source/heap/HeapTest.cpp |
| index 5b9d450b0cd2ca77736bf2debacb03f96b544d09..d862b8a43ee47d93f2c39b3c3f9d0159dc163023 100644 |
| --- a/Source/heap/HeapTest.cpp |
| +++ b/Source/heap/HeapTest.cpp |
| @@ -175,6 +175,7 @@ public: |
| static SimpleObject* create() { return new SimpleObject(); } |
| void trace(Visitor*) { } |
| char getPayload(int i) { return payload[i]; } |
| + virtual void virtualMethod() { } |
|
Mads Ager (chromium)
2014/04/02 18:13:56
I'll add a comment that this make sure that the ob
|
| protected: |
| SimpleObject() { } |
| char payload[64]; |
| @@ -1137,10 +1138,9 @@ class Mixin : public GarbageCollectedMixin { |
| public: |
| virtual void trace(Visitor* visitor) { } |
| - char getPayload(int i) { return m_padding[i]; } |
| + virtual char getPayload(int i) { return m_padding[i]; } |
| protected: |
| - // This is to force ptr diff for SimpleObject, Mixin, and UseMixin. |
| int m_padding[8]; |
| }; |
| @@ -2983,20 +2983,25 @@ TEST(HeapTest, CollectionNesting) |
| EXPECT_EQ(1, IntWrapper::s_destructorCalls); |
| } |
| -TEST(heap, GarbageCollectedMixin) |
| +TEST(HeapTest, GarbageCollectedMixin) |
| { |
| HeapStats initialHeapStats; |
| clearOutOldGarbage(&initialHeapStats); |
| Persistent<UseMixin> usemixin = UseMixin::create(); |
| - ASSERT_EQ(0, UseMixin::s_traceCount); |
| + EXPECT_EQ(0, UseMixin::s_traceCount); |
| Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| - ASSERT_EQ(1, UseMixin::s_traceCount); |
| + EXPECT_EQ(1, UseMixin::s_traceCount); |
| Persistent<Mixin> mixin = usemixin; |
| usemixin = nullptr; |
| Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| - ASSERT_EQ(2, UseMixin::s_traceCount); |
| + EXPECT_EQ(2, UseMixin::s_traceCount); |
| + |
| + PersistentHeapHashSet<WeakMember<Mixin> > weakMap; |
| + weakMap.add(UseMixin::create()); |
| + Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| + EXPECT_EQ(0u, weakMap.size()); |
| } |
| TEST(HeapTest, CollectionNesting2) |