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

Unified Diff: Source/heap/HeapTest.cpp

Issue 138443002: 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 0d5bdb557837235bed620e9ec813eef86652eb52..a9922c199fdb7c3a3baa1ba074a99632bcf1b69a 100644
--- a/Source/heap/HeapTest.cpp
+++ b/Source/heap/HeapTest.cpp
@@ -561,11 +561,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);
@@ -582,26 +597,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);
@@ -611,19 +640,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.raw())),
- pageHeaderAddress(reinterpret_cast<Address>(typedHeapObject.raw())));
+ // 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.raw())),
+ pageHeaderAddress(reinterpret_cast<Address>(typedHeapObject.raw())));
+ }
+
+ 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
@@ -631,10 +674,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;
@@ -655,10 +704,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;
{
@@ -678,10 +733,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();
@@ -696,10 +757,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;
@@ -782,10 +849,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);
{
@@ -794,10 +867,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;
@@ -843,10 +922,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;
@@ -874,10 +959,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();
@@ -913,6 +1004,8 @@
// 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();
}
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