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

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

Issue 425853007: Revert of mac: Toolbar renders incorrectly when downloads bar is open. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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_private.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 44b1fa95654ae7136c5ebda1095798a8c2c51fdc..0af185155d892fd26827375f066e4c1a507eb179 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm
@@ -20,7 +20,6 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
-#import "chrome/browser/ui/cocoa/fast_resize_view.h"
#include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h"
#import "chrome/browser/ui/cocoa/nsview_additions.h"
#include "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
@@ -243,61 +242,19 @@
namespace {
-// Returns the frame of the view in window coordinates.
-NSRect FrameInWindowForView(NSView* view) {
- return [[view superview] convertRect:[view frame] toView:nil];
-}
-
-// Whether the view's frame is within the bounds of the superview.
-BOOL ViewContainmentValid(NSView* view) {
- if (NSIsEmptyRect([view frame]))
- return true;
-
- return NSContainsRect([[view superview] bounds], [view frame]);
-}
-
-// Checks the view hierarchy rooted at |view| to ensure that each view is
-// properly contained.
-BOOL ViewHierarchyContainmentValid(NSView* view) {
- // TODO(erikchen): Fix these views to have correct containment.
- // http://crbug.com/397665.
- if ([view isKindOfClass:NSClassFromString(@"DownloadShelfView")])
- return YES;
- if ([view isKindOfClass:NSClassFromString(@"BookmarkBarToolbarView")])
- return YES;
- if ([view isKindOfClass:NSClassFromString(@"BrowserActionsContainerView")])
- return YES;
-
- if (!ViewContainmentValid(view)) {
- LOG(ERROR) << "View violates containment: " <<
- [[view description] UTF8String];
- return false;
- }
-
- for (NSView* subview in [view subviews]) {
- BOOL result = ViewHierarchyContainmentValid(subview);
- if (!result)
- return false;
- }
-
- return true;
-}
-
// Verifies that the toolbar, infobar, tab content area, and download shelf
// completely fill the area under the tabstrip.
void CheckViewPositions(BrowserWindowController* controller) {
- EXPECT_TRUE(ViewHierarchyContainmentValid([[controller window] contentView]));
-
- NSRect contentView = FrameInWindowForView([[controller window] contentView]);
- NSRect tabstrip = FrameInWindowForView([controller tabStripView]);
- NSRect toolbar = FrameInWindowForView([controller toolbarView]);
- NSRect infobar = FrameInWindowForView([controller infoBarContainerView]);
- NSRect tabContent = FrameInWindowForView([controller tabContentArea]);
- NSRect download = FrameInWindowForView([[controller downloadShelf] view]);
+ NSRect contentView = [[[controller window] contentView] bounds];
+ NSRect tabstrip = [[controller tabStripView] frame];
+ NSRect toolbar = [[controller toolbarView] frame];
+ NSRect infobar = [[controller infoBarContainerView] frame];
+ NSRect contentArea = [[controller tabContentArea] frame];
+ NSRect download = [[[controller downloadShelf] view] frame];
EXPECT_EQ(NSMinY(contentView), NSMinY(download));
- EXPECT_EQ(NSMaxY(download), NSMinY(tabContent));
- EXPECT_EQ(NSMaxY(tabContent), NSMinY(infobar));
+ EXPECT_EQ(NSMaxY(download), NSMinY(contentArea));
+ EXPECT_EQ(NSMaxY(contentArea), NSMinY(infobar));
// Bookmark bar frame is random memory when hidden.
if ([controller bookmarkBarVisible]) {
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_private.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698