diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-09 20:08:34 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-09 20:08:34 +0000 |
commit | 0e7a02bf814bf5a548e1d846f58fc614c449e31a (patch) | |
tree | ae1bd8ba85a3df6d50503f9708e036fe82e1491a /chrome | |
parent | 643f72d697f41ce192c17efcec403ec12b827b8f (diff) | |
download | chromium_src-0e7a02bf814bf5a548e1d846f58fc614c449e31a.zip chromium_src-0e7a02bf814bf5a548e1d846f58fc614c449e31a.tar.gz chromium_src-0e7a02bf814bf5a548e1d846f58fc614c449e31a.tar.bz2 |
Fix a memory leak in ExtensionsServiceTest by ensuring that the message loop
runs after destroying the ExtensionsService.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/381006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31464 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/extensions/extensions_service_unittest.cc | 7 | ||||
-rw-r--r-- | chrome/browser/extensions/user_script_listener_unittest.cc | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc index aa38fe6..63a12a2 100644 --- a/chrome/browser/extensions/extensions_service_unittest.cc +++ b/chrome/browser/extensions/extensions_service_unittest.cc @@ -209,6 +209,13 @@ class ExtensionsServiceTest NotificationService::AllSources()); } + ~ExtensionsServiceTest() { + // Drop our reference to ExtensionsService now, so that it can be destroyed + // while ChromeThreads and MessageLoop are still around (they are used + // in the ExtensionsService destruction process). + service_ = NULL; + } + virtual void InitializeExtensionsService(const FilePath& pref_file, const FilePath& extensions_install_dir) { prefs_.reset(new PrefService(pref_file)); diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc index e36a05f..35cf1d8 100644 --- a/chrome/browser/extensions/user_script_listener_unittest.cc +++ b/chrome/browser/extensions/user_script_listener_unittest.cc @@ -207,6 +207,10 @@ class ExtensionTestingProfile : public TestingProfile { service_->Init(); } + void ShutdownExtensionsService() { + service_ = NULL; + } + virtual ExtensionsService* GetExtensionsService() { return service_.get(); } @@ -239,6 +243,10 @@ class UserScriptListenerTest : public testing::Test { } virtual void TearDown() { + // Shutdown ExtensionsService now, so that it can be destroyed while + // ChromeThreads and MessageLoop are still around (they are used in the + // ExtensionsService destruction process). + profile_.ShutdownExtensionsService(); io_thread_.reset(); file_thread_.reset(); ui_thread_.reset(); |