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

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: Put a stray word away. 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..64404c0f008fe295a3ecc2d1552ad63444629f5e 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm
@@ -151,19 +151,47 @@ TEST_F(BrowserWindowControllerTest, TestSetBounds) {
ASSERT_TRUE([controller isTabbedWindow]);
BrowserWindow* browser_window = [controller browserWindow];
EXPECT_EQ(browser_window, browser->window());
- gfx::Rect bounds = browser_window->GetBounds();
- EXPECT_EQ(400, bounds.width());
- EXPECT_EQ(272, bounds.height());
+ EXPECT_EQ(browser_window->GetBounds().size(), kMinCocoaTabbedWindowSize);
// Try to set the bounds smaller than the minimum.
browser_window->SetBounds(gfx::Rect(0, 0, 50, 50));
- bounds = browser_window->GetBounds();
- EXPECT_EQ(400, bounds.width());
- EXPECT_EQ(272, bounds.height());
+ EXPECT_EQ(browser_window->GetBounds().size(), kMinCocoaTabbedWindowSize);
[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, TestSetBoundsWithDownloadShelf) {
+ BrowserWindow* browser_window = [controller_ browserWindow];
+ browser_window->SetBounds(gfx::Rect(0, 0, 1000, 50));
+
+ // Auto Layout only acts on the window if it's visible.
+ browser_window->ShowInactive();
+
+ // The browser window should lazily create the download shelf when requested.
+ EXPECT_NE(nullptr, browser_window->GetDownloadShelf());
+
+ // The controller should now have a download shelf, which should have a view.
+ EXPECT_NE(nil, [[controller_ downloadShelf] view]);
+
+ // But, just requesting the download shelf shouldn't make it visible.
+ EXPECT_FALSE([controller_ isDownloadShelfVisible]);
+
+ browser_window->SetBounds(gfx::Rect(0, 0, 50, 50));
+
+ // When linking against an SDK >= 10.11, AppKit may lay out the window
+ // asynchronously (CFExecutableLinkedOnOrAfter check in -[NSThemeFrame
+ // handleSetFrameCommonRedisplay]). Do layout now instead.
+ [[controller_ window] layoutIfNeeded];
+
+ // The window should have returned to its minimum size.
+ EXPECT_EQ(browser_window->GetBounds().size(), kMinCocoaTabbedWindowSize);
+
+ browser_window->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