Fix memory leak in WebsiteSettingsTest.ShowInfoBar.


BUG=140041

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149635 0039d316-1c4b-4281-b951-d872f2087c98
parent 38799850
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/infobars/infobar_delegate.h"
#include "chrome/browser/infobars/infobar_tab_helper.h" #include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/ui/website_settings/website_settings_ui.h" #include "chrome/browser/ui/website_settings/website_settings_ui.h"
#include "chrome/common/content_settings.h" #include "chrome/common/content_settings.h"
...@@ -341,6 +342,14 @@ TEST_F(WebsiteSettingsTest, ShowInfoBar) { ...@@ -341,6 +342,14 @@ TEST_F(WebsiteSettingsTest, ShowInfoBar) {
website_settings()->OnUIClosing(); website_settings()->OnUIClosing();
EXPECT_EQ(1u, infobar_tab_helper()->infobar_count()); EXPECT_EQ(1u, infobar_tab_helper()->infobar_count());
infobar_tab_helper()->RemoveInfoBar( // Removing an |InfoBarDelegate| from the |InfoBarTabHelper| does not delete
// it. Hence the |delegate| must be cleaned up after it was removed from the
// |infobar_tab_helper|.
scoped_ptr<InfoBarDelegate> delegate(
infobar_tab_helper()->GetInfoBarDelegateAt(0)); infobar_tab_helper()->GetInfoBarDelegateAt(0));
infobar_tab_helper()->RemoveInfoBar(delegate.get());
// Right now InfoBarDelegates delete themselves via
// InfoBarClosed(); once InfoBars own their delegates, this can become a
// simple reset() call
delegate.release()->InfoBarClosed();
} }
...@@ -1487,9 +1487,3 @@ ...@@ -1487,9 +1487,3 @@
... ...
fun:base::PlatformThread::SetName fun:base::PlatformThread::SetName
} }
{
bug_140041
Heapcheck:Leak
fun:WebsiteSettings::OnUIClosing
fun:WebsiteSettingsTest_ShowInfoBar_Test::TestBody
}
...@@ -5840,13 +5840,6 @@ ...@@ -5840,13 +5840,6 @@
fun:_ZN3gpu12GpuScheduler10PutChangedEv fun:_ZN3gpu12GpuScheduler10PutChangedEv
fun:_ZN6webkit3gpu18GLInProcessContext12PumpCommandsEv fun:_ZN6webkit3gpu18GLInProcessContext12PumpCommandsEv
} }
{
bug_140041
Memcheck:Leak
fun:_Znw*
fun:_ZN15WebsiteSettings11OnUIClosingEv
fun:_ZN36WebsiteSettingsTest_ShowInfoBar_Test8TestBodyEv
}
{ {
bug_140196 bug_140196
Memcheck:Uninitialized Memcheck:Uninitialized
......
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