Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1221)

Unified Diff: Source/heap/HeapTest.cpp

Issue 139623003: Revert of Create our own blink_heap run_all_tests target to avoid piggy-backing on wtf's. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/Init.cpp ('k') | Source/heap/RunAllTests.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/heap/HeapTest.cpp
diff --git a/Source/heap/HeapTest.cpp b/Source/heap/HeapTest.cpp
index 31f4fbf8600dbcbd7d8c9a898664d20eddb20b23..51743f74e7b6095730eb24ecc12d3da687bad6bc 100644
--- a/Source/heap/HeapTest.cpp
+++ b/Source/heap/HeapTest.cpp
@@ -560,11 +560,26 @@
TEST(HeapTest, Threading)
{
+ Heap::init();
ThreadedHeapTester::test();
+ Heap::shutdown();
+}
+
+TEST(HeapTest, Init)
+{
+ // FIXME: init and shutdown should be called via Blink
+ // initialization in the test runner. This test can be removed
+ // when that is done.
+ Heap::init();
+ Heap::shutdown();
}
TEST(HeapTest, SimpleAllocation)
{
+ // FIXME: init and shutdown should be called via Blink
+ // initialization in the test runner.
+ Heap::init();
+
// Get initial heap stats.
HeapStats initialHeapStats;
getHeapStats(&initialHeapStats);
@@ -581,26 +596,40 @@
EXPECT_EQ(42, array->at(42));
EXPECT_EQ(0, array->at(128));
EXPECT_EQ(999 % 128, array->at(999));
+
+ Heap::shutdown();
}
TEST(HeapTest, SimplePersistent)
{
- Persistent<TraceCounter> traceCounter = TraceCounter::create();
- EXPECT_EQ(0, traceCounter->traceCount());
-
- Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
- EXPECT_EQ(1, traceCounter->traceCount());
-
- Persistent<ClassWithMember> classWithMember = ClassWithMember::create();
- EXPECT_EQ(0, classWithMember->traceCount());
-
- Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
- EXPECT_EQ(1, classWithMember->traceCount());
- EXPECT_EQ(2, traceCounter->traceCount());
+ // FIXME: init and shutdown should be called via Blink
+ // initialization in the test runner.
+ Heap::init();
+
+ {
+ Persistent<TraceCounter> traceCounter = TraceCounter::create();
+ EXPECT_EQ(0, traceCounter->traceCount());
+
+ Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
+ EXPECT_EQ(1, traceCounter->traceCount());
+
+ Persistent<ClassWithMember> classWithMember = ClassWithMember::create();
+ EXPECT_EQ(0, classWithMember->traceCount());
+
+ Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
+ EXPECT_EQ(1, classWithMember->traceCount());
+ EXPECT_EQ(2, traceCounter->traceCount());
+ }
+
+ Heap::shutdown();
}
TEST(HeapTest, SimpleFinalization)
{
+ // FIXME: init and shutdown should be called via Blink
+ // initialization in the test runner.
+ Heap::init();
+
{
Persistent<SimpleFinalizedObject> finalized = SimpleFinalizedObject::create();
EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls);
@@ -610,19 +639,33 @@
Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
EXPECT_EQ(1, SimpleFinalizedObject::s_destructorCalls);
+
+ Heap::shutdown();
}
TEST(HeapTest, TypedHeapSanity)
{
- // We use TraceCounter for allocating an object on the general heap.
- Persistent<TraceCounter> generalHeapObject = TraceCounter::create();
- Persistent<TestTypedHeapClass> typedHeapObject = TestTypedHeapClass::create();
- EXPECT_NE(pageHeaderAddress(reinterpret_cast<Address>(generalHeapObject.get())),
- pageHeaderAddress(reinterpret_cast<Address>(typedHeapObject.get())));
+ // FIXME: init and shutdown should be called via Blink
+ // initialization in the test runner.
+ Heap::init();
+
+ {
+ // We use TraceCounter for allocating an object on the general heap.
+ Persistent<TraceCounter> generalHeapObject = TraceCounter::create();
+ Persistent<TestTypedHeapClass> typedHeapObject = TestTypedHeapClass::create();
+ EXPECT_NE(pageHeaderAddress(reinterpret_cast<Address>(generalHeapObject.get())),
+ pageHeaderAddress(reinterpret_cast<Address>(typedHeapObject.get())));
+ }
+
+ Heap::shutdown();
}
TEST(HeapTest, NoAllocation)
{
+ // FIXME: init and shutdown should be called via Blink
+ // initialization in the test runner.
+ Heap::init();
+
EXPECT_TRUE(ThreadState::current()->isAllocationAllowed());
{
// Disallow allocation
@@ -630,10 +673,16 @@
EXPECT_FALSE(ThreadState::current()->isAllocationAllowed());
}
EXPECT_TRUE(ThreadState::current()->isAllocationAllowed());
+
+ Heap::shutdown();
}
TEST(HeapTest, Members)
{
+ // FIXME: init and shutdown should be called via Blink
+ // initialization in the test runner.
+ Heap::init();
+
Bar::s_live = 0;
{
Persistent<Baz> h1;
@@ -654,10 +703,16 @@
}
Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
EXPECT_EQ(0u, Bar::s_live);
+
+ Heap::shutdown();
}
TEST(HeapTest, DeepTest)
{
+ // FIXME: init and shutdown should be called via Blink
+ // initialization in the test runner.
+ Heap::init();
+
const unsigned depth = 100000;
Bar::s_live = 0;
{
@@ -677,10 +732,16 @@
}
Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
EXPECT_EQ(0u, Bar::s_live);
+
+ Heap::shutdown();
}
TEST(HeapTest, WideTest)
{
+ // FIXME: init and shutdown should be called via Blink
+ // initialization in the test runner.
+ Heap::init();
+
Bar::s_live = 0;
{
Bars* bars = Bars::create();
@@ -695,10 +756,16 @@
EXPECT_EQ(Bars::width + 1, Bar::s_live);
Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
EXPECT_EQ(0u, Bar::s_live);
+
+ Heap::shutdown();
}
TEST(HeapTest, HashMapOfMembers)
{
+ // FIXME: init and shutdown should be called via Blink
+ // initialization in the test runner.
+ Heap::init();
+
HeapStats initialHeapSize;
IntWrapper::s_destructorCalls = 0;
@@ -781,10 +848,16 @@
HeapStats afterGC4;
getHeapStats(&afterGC4);
EXPECT_EQ(afterGC4.totalObjectSpace(), initialHeapSize.totalObjectSpace());
+
+ Heap::shutdown();
}
TEST(HeapTest, NestedAllocation)
{
+ // FIXME: init and shutdown should be called via Blink
+ // initialization in the test runner.
+ Heap::init();
+
HeapStats initialHeapSize;
clearOutOldGarbage(&initialHeapSize);
{
@@ -793,10 +866,16 @@
HeapStats afterFree;
clearOutOldGarbage(&afterFree);
EXPECT_TRUE(initialHeapSize == afterFree);
+
+ Heap::shutdown();
}
TEST(HeapTest, LargeObjects)
{
+ // FIXME: init and shutdown should be called via Blink
+ // initialization in the test runner.
+ Heap::init();
+
HeapStats initialHeapSize;
clearOutOldGarbage(&initialHeapSize);
IntWrapper::s_destructorCalls = 0;
@@ -842,10 +921,16 @@
EXPECT_EQ(11, IntWrapper::s_destructorCalls);
EXPECT_EQ(11, LargeObject::s_destructorCalls);
Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
+
+ Heap::shutdown();
}
TEST(HeapTest, RefCountedGarbageCollected)
{
+ // FIXME: init and shutdown should be called via Blink
+ // initialization in the test runner.
+ Heap::init();
+
RefCountedAndGarbageCollected::s_destructorCalls = 0;
{
RefPtr<RefCountedAndGarbageCollected> refPtr3;
@@ -873,10 +958,16 @@
// object can be collected.
Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
EXPECT_EQ(2, RefCountedAndGarbageCollected::s_destructorCalls);
+
+ Heap::shutdown();
}
TEST(HeapTest, WeakMembers)
{
+ // FIXME: init and shutdown should be called via Blink
+ // initialization in the test runner.
+ Heap::init();
+
Bar::s_live = 0;
{
Persistent<Bar> h1 = Bar::create();
@@ -912,15 +1003,23 @@
// h4 and h5 have gone out of scope now and they were keeping h2 alive.
Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
EXPECT_EQ(0u, Bar::s_live); // All gone.
+
+ Heap::shutdown();
}
TEST(HeapTest, Comparisons)
{
- Persistent<Bar> barPersistent = Bar::create();
- Persistent<Foo> fooPersistent = Foo::create(barPersistent);
- EXPECT_TRUE(barPersistent != fooPersistent);
- barPersistent = fooPersistent;
- EXPECT_TRUE(barPersistent == fooPersistent);
+ Heap::init();
+
+ {
+ Persistent<Bar> barPersistent = Bar::create();
+ Persistent<Foo> fooPersistent = Foo::create(barPersistent);
+ EXPECT_TRUE(barPersistent != fooPersistent);
+ barPersistent = fooPersistent;
+ EXPECT_TRUE(barPersistent == fooPersistent);
+ }
+
+ Heap::shutdown();
}
DEFINE_GC_INFO(Bar);
« no previous file with comments | « Source/core/Init.cpp ('k') | Source/heap/RunAllTests.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698