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

Side by Side Diff: Source/platform/heap/HeapTest.cpp

Issue 371623002: [oilpan]: Make thread shutdown more robust. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review feedback Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
haraken 2014/07/08 05:44:51 I understand that it's a pain to add tests, but we
wibling-chromium 2014/07/08 13:39:47 I will try to cook something up. It might be in a
haraken 2014/07/09 05:17:48 Actually I want to have tests on this CL. Once thi
wibling-chromium 2014/07/09 10:32:30 Okay. That said we do have all the layout tests wh
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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer 11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the 12 * in the documentation and/or other materials provided with the
(...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); 1690 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
1691 EXPECT_EQ(2, HeapTestSubClass::s_destructorCalls); 1691 EXPECT_EQ(2, HeapTestSubClass::s_destructorCalls);
1692 EXPECT_EQ(3, HeapTestSuperClass::s_destructorCalls); 1692 EXPECT_EQ(3, HeapTestSuperClass::s_destructorCalls);
1693 } 1693 }
1694 1694
1695 TEST(HeapTest, TypedHeapSanity) 1695 TEST(HeapTest, TypedHeapSanity)
1696 { 1696 {
1697 // We use TraceCounter for allocating an object on the general heap. 1697 // We use TraceCounter for allocating an object on the general heap.
1698 Persistent<TraceCounter> generalHeapObject = TraceCounter::create(); 1698 Persistent<TraceCounter> generalHeapObject = TraceCounter::create();
1699 Persistent<TestTypedHeapClass> typedHeapObject = TestTypedHeapClass::create( ); 1699 Persistent<TestTypedHeapClass> typedHeapObject = TestTypedHeapClass::create( );
1700 EXPECT_NE(pageHeaderAddress(reinterpret_cast<Address>(generalHeapObject.get( ))), 1700 EXPECT_NE(pageHeaderFromObject(generalHeapObject.get()),
1701 pageHeaderAddress(reinterpret_cast<Address>(typedHeapObject.get()))); 1701 pageHeaderFromObject(typedHeapObject.get()));
1702 } 1702 }
1703 1703
1704 TEST(HeapTest, NoAllocation) 1704 TEST(HeapTest, NoAllocation)
1705 { 1705 {
1706 EXPECT_TRUE(ThreadState::current()->isAllocationAllowed()); 1706 EXPECT_TRUE(ThreadState::current()->isAllocationAllowed());
1707 { 1707 {
1708 // Disallow allocation 1708 // Disallow allocation
1709 NoAllocationScope<AnyThread> noAllocationScope; 1709 NoAllocationScope<AnyThread> noAllocationScope;
1710 EXPECT_FALSE(ThreadState::current()->isAllocationAllowed()); 1710 EXPECT_FALSE(ThreadState::current()->isAllocationAllowed());
1711 } 1711 }
(...skipping 2866 matching lines...) Expand 10 before | Expand all | Expand 10 after
4578 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); 4578 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
4579 EXPECT_EQ(1u, map->size()); 4579 EXPECT_EQ(1u, map->size());
4580 EXPECT_EQ(lifeObject, map->get(lifeObject)->link()); 4580 EXPECT_EQ(lifeObject, map->get(lifeObject)->link());
4581 lifeObject.clear(); // Despite its name. 4581 lifeObject.clear(); // Despite its name.
4582 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); 4582 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
4583 EXPECT_EQ(0u, map->size()); 4583 EXPECT_EQ(0u, map->size());
4584 } 4584 }
4585 4585
4586 4586
4587 } // WebCore namespace 4587 } // WebCore namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698