From e375b8a4106fe8caad88d80f33576835b6a0bf74 Mon Sep 17 00:00:00 2001 From: "nhiroki@chromium.org" Date: Thu, 14 Nov 2013 07:45:00 +0000 Subject: SyncFS: Fix memory leaks on unit_tests SyncFileSystemBackend posts a delete task to the IO thread, but some tests do not wait for completion of the task and it causes memory leaks. This change makes them wait for completion. BUG=282646 TEST=unit_tests --gtest_filter=DeclarativeContentRulesRegistryTest.* TEST=unit_tests --gtest_filter=DeclarativeContentActionTest.* TEST=unit_tests --gtest_filter=SavedFilesServiceUnitTest.* Review URL: https://codereview.chromium.org/71223003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235092 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/extensions/test_extension_environment.cc | 2 ++ tools/heapcheck/suppressions.txt | 16 ---------------- tools/lsan/suppressions.txt | 5 ----- tools/valgrind/memcheck/suppressions.txt | 11 ----------- 4 files changed, 2 insertions(+), 32 deletions(-) diff --git a/chrome/browser/extensions/test_extension_environment.cc b/chrome/browser/extensions/test_extension_environment.cc index e501156..805ea2d 100644 --- a/chrome/browser/extensions/test_extension_environment.cc +++ b/chrome/browser/extensions/test_extension_environment.cc @@ -13,6 +13,7 @@ #include "chrome/browser/sessions/session_tab_helper.h" #include "chrome/common/extensions/extension.h" #include "chrome/test/base/testing_profile.h" +#include "content/public/test/test_utils.h" #include "content/public/test/web_contents_tester.h" #include "extensions/common/extension_builder.h" #include "extensions/common/value_builder.h" @@ -51,6 +52,7 @@ TestExtensionEnvironment::~TestExtensionEnvironment() { // Delete the profile, and then cycle the message loop to clear // out delayed deletions. base::RunLoop().RunUntilIdle(); + content::RunAllPendingInMessageLoop(content::BrowserThread::IO); } TestingProfile* TestExtensionEnvironment::profile() const { diff --git a/tools/heapcheck/suppressions.txt b/tools/heapcheck/suppressions.txt index 76dd000..4c44703 100644 --- a/tools/heapcheck/suppressions.txt +++ b/tools/heapcheck/suppressions.txt @@ -824,22 +824,6 @@ fun:SavedFilesServiceUnitTest::SavedFilesServiceUnitTest } { - bug_282646 - Heapcheck:Leak - ... - fun:SyncFileSystemBackend - fun:chrome::ChromeContentBrowserClient::GetAdditionalFileSystemBackends - fun:content::CreateFileSystemContext - fun:content::StoragePartitionImpl::Create - fun:content::StoragePartitionImplMap::Get - fun:GetStoragePartitionFromConfig - fun:content::BrowserContext::GetStoragePartitionForSite - fun:ExtensionService::NotifyExtensionUnloaded - fun:ExtensionService::UnloadExtension - fun:ExtensionService::AddExtension - fun:extensions::TestExtensionEnvironment::MakeExtension -} -{ bug_286185 Heapcheck:Leak fun:sqlite3MemMalloc diff --git a/tools/lsan/suppressions.txt b/tools/lsan/suppressions.txt index bf06b5e..2755c66 100644 --- a/tools/lsan/suppressions.txt +++ b/tools/lsan/suppressions.txt @@ -80,11 +80,6 @@ leak:cc::TileManager::ManageTiles # Leak in cc_unittests. http://crbug.com/317970 leak:cc::FakeTileManager::AssignMemoryToTiles -# Leak in unit_tests. http://crbug.com/282646 -leak:DeclarativeContentActionTest_ShowPageAction_Test::TestBody -leak:DeclarativeContentRulesRegistryTest_ActiveRulesDoesntGrow_Test::TestBody -leak:SavedFilesServiceUnitTest_NoRetainEntriesPermissionTest_Test::TestBody - # Leak in unit_tests. http://crbug.com/309468 leak:TranslateBubbleViewTest::SetUp diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt index e309d87..dc0d2c9 100644 --- a/tools/valgrind/memcheck/suppressions.txt +++ b/tools/valgrind/memcheck/suppressions.txt @@ -6075,17 +6075,6 @@ fun:_ZN3gpu13CommandParser14ProcessCommandEv } { - bug_282646 - Memcheck:Leak - fun:_Znw* - fun:_ZN16sync_file_system21SyncFileSystemBackendC1EP7Profile - fun:_ZN6chrome26ChromeContentBrowserClient31GetAdditionalFileSystemBackendsEPN7content14BrowserContextERKN4base8FilePathEP12ScopedVectorIN7fileapi17FileSystemBackendEE - fun:_ZN7content23CreateFileSystemContextEPNS_14BrowserContextERKN4base8FilePathEbPN5quota17QuotaManagerProxyE - fun:_ZN7content20StoragePartitionImpl6CreateEPNS_14BrowserContextEbRKN4base8FilePathE - fun:_ZN7content23StoragePartitionImplMap3GetERKSsS2_b - fun:_ZN7content12_GLOBAL__N_129GetStoragePartitionFromConfigEPNS_14BrowserContextERKSsS4_b -} -{ bug_288787 Memcheck:Leak fun:_Znw* -- cgit v1.1