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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_unittest.mm

Issue 2738623002: [Mac] Turn on Auto Layout for browser windows. (Closed)
Patch Set: Trigger Auto Layout from chromeContentView, which covers all browser windows. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #import "base/mac/scoped_nsobject.h" 10 #import "base/mac/scoped_nsobject.h"
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 object:controller_.window]; 740 object:controller_.window];
741 [partial_mock verify]; 741 [partial_mock verify];
742 742
743 [[partial_mock expect] setNeedsDisplay:YES]; 743 [[partial_mock expect] setNeedsDisplay:YES];
744 [[NSNotificationCenter defaultCenter] 744 [[NSNotificationCenter defaultCenter]
745 postNotificationName:NSWindowDidResignMainNotification 745 postNotificationName:NSWindowDidResignMainNotification
746 object:controller_.window]; 746 object:controller_.window];
747 [partial_mock verify]; 747 [partial_mock verify];
748 } 748 }
749 749
750 // Test that the window uses Auto Layout. Since frame-based layout and Auto
751 // Layout behave differently in subtle ways, we shouldn't start/stop using it
752 // accidentally. If we don't want Auto Layout, this test should be changed to
753 // expect that chromeContentView has no constraints.
754 TEST_F(BrowserWindowControllerTest, UsesAutoLayout) {
755 // If Auto Layout is on, there will at least be synthesized constraints based
tapted 2017/03/22 22:40:00 nit: remove `at least`? (or "..there will be at l
Sidney San Martín 2017/03/22 23:29:59 Done.
756 // on the view's frame and autoresizing mask.
757 EXPECT_NE(0u, [[[controller_ chromeContentView] constraints] count]);
758 }
759
750 @interface BrowserWindowControllerFakeFullscreen : BrowserWindowController { 760 @interface BrowserWindowControllerFakeFullscreen : BrowserWindowController {
751 @private 761 @private
752 // We release the window ourselves, so we don't have to rely on the unittest 762 // We release the window ourselves, so we don't have to rely on the unittest
753 // doing it for us. 763 // doing it for us.
754 base::scoped_nsobject<NSWindow> testFullscreenWindow_; 764 base::scoped_nsobject<NSWindow> testFullscreenWindow_;
755 } 765 }
756 @end 766 @end
757 767
758 class BrowserWindowFullScreenControllerTest : public CocoaProfileTest { 768 class BrowserWindowFullScreenControllerTest : public CocoaProfileTest {
759 public: 769 public:
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) 854 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400)
845 styleMask:NSBorderlessWindowMask 855 styleMask:NSBorderlessWindowMask
846 backing:NSBackingStoreBuffered 856 backing:NSBackingStoreBuffered
847 defer:NO]); 857 defer:NO]);
848 [[testFullscreenWindow_ contentView] setWantsLayer:YES]; 858 [[testFullscreenWindow_ contentView] setWantsLayer:YES];
849 return testFullscreenWindow_.get(); 859 return testFullscreenWindow_.get();
850 } 860 }
851 @end 861 @end
852 862
853 /* TODO(???): test other methods of BrowserWindowController */ 863 /* TODO(???): test other methods of BrowserWindowController */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698