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

Unified Diff: chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm

Issue 6926001: Replace the virtual InfoBarDelegate::InfoBarClosed() function with a non-virtual one. This is a ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 | « chrome/browser/ui/browser_init.cc ('k') | chrome/browser/ui/cocoa/infobars/infobar_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm
===================================================================
--- chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm (revision 84141)
+++ chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm (working copy)
@@ -53,26 +53,31 @@
// Add three infobars and then remove them.
// After each step check to make sure we have the correct number of
// infobar subviews.
- MockLinkInfoBarDelegate linkDelegate, linkDelegate2;
- MockConfirmInfoBarDelegate confirmDelegate;
- [controller_ addInfoBar:&linkDelegate animate:NO];
+ // These delegates delete themselves when they're told their infobars have
+ // closed.
+ MockLinkInfoBarDelegate* linkDelegate = new MockLinkInfoBarDelegate(NULL);
+ MockLinkInfoBarDelegate* linkDelegate2 = new MockLinkInfoBarDelegate(NULL);
+ MockConfirmInfoBarDelegate* confirmDelegate =
+ new MockConfirmInfoBarDelegate(NULL);
+
+ [controller_ addInfoBar:linkDelegate animate:NO];
EXPECT_EQ(1U, [[view subviews] count]);
- [controller_ addInfoBar:&confirmDelegate animate:NO];
+ [controller_ addInfoBar:confirmDelegate animate:NO];
EXPECT_EQ(2U, [[view subviews] count]);
- [controller_ addInfoBar:&linkDelegate2 animate:NO];
+ [controller_ addInfoBar:linkDelegate2 animate:NO];
EXPECT_EQ(3U, [[view subviews] count]);
// Just to mix things up, remove them in a different order.
- [controller_ closeInfoBarsForDelegate:&confirmDelegate animate:NO];
+ [controller_ closeInfoBarsForDelegate:confirmDelegate animate:NO];
EXPECT_EQ(2U, [[view subviews] count]);
- [controller_ closeInfoBarsForDelegate:&linkDelegate animate:NO];
+ [controller_ closeInfoBarsForDelegate:linkDelegate animate:NO];
EXPECT_EQ(1U, [[view subviews] count]);
- [controller_ closeInfoBarsForDelegate:&linkDelegate2 animate:NO];
+ [controller_ closeInfoBarsForDelegate:linkDelegate2 animate:NO];
EXPECT_EQ(0U, [[view subviews] count]);
}
@@ -80,12 +85,18 @@
NSView* view = [controller_ view];
// Add three infobars and then remove them all.
- MockLinkInfoBarDelegate linkDelegate;
- MockConfirmInfoBarDelegate confirmDelegate, confirmDelegate2;
- [controller_ addInfoBar:&linkDelegate animate:NO];
- [controller_ addInfoBar:&confirmDelegate animate:NO];
- [controller_ addInfoBar:&confirmDelegate2 animate:NO];
+ // These delegates delete themselves when they're told their infobars have
+ // closed.
+ MockLinkInfoBarDelegate* linkDelegate = new MockLinkInfoBarDelegate(NULL);
+ MockConfirmInfoBarDelegate* confirmDelegate =
+ new MockConfirmInfoBarDelegate(NULL);
+ MockConfirmInfoBarDelegate* confirmDelegate2 =
+ new MockConfirmInfoBarDelegate(NULL);
+
+ [controller_ addInfoBar:linkDelegate animate:NO];
+ [controller_ addInfoBar:confirmDelegate animate:NO];
+ [controller_ addInfoBar:confirmDelegate2 animate:NO];
EXPECT_EQ(3U, [[view subviews] count]);
[controller_ removeAllInfoBars];
« no previous file with comments | « chrome/browser/ui/browser_init.cc ('k') | chrome/browser/ui/cocoa/infobars/infobar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698