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

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

Issue 555243002: mac: Refactor browser_window_controller layout logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fullscreen_layout
Patch Set: Comments from rsesek. Created 6 years, 3 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
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 5840eed7234fdca29e851e7da94a8b43af466be1..bdc6a3fd4ea59b26eeddc7ab545a97724c5b4646 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm
@@ -249,7 +249,9 @@ void CheckViewPositions(BrowserWindowController* controller) {
NSRect toolbar = [[controller toolbarView] frame];
NSRect infobar = [[controller infoBarContainerView] frame];
NSRect contentArea = [[controller tabContentArea] frame];
- NSRect download = [[[controller downloadShelf] view] frame];
+ NSRect download = NSZeroRect;
+ if ([[[controller downloadShelf] view] superview])
+ download = [[[controller downloadShelf] view] frame];
EXPECT_EQ(NSMinY(contentView), NSMinY(download));
EXPECT_EQ(NSMaxY(download), NSMinY(contentArea));
@@ -414,8 +416,8 @@ TEST_F(BrowserWindowControllerTest, TestResizeViews) {
tabstripFrame.origin.y = NSMaxY([contentView frame]);
[tabstrip setFrame:tabstripFrame];
- // The download shelf is created lazily. Force-create it and set its initial
- // height to 0.
+ // Make the download shelf and set its initial height to 0.
+ [controller_ createAndAddDownloadShelf];
NSView* download = [[controller_ downloadShelf] view];
NSRect downloadFrame = [download frame];
downloadFrame.size.height = 0;
@@ -465,6 +467,7 @@ TEST_F(BrowserWindowControllerTest, TestResizeViewsWithBookmarkBar) {
// The download shelf is created lazily. Force-create it and set its initial
// height to 0.
+ [controller_ createAndAddDownloadShelf];
NSView* download = [[controller_ downloadShelf] view];
NSRect downloadFrame = [download frame];
downloadFrame.size.height = 0;
@@ -492,6 +495,8 @@ TEST_F(BrowserWindowControllerTest, TestResizeViewsWithBookmarkBar) {
// Remove the bookmark bar and recheck
profile()->GetPrefs()->SetBoolean(bookmarks::prefs::kShowBookmarkBar, false);
+ [controller_ browserWindow]->BookmarkBarStateChanged(
+ BookmarkBar::DONT_ANIMATE_STATE_CHANGE);
[controller_ resizeView:bookmark newHeight:0];
CheckViewPositions(controller_);
@@ -517,13 +522,13 @@ TEST_F(BrowserWindowControllerTest, BookmarkBarIsSameWidth) {
TEST_F(BrowserWindowControllerTest, TestTopRightForBubble) {
// The bookmark bubble must be attached to a lit and visible star.
[controller_ setStarredState:YES];
- NSPoint p = [controller_ bookmarkBubblePoint];
- NSRect all = [[controller_ window] frame];
+ NSPoint p = [controller_ bookmarkBubblePoint]; // Window coordinates.
+ NSRect all = [[controller_ window] frame]; // Screen coordinates.
// As a sanity check make sure the point is vaguely in the top right
// of the window.
- EXPECT_GT(p.y, all.origin.y + (all.size.height/2));
- EXPECT_GT(p.x, all.origin.x + (all.size.width/2));
+ EXPECT_GT(p.y, all.size.height / 2);
+ EXPECT_GT(p.x, all.size.width / 2);
}
// By the "zoom frame", we mean what Apple calls the "standard frame".

Powered by Google App Engine
This is Rietveld 408576698