Chromium Code Reviews| Index: chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm |
| =================================================================== |
| --- chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm (revision 83922) |
| +++ chrome/browser/ui/cocoa/infobars/infobar_container_controller_unittest.mm (working copy) |
| @@ -53,26 +53,30 @@ |
| // 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 infobars own themselves. |
|
Nico
2011/05/04 21:15:52
This would be more informative if it was "These in
Peter Kasting
2011/05/04 22:54:56
Changed to "These delegates delete themselves when
|
| + 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 +84,17 @@ |
| 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 infobars own themselves. |
| + 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]; |