summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/infobar_container_controller_unittest.mm
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-05 19:55:29 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-05 19:55:29 +0000
commit6dcefa2aded298fa4015a5da4f54e56c65061ab0 (patch)
tree716fc188a1c25beac2bf039ad32749a7788fc722 /chrome/browser/cocoa/infobar_container_controller_unittest.mm
parentefc3315b53e2c3cc6d6aecfa04738447b701f806 (diff)
downloadchromium_src-6dcefa2aded298fa4015a5da4f54e56c65061ab0.zip
chromium_src-6dcefa2aded298fa4015a5da4f54e56c65061ab0.tar.gz
chromium_src-6dcefa2aded298fa4015a5da4f54e56c65061ab0.tar.bz2
Rewrites the Mac view resizing logic to have the BrowserWindowController
directly resize and relayout its children views. Now when a view needs to be resized, it asks its resize delegate (typically its controller's parent) to perform the resize. BUG=http://crbug.com/17619 TEST=Make sure that views are laid out correctly, even when they change size. Open and close the bookmark bar. Trigger an infobar and then close it. Trigger the download shelf and then close it. Trigger a download shelf with the infobar open, or with the bookmark bar open. Switch to and from fullscreen with various bars open. Resize the browser window with various bars open. Start the browser with and without the bookmark bar open. Try all of the above in a popup window. Review URL: http://codereview.chromium.org/159776 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22517 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/infobar_container_controller_unittest.mm')
-rw-r--r--chrome/browser/cocoa/infobar_container_controller_unittest.mm37
1 files changed, 8 insertions, 29 deletions
diff --git a/chrome/browser/cocoa/infobar_container_controller_unittest.mm b/chrome/browser/cocoa/infobar_container_controller_unittest.mm
index 77e8e82..b50e7d4 100644
--- a/chrome/browser/cocoa/infobar_container_controller_unittest.mm
+++ b/chrome/browser/cocoa/infobar_container_controller_unittest.mm
@@ -7,44 +7,21 @@
#include "base/scoped_nsautorelease_pool.h"
#include "base/scoped_nsobject.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
-#import "chrome/browser/cocoa/browser_window_controller.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
#import "chrome/browser/cocoa/infobar_container_controller.h"
#include "chrome/browser/cocoa/infobar_test_helper.h"
+#import "chrome/browser/cocoa/view_resizer_pong.h"
#include "testing/gtest/include/gtest/gtest.h"
-// Objective-C classes must be defined outside the namespace.
-@interface BrowserWindowControllerPong : BrowserWindowController {
- BOOL pong_;
-}
-@property(readonly) BOOL pong;
-@end
-
-@implementation BrowserWindowControllerPong
-@synthesize pong = pong_;
-
-- (id)initWithBrowser:(Browser*)browser {
- if ((self = [super initWithBrowser:browser takeOwnership:NO])) {
- pong_ = NO;
- }
- return self;
-}
-
-- (void)infoBarResized:(float)newHeight {
- pong_ = TRUE;
-}
-@end
-
namespace {
class InfoBarContainerControllerTest : public testing::Test {
virtual void SetUp() {
- browserController_.reset([[BrowserWindowControllerPong alloc]
- initWithBrowser:browser_helper_.browser()]);
+ resizeDelegate_.reset([[ViewResizerPong alloc] init]);
TabStripModel* model = browser_helper_.browser()->tabstrip_model();
controller_.reset([[InfoBarContainerController alloc]
initWithTabStripModel:model
- browserWindowController:browserController_]);
+ resizeDelegate:resizeDelegate_.get()]);
}
public:
@@ -54,7 +31,7 @@ class InfoBarContainerControllerTest : public testing::Test {
CocoaTestHelper cocoa_helper_;
BrowserTestHelper browser_helper_;
base::ScopedNSAutoreleasePool pool_;
- scoped_nsobject<BrowserWindowControllerPong> browserController_;
+ scoped_nsobject<ViewResizerPong> resizeDelegate_;
scoped_nsobject<InfoBarContainerController> controller_;
};
@@ -67,9 +44,11 @@ TEST_F(InfoBarContainerControllerTest, Show) {
}
TEST_F(InfoBarContainerControllerTest, BWCPong) {
- // Call positionInfoBarsAndResize and check that the BWC got a resize message.
+ // Call positionInfoBarsAndResize and check that |resizeDelegate_| got a
+ // resize message.
+ [resizeDelegate_ setHeight:-1];
[controller_ positionInfoBarsAndRedraw];
- EXPECT_TRUE([browserController_ pong]);
+ EXPECT_NE(-1, [resizeDelegate_ height]);
}
TEST_F(InfoBarContainerControllerTest, AddAndRemoveInfoBars) {