Index: chrome/browser/ui/cocoa/browser_window_controller_unittest.mm |
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm |
index c3cec875a3b679971655c320b34d1d1d3389391f..b388b41647a7f5a24d2c40d159e0569aa90cf703 100644 |
--- a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm |
+++ b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm |
@@ -132,6 +132,56 @@ TEST_F(BrowserWindowControllerTest, TestNormal) { |
[controller close]; |
} |
+TEST_F(BrowserWindowControllerTest, TestSetBounds) { |
+ // Create a normal browser with bounds smaller than the minimum. |
+ Browser::CreateParams params(Browser::TYPE_TABBED, browser_helper_.profile()); |
+ params.initial_bounds = gfx::Rect(0, 0, 50, 50); |
+ Browser* browser = Browser::CreateWithParams(params); |
+ NSWindow *cocoaWindow = browser->window()->GetNativeHandle(); |
+ BrowserWindowController* controller = |
+ static_cast<BrowserWindowController*>([cocoaWindow windowController]); |
+ |
+ ASSERT_TRUE([controller isTabbedWindow]); |
+ BrowserWindow* browserWindow = [controller browserWindow]; |
+ EXPECT_EQ(browserWindow, browser->window()); |
+ gfx::Rect bounds = browserWindow->GetBounds(); |
+ EXPECT_EQ(400, bounds.width()); |
+ EXPECT_EQ(272, bounds.height()); |
+ |
+ // Try to set the bounds smaller than the minimum. |
+ browserWindow->SetBounds(gfx::Rect(0, 0, 50, 50)); |
+ bounds = browserWindow->GetBounds(); |
+ EXPECT_EQ(400, bounds.width()); |
+ EXPECT_EQ(272, bounds.height()); |
+ |
+ [controller close]; |
+} |
+ |
+TEST_F(BrowserWindowControllerTest, TestSetBoundsPopup) { |
+ // Create a popup with bounds smaller than the minimum. |
+ Browser::CreateParams params(Browser::TYPE_POPUP, browser_helper_.profile()); |
+ params.initial_bounds = gfx::Rect(0, 0, 50, 50); |
+ Browser* browser = Browser::CreateWithParams(params); |
+ NSWindow *cocoaWindow = browser->window()->GetNativeHandle(); |
+ BrowserWindowController* controller = |
+ static_cast<BrowserWindowController*>([cocoaWindow windowController]); |
+ |
+ ASSERT_FALSE([controller isTabbedWindow]); |
+ BrowserWindow* browserWindow = [controller browserWindow]; |
+ EXPECT_EQ(browserWindow, browser->window()); |
+ gfx::Rect bounds = browserWindow->GetBounds(); |
+ EXPECT_EQ(100, bounds.width()); |
+ EXPECT_EQ(122, bounds.height()); |
+ |
+ // Try to set the bounds smaller than the minimum. |
+ browserWindow->SetBounds(gfx::Rect(0, 0, 50, 50)); |
+ bounds = browserWindow->GetBounds(); |
+ EXPECT_EQ(100, bounds.width()); |
+ EXPECT_EQ(122, bounds.height()); |
+ |
+ [controller close]; |
+} |
+ |
TEST_F(BrowserWindowControllerTest, TestTheme) { |
[controller_ userChangedTheme]; |
} |