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

Unified Diff: base/tracked_objects_unittest.cc

Issue 8432003: Reduce leaking in object tracking tests (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 2 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 | « base/tracked_objects.cc ('k') | tools/heapcheck/suppressions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/tracked_objects_unittest.cc
===================================================================
--- base/tracked_objects_unittest.cc (revision 107938)
+++ base/tracked_objects_unittest.cc (working copy)
@@ -16,11 +16,15 @@
class TrackedObjectsTest : public testing::Test {
public:
TrackedObjectsTest() {
- ThreadData::ShutdownSingleThreadedCleanup();
+ // On entry, leak any database structures in case they are still in use by
+ // prior threads.
+ ThreadData::ShutdownSingleThreadedCleanup(true);
}
~TrackedObjectsTest() {
- ThreadData::ShutdownSingleThreadedCleanup();
+ // We should not need to leak any structures we create, since we are
+ // single threaded, and carefully accounting for items.
+ ThreadData::ShutdownSingleThreadedCleanup(false);
}
};
@@ -41,7 +45,8 @@
ThreadData::DeathMap death_map;
data->SnapshotDeathMap(&death_map);
EXPECT_EQ(0u, death_map.size());
- ThreadData::ShutdownSingleThreadedCleanup();
+ // Cleanup with no leaking.
+ ThreadData::ShutdownSingleThreadedCleanup(false);
// Do it again, just to be sure we reset state completely.
ThreadData::InitializeAndSetTrackingStatus(true);
@@ -138,7 +143,7 @@
EXPECT_TRUE(dictionary->GetInteger("run_ms", &integer));
EXPECT_EQ(integer, 2 * run_ms);
EXPECT_TRUE(dictionary->GetInteger("queue_ms", &integer));
- EXPECT_EQ(integer, 2* queue_ms);
+ EXPECT_EQ(integer, 2 * queue_ms);
EXPECT_TRUE(dictionary->GetInteger("count", &integer));
EXPECT_EQ(integer, 2);
« no previous file with comments | « base/tracked_objects.cc ('k') | tools/heapcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698