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

Unified Diff: chrome/browser/cocoa/notifications/balloon_controller_unittest.mm

Issue 2825073: Fix memory leaks in the balloon controller unit test by loading the NIB in th... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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/cocoa/notifications/balloon_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/notifications/balloon_controller_unittest.mm
===================================================================
--- chrome/browser/cocoa/notifications/balloon_controller_unittest.mm (revision 53978)
+++ chrome/browser/cocoa/notifications/balloon_controller_unittest.mm (working copy)
@@ -13,6 +13,16 @@
#include "chrome/test/testing_profile.h"
#import "third_party/ocmock/OCMock/OCMock.h"
+// Subclass balloon controller and mock out the initialization of the RVH.
+@interface TestBalloonController : BalloonController {
+}
+- (void)initializeHost;
+@end
+
+@implementation TestBalloonController
+- (void)initializeHost {}
+@end
+
namespace {
// Use a dummy balloon collection for testing.
@@ -67,18 +77,14 @@
new NotificationObjectProxy(-1, -1, -1, false));
scoped_ptr<Balloon> balloon(
new Balloon(n, profile_.get(), collection_.get()));
+ balloon->SetPosition(gfx::Point(1, 1), false);
+ balloon->set_content_size(gfx::Size(100, 100));
- BalloonController* controller = [BalloonController alloc];
+ BalloonController* controller =
+ [[TestBalloonController alloc] initWithBalloon:balloon.get()];
- id mock = [OCMockObject partialMockForObject:controller];
- [[mock expect] initializeHost];
-
- [controller initWithBalloon:balloon.get()];
[controller showWindow:nil];
[controller closeBalloon:YES];
-
- [mock verify];
- [controller release];
}
TEST_F(BalloonControllerTest, SizesTest) {
@@ -87,19 +93,19 @@
new NotificationObjectProxy(-1, -1, -1, false));
scoped_ptr<Balloon> balloon(
new Balloon(n, profile_.get(), collection_.get()));
+ balloon->SetPosition(gfx::Point(1, 1), false);
balloon->set_content_size(gfx::Size(100, 100));
- BalloonController* controller = [BalloonController alloc];
+ BalloonController* controller =
+ [[TestBalloonController alloc] initWithBalloon:balloon.get()];
- id mock = [OCMockObject partialMockForObject:controller];
- [[mock expect] initializeHost];
-
[controller initWithBalloon:balloon.get()];
+ [controller showWindow:nil];
EXPECT_TRUE([controller desiredTotalWidth] > 100);
EXPECT_TRUE([controller desiredTotalHeight] > 100);
- [mock verify];
- [controller release];
+
+ [controller closeBalloon:YES];
}
}
« no previous file with comments | « chrome/browser/cocoa/notifications/balloon_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698