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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller_unittest.mm

Issue 2742813003: [Mac] Lay out the browser window when adding the download shelf. (Closed)
Patch Set: Created 3 years, 9 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/cocoa/browser_window_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/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 b99bc4776b91e7cd8aa3e1728c937b3a302c5118..c54041603318e6cbf1b7c85f0f20ecd86ae7cf9e 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm
@@ -164,6 +164,29 @@ TEST_F(BrowserWindowControllerTest, TestSetBounds) {
[controller close];
}
+// https://crbug.com/667698 - When Auto Layout is in use, adding the download
+// shelf without ever showing it shouldn't prevent the window from being
+// resized to its minimum width.
+TEST_F(BrowserWindowControllerTest, TestSetBoundsWithDownloadsShelf) {
+ Browser::CreateParams params(Browser::TYPE_TABBED, profile(), true);
+ params.initial_bounds = gfx::Rect(0, 0, 1000, 50);
+ Browser* browser = new Browser(params);
+ BrowserWindow* browser_window = browser->window();
+ browser_window->ShowInactive();
+ NSWindow* cocoaWindow = browser_window->GetNativeWindow();
tapted 2017/03/10 07:22:28 nit: cocoa_window (I realise other TEST_F use coc
Sidney San Martín 2017/03/10 22:23:41 See below.
+ BrowserWindowController* controller =
+ static_cast<BrowserWindowController*>([cocoaWindow windowController]);
+
+ [controller createAndAddDownloadShelf];
tapted 2017/03/10 07:22:28 or perhaps a better alternative, you could just E
Sidney San Martín 2017/03/10 22:23:42 That's much nicer, thanks!
+
+ browser_window->SetBounds(gfx::Rect(0, 0, 50, 50));
tapted 2017/03/10 07:22:28 Is this subject to autolayout constraints? If it
Sidney San Martín 2017/03/10 22:23:42 [NSWindow setFrame:] marks the window as needing l
+ gfx::Rect bounds = browser_window->GetBounds();
+ EXPECT_EQ(400, bounds.width());
+ EXPECT_EQ(272, bounds.height());
tapted 2017/03/10 07:22:28 400 / 272 are magic numbers. At the very least the
Sidney San Martín 2017/03/10 22:23:41 I was following the surrounding tests here, but th
+
+ [controller close];
+}
+
TEST_F(BrowserWindowControllerTest, TestSetBoundsPopup) {
// Create a popup with bounds smaller than the minimum.
Browser::CreateParams params(Browser::TYPE_POPUP, profile(), true);
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698