Commit d6d0f2bb authored by rnk@chromium.org's avatar rnk@chromium.org

Fix leak in ComponentUpdaterTest.ProdVersionCheck.

R=cpu@chromium.org,timurrrr@chromium.org
BUG=96295
TEST=Ran ComponentUpdaterTest.* under drmemory, RegisterComponent leak gone

Review URL: https://chromiumcodereview.appspot.com/9332004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120778 0039d316-1c4b-4281-b951-d872f2087c98
parent 8f80db0f
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/file_path.h" #include "base/file_path.h"
#include "base/file_util.h" #include "base/file_util.h"
#include "base/memory/scoped_vector.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/values.h" #include "base/values.h"
...@@ -164,6 +165,10 @@ class ComponentUpdaterTest : public testing::Test { ...@@ -164,6 +165,10 @@ class ComponentUpdaterTest : public testing::Test {
content::URLFetcher::SetEnableInterceptionForTests(false); content::URLFetcher::SetEnableInterceptionForTests(false);
} }
void TearDown() {
xmlCleanupGlobals();
}
ComponentUpdateService* component_updater() { ComponentUpdateService* component_updater() {
return component_updater_.get(); return component_updater_.get();
} }
...@@ -193,6 +198,7 @@ class ComponentUpdaterTest : public testing::Test { ...@@ -193,6 +198,7 @@ class ComponentUpdaterTest : public testing::Test {
} }
com->version = version; com->version = version;
com->installer = new TestInstaller; com->installer = new TestInstaller;
test_installers_.push_back(com->installer);
component_updater_->RegisterComponent(*com); component_updater_->RegisterComponent(*com);
} }
...@@ -201,6 +207,8 @@ class ComponentUpdaterTest : public testing::Test { ...@@ -201,6 +207,8 @@ class ComponentUpdaterTest : public testing::Test {
FilePath test_data_dir_; FilePath test_data_dir_;
TestNotificationTracker notification_tracker_; TestNotificationTracker notification_tracker_;
TestConfigurator* test_config_; TestConfigurator* test_config_;
// ComponentInstaller objects to delete after each test.
ScopedVector<ComponentInstaller> test_installers_;
}; };
// Verify that our test fixture work and the component updater can // Verify that our test fixture work and the component updater can
...@@ -298,9 +306,6 @@ TEST_F(ComponentUpdaterTest, CheckCrxSleep) { ...@@ -298,9 +306,6 @@ TEST_F(ComponentUpdaterTest, CheckCrxSleep) {
EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count()); EXPECT_EQ(0, static_cast<TestInstaller*>(com.installer)->install_count());
component_updater()->Stop(); component_updater()->Stop();
delete com.installer;
xmlCleanupGlobals();
} }
// Verify that we can check for updates and install one component. Besides // Verify that we can check for updates and install one component. Besides
...@@ -369,9 +374,6 @@ TEST_F(ComponentUpdaterTest, InstallCrx) { ...@@ -369,9 +374,6 @@ TEST_F(ComponentUpdaterTest, InstallCrx) {
EXPECT_EQ(chrome::NOTIFICATION_COMPONENT_UPDATER_SLEEPING, ev3.type); EXPECT_EQ(chrome::NOTIFICATION_COMPONENT_UPDATER_SLEEPING, ev3.type);
component_updater()->Stop(); component_updater()->Stop();
delete com1.installer;
delete com2.installer;
xmlCleanupGlobals();
} }
// This test checks that the "prodversionmin" value is handled correctly. In // This test checks that the "prodversionmin" value is handled correctly. In
......
...@@ -1582,12 +1582,6 @@ ...@@ -1582,12 +1582,6 @@
... ...
fun:net::CookieMonster::CookieMonsterTask::InvokeCallback fun:net::CookieMonster::CookieMonsterTask::InvokeCallback
} }
{
bug_96295
Heapcheck:Leak
fun:ComponentUpdaterTest::RegisterComponent
fun:ComponentUpdaterTest_ProdVersionCheck_Test::TestBody
}
{ {
bug_96904 bug_96904
Heapcheck:Leak Heapcheck:Leak
......
...@@ -4124,13 +4124,6 @@ ...@@ -4124,13 +4124,6 @@
fun:_ZN3net21HttpStreamFactoryImpl7Request18OnSpdySessionReadyEPNS0_3JobE13scoped_refptrINS_11SpdySessionEEb fun:_ZN3net21HttpStreamFactoryImpl7Request18OnSpdySessionReadyEPNS0_3JobE13scoped_refptrINS_11SpdySessionEEb
fun:_ZN3net21HttpStreamFactoryImpl3Job26OnSpdySessionReadyCallbackEv fun:_ZN3net21HttpStreamFactoryImpl3Job26OnSpdySessionReadyCallbackEv
} }
{
bug_96295
Memcheck:Leak
fun:_Znw*
fun:_ZN20ComponentUpdaterTest17RegisterComponentEP12CrxComponentNS_14TestComponentsERK7Version
fun:_ZN42ComponentUpdaterTest_ProdVersionCheck_Test8TestBodyEv
}
{ {
bug_96365 bug_96365
Memcheck:Leak Memcheck:Leak
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment