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

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

Issue 1052123006: Prevent bookmarks bar toggling from decreasing window height to 0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits. Created 5 years, 8 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
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 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 "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #import "base/mac/scoped_nsobject.h" 8 #import "base/mac/scoped_nsobject.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "chrome/app/chrome_command_ids.h" 11 #include "chrome/app/chrome_command_ids.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 EXPECT_TRUE([controller_ isTabbedWindow]); 117 EXPECT_TRUE([controller_ isTabbedWindow]);
118 EXPECT_TRUE([controller_ hasTabStrip]); 118 EXPECT_TRUE([controller_ hasTabStrip]);
119 EXPECT_FALSE([controller_ hasTitleBar]); 119 EXPECT_FALSE([controller_ hasTitleBar]);
120 EXPECT_TRUE([controller_ isBookmarkBarVisible]); 120 EXPECT_TRUE([controller_ isBookmarkBarVisible]);
121 121
122 // And make sure a controller for a pop-up window is not normal. 122 // And make sure a controller for a pop-up window is not normal.
123 // popup_browser will be owned by its window. 123 // popup_browser will be owned by its window.
124 Browser* popup_browser(new Browser( 124 Browser* popup_browser(new Browser(
125 Browser::CreateParams(Browser::TYPE_POPUP, profile(), 125 Browser::CreateParams(Browser::TYPE_POPUP, profile(),
126 chrome::GetActiveDesktop()))); 126 chrome::GetActiveDesktop())));
127 NSWindow *cocoaWindow = popup_browser->window()->GetNativeWindow(); 127 NSWindow* cocoaWindow = popup_browser->window()->GetNativeWindow();
128 BrowserWindowController* controller = 128 BrowserWindowController* controller =
129 static_cast<BrowserWindowController*>([cocoaWindow windowController]); 129 static_cast<BrowserWindowController*>([cocoaWindow windowController]);
130 ASSERT_TRUE([controller isKindOfClass:[BrowserWindowController class]]); 130 ASSERT_TRUE([controller isKindOfClass:[BrowserWindowController class]]);
131 EXPECT_FALSE([controller isTabbedWindow]); 131 EXPECT_FALSE([controller isTabbedWindow]);
132 EXPECT_FALSE([controller hasTabStrip]); 132 EXPECT_FALSE([controller hasTabStrip]);
133 EXPECT_TRUE([controller hasTitleBar]); 133 EXPECT_TRUE([controller hasTitleBar]);
134 EXPECT_FALSE([controller isBookmarkBarVisible]); 134 EXPECT_FALSE([controller isBookmarkBarVisible]);
135 [controller close]; 135 [controller close];
136 } 136 }
137 137
138 TEST_F(BrowserWindowControllerTest, TestSetBounds) { 138 TEST_F(BrowserWindowControllerTest, TestSetBounds) {
139 // Create a normal browser with bounds smaller than the minimum. 139 // Create a normal browser with bounds smaller than the minimum.
140 Browser::CreateParams params(Browser::TYPE_TABBED, profile(), 140 Browser::CreateParams params(Browser::TYPE_TABBED, profile(),
141 chrome::GetActiveDesktop()); 141 chrome::GetActiveDesktop());
142 params.initial_bounds = gfx::Rect(0, 0, 50, 50); 142 params.initial_bounds = gfx::Rect(0, 0, 50, 50);
143 Browser* browser = new Browser(params); 143 Browser* browser = new Browser(params);
144 NSWindow *cocoaWindow = browser->window()->GetNativeWindow(); 144 NSWindow* cocoaWindow = browser->window()->GetNativeWindow();
145 BrowserWindowController* controller = 145 BrowserWindowController* controller =
146 static_cast<BrowserWindowController*>([cocoaWindow windowController]); 146 static_cast<BrowserWindowController*>([cocoaWindow windowController]);
147 147
148 ASSERT_TRUE([controller isTabbedWindow]); 148 ASSERT_TRUE([controller isTabbedWindow]);
149 BrowserWindow* browser_window = [controller browserWindow]; 149 BrowserWindow* browser_window = [controller browserWindow];
150 EXPECT_EQ(browser_window, browser->window()); 150 EXPECT_EQ(browser_window, browser->window());
151 gfx::Rect bounds = browser_window->GetBounds(); 151 gfx::Rect bounds = browser_window->GetBounds();
152 EXPECT_EQ(400, bounds.width()); 152 EXPECT_EQ(400, bounds.width());
153 EXPECT_EQ(272, bounds.height()); 153 EXPECT_EQ(272, bounds.height());
154 154
155 // Try to set the bounds smaller than the minimum. 155 // Try to set the bounds smaller than the minimum.
156 browser_window->SetBounds(gfx::Rect(0, 0, 50, 50)); 156 browser_window->SetBounds(gfx::Rect(0, 0, 50, 50));
157 bounds = browser_window->GetBounds(); 157 bounds = browser_window->GetBounds();
158 EXPECT_EQ(400, bounds.width()); 158 EXPECT_EQ(400, bounds.width());
159 EXPECT_EQ(272, bounds.height()); 159 EXPECT_EQ(272, bounds.height());
160 160
161 [controller close]; 161 [controller close];
162 } 162 }
163 163
164 TEST_F(BrowserWindowControllerTest, TestSetBoundsPopup) { 164 TEST_F(BrowserWindowControllerTest, TestSetBoundsPopup) {
165 // Create a popup with bounds smaller than the minimum. 165 // Create a popup with bounds smaller than the minimum.
166 Browser::CreateParams params(Browser::TYPE_POPUP, profile(), 166 Browser::CreateParams params(Browser::TYPE_POPUP, profile(),
167 chrome::GetActiveDesktop()); 167 chrome::GetActiveDesktop());
168 params.initial_bounds = gfx::Rect(0, 0, 50, 50); 168 params.initial_bounds = gfx::Rect(0, 0, 50, 50);
169 Browser* browser = new Browser(params); 169 Browser* browser = new Browser(params);
170 NSWindow *cocoaWindow = browser->window()->GetNativeWindow(); 170 NSWindow* cocoaWindow = browser->window()->GetNativeWindow();
171 BrowserWindowController* controller = 171 BrowserWindowController* controller =
172 static_cast<BrowserWindowController*>([cocoaWindow windowController]); 172 static_cast<BrowserWindowController*>([cocoaWindow windowController]);
173 173
174 ASSERT_FALSE([controller isTabbedWindow]); 174 ASSERT_FALSE([controller isTabbedWindow]);
175 BrowserWindow* browser_window = [controller browserWindow]; 175 BrowserWindow* browser_window = [controller browserWindow];
176 EXPECT_EQ(browser_window, browser->window()); 176 EXPECT_EQ(browser_window, browser->window());
177 gfx::Rect bounds = browser_window->GetBounds(); 177 gfx::Rect bounds = browser_window->GetBounds();
178 EXPECT_EQ(100, bounds.width()); 178 EXPECT_EQ(100, bounds.width());
179 EXPECT_EQ(122, bounds.height()); 179 EXPECT_EQ(122, bounds.height());
180 180
(...skipping 15 matching lines...) Expand all
196 196
197 // Explicitly show the bar. Can't use chrome::ToggleBookmarkBarWhenVisible() 197 // Explicitly show the bar. Can't use chrome::ToggleBookmarkBarWhenVisible()
198 // because of the notification issues. 198 // because of the notification issues.
199 profile()->GetPrefs()->SetBoolean(bookmarks::prefs::kShowBookmarkBar, true); 199 profile()->GetPrefs()->SetBoolean(bookmarks::prefs::kShowBookmarkBar, true);
200 200
201 [controller_ browserWindow]->BookmarkBarStateChanged( 201 [controller_ browserWindow]->BookmarkBarStateChanged(
202 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); 202 BookmarkBar::DONT_ANIMATE_STATE_CHANGE);
203 EXPECT_TRUE([controller_ isBookmarkBarVisible]); 203 EXPECT_TRUE([controller_ isBookmarkBarVisible]);
204 } 204 }
205 205
206 TEST_F(BrowserWindowControllerTest, BookmarkBarToggleRespectMinWindowHeight) {
207 Browser::CreateParams params(Browser::TYPE_TABBED, profile(),
208 chrome::GetActiveDesktop());
209 params.initial_bounds = gfx::Rect(0, 0, 50, 280);
210 Browser* browser = new Browser(params);
211 NSWindow* cocoaWindow = browser->window()->GetNativeWindow();
212 BrowserWindowController* controller =
213 static_cast<BrowserWindowController*>([cocoaWindow windowController]);
214 BrowserWindow* browser_window = [controller browserWindow];
215 gfx::Rect bounds = browser_window->GetBounds();
216 EXPECT_EQ(280, bounds.height());
217
218 // Try to set the bounds smaller than the minimum.
219 // Explicitly show the bar. Can't use chrome::ToggleBookmarkBarWhenVisible()
220 // because of the notification issues.
221 [controller adjustWindowHeightBy:-20];
222 bounds = browser_window->GetBounds();
223 EXPECT_EQ(272, bounds.height());
224
225 [controller close];
226 }
227
206 #if 0 228 #if 0
207 // TODO(jrg): This crashes trying to create the BookmarkBarController, adding 229 // TODO(jrg): This crashes trying to create the BookmarkBarController, adding
208 // an observer to the BookmarkModel. 230 // an observer to the BookmarkModel.
209 TEST_F(BrowserWindowControllerTest, TestIncognitoWidthSpace) { 231 TEST_F(BrowserWindowControllerTest, TestIncognitoWidthSpace) {
210 scoped_ptr<TestingProfile> incognito_profile(new TestingProfile()); 232 scoped_ptr<TestingProfile> incognito_profile(new TestingProfile());
211 incognito_profile->set_off_the_record(true); 233 incognito_profile->set_off_the_record(true);
212 scoped_ptr<Browser> browser( 234 scoped_ptr<Browser> browser(
213 new Browser(Browser::CreateParams(incognito_profile.get(), 235 new Browser(Browser::CreateParams(incognito_profile.get(),
214 chrome::GetActiveDesktop())); 236 chrome::GetActiveDesktop()));
215 controller_.reset([[BrowserWindowController alloc] 237 controller_.reset([[BrowserWindowController alloc]
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } // end namespace 326 } // end namespace
305 327
306 TEST_F(BrowserWindowControllerTest, TestAdjustWindowHeight) { 328 TEST_F(BrowserWindowControllerTest, TestAdjustWindowHeight) {
307 NSWindow* window = [controller_ window]; 329 NSWindow* window = [controller_ window];
308 NSRect workarea = [[window screen] visibleFrame]; 330 NSRect workarea = [[window screen] visibleFrame];
309 331
310 // Place the window well above the bottom of the screen and try to adjust its 332 // Place the window well above the bottom of the screen and try to adjust its
311 // height. It should change appropriately (and only downwards). Then get it to 333 // height. It should change appropriately (and only downwards). Then get it to
312 // shrink by the same amount; it should return to its original state. 334 // shrink by the same amount; it should return to its original state.
313 NSRect initialFrame = NSMakeRect(workarea.origin.x, workarea.origin.y + 100, 335 NSRect initialFrame = NSMakeRect(workarea.origin.x, workarea.origin.y + 100,
314 200, 200); 336 200, 280);
315 [window setFrame:initialFrame display:YES]; 337 [window setFrame:initialFrame display:YES];
316 [controller_ resetWindowGrowthState]; 338 [controller_ resetWindowGrowthState];
317 [controller_ adjustWindowHeightBy:40]; 339 [controller_ adjustWindowHeightBy:40];
318 NSRect finalFrame = [window frame]; 340 NSRect finalFrame = [window frame];
319 EXPECT_FALSE(NSEqualRects(finalFrame, initialFrame)); 341 EXPECT_FALSE(NSEqualRects(finalFrame, initialFrame));
320 EXPECT_FLOAT_EQ(NSMaxY(finalFrame), NSMaxY(initialFrame)); 342 EXPECT_FLOAT_EQ(NSMaxY(finalFrame), NSMaxY(initialFrame));
321 EXPECT_FLOAT_EQ(NSHeight(finalFrame), NSHeight(initialFrame) + 40); 343 EXPECT_FLOAT_EQ(NSHeight(finalFrame), NSHeight(initialFrame) + 40);
322 [controller_ adjustWindowHeightBy:-40]; 344 [controller_ adjustWindowHeightBy:-40];
323 finalFrame = [window frame]; 345 finalFrame = [window frame];
324 EXPECT_FLOAT_EQ(NSMaxY(finalFrame), NSMaxY(initialFrame)); 346 EXPECT_FLOAT_EQ(NSMaxY(finalFrame), NSMaxY(initialFrame));
325 EXPECT_FLOAT_EQ(NSHeight(finalFrame), NSHeight(initialFrame)); 347 EXPECT_FLOAT_EQ(NSHeight(finalFrame), NSHeight(initialFrame));
326 348
327 // Place the window at the bottom of the screen and try again. Its height 349 // Place the window at the bottom of the screen and try again. Its height
328 // should still change, but it should not grow down below the work area; it 350 // should still change, but it should not grow down below the work area; it
329 // should instead move upwards. Then shrink it and make sure it goes back to 351 // should instead move upwards. Then shrink it and make sure it goes back to
330 // the way it was. 352 // the way it was.
331 initialFrame = NSMakeRect(workarea.origin.x, workarea.origin.y, 200, 200); 353 initialFrame = NSMakeRect(workarea.origin.x, workarea.origin.y, 200, 280);
332 [window setFrame:initialFrame display:YES]; 354 [window setFrame:initialFrame display:YES];
333 [controller_ resetWindowGrowthState]; 355 [controller_ resetWindowGrowthState];
334 [controller_ adjustWindowHeightBy:40]; 356 [controller_ adjustWindowHeightBy:40];
335 finalFrame = [window frame]; 357 finalFrame = [window frame];
336 EXPECT_FALSE(NSEqualRects(finalFrame, initialFrame)); 358 EXPECT_FALSE(NSEqualRects(finalFrame, initialFrame));
337 EXPECT_FLOAT_EQ(NSMinY(finalFrame), NSMinY(initialFrame)); 359 EXPECT_FLOAT_EQ(NSMinY(finalFrame), NSMinY(initialFrame));
338 EXPECT_FLOAT_EQ(NSHeight(finalFrame), NSHeight(initialFrame) + 40); 360 EXPECT_FLOAT_EQ(NSHeight(finalFrame), NSHeight(initialFrame) + 40);
339 [controller_ adjustWindowHeightBy:-40]; 361 [controller_ adjustWindowHeightBy:-40];
340 finalFrame = [window frame]; 362 finalFrame = [window frame];
341 EXPECT_FLOAT_EQ(NSMinY(finalFrame), NSMinY(initialFrame)); 363 EXPECT_FLOAT_EQ(NSMinY(finalFrame), NSMinY(initialFrame));
342 EXPECT_FLOAT_EQ(NSHeight(finalFrame), NSHeight(initialFrame)); 364 EXPECT_FLOAT_EQ(NSHeight(finalFrame), NSHeight(initialFrame));
343 365
344 // Put the window slightly offscreen and try again. The height should not 366 // Put the window slightly offscreen and try again. The height should not
345 // change this time. 367 // change this time.
346 initialFrame = NSMakeRect(workarea.origin.x - 10, 0, 200, 200); 368 initialFrame = NSMakeRect(workarea.origin.x - 10, 0, 200, 280);
347 [window setFrame:initialFrame display:YES]; 369 [window setFrame:initialFrame display:YES];
348 [controller_ resetWindowGrowthState]; 370 [controller_ resetWindowGrowthState];
349 [controller_ adjustWindowHeightBy:40]; 371 [controller_ adjustWindowHeightBy:40];
350 EXPECT_TRUE(NSEqualRects([window frame], initialFrame)); 372 EXPECT_TRUE(NSEqualRects([window frame], initialFrame));
351 [controller_ adjustWindowHeightBy:-40]; 373 [controller_ adjustWindowHeightBy:-40];
352 EXPECT_TRUE(NSEqualRects([window frame], initialFrame)); 374 EXPECT_TRUE(NSEqualRects([window frame], initialFrame));
353 375
354 // Make the window the same size as the workarea. Resizing both larger and 376 // Make the window the same size as the workarea. Resizing both larger and
355 // smaller should have no effect. 377 // smaller should have no effect.
356 [window setFrame:workarea display:YES]; 378 [window setFrame:workarea display:YES];
357 [controller_ resetWindowGrowthState]; 379 [controller_ resetWindowGrowthState];
358 [controller_ adjustWindowHeightBy:40]; 380 [controller_ adjustWindowHeightBy:40];
359 EXPECT_TRUE(NSEqualRects([window frame], workarea)); 381 EXPECT_TRUE(NSEqualRects([window frame], workarea));
360 [controller_ adjustWindowHeightBy:-40]; 382 [controller_ adjustWindowHeightBy:-40];
361 EXPECT_TRUE(NSEqualRects([window frame], workarea)); 383 EXPECT_TRUE(NSEqualRects([window frame], workarea));
362 384
363 // Make the window smaller than the workarea and place it near the bottom of 385 // Make the window smaller than the workarea and place it near the bottom of
364 // the workarea. The window should grow down until it hits the bottom and 386 // the workarea. The window should grow down until it hits the bottom and
365 // then continue to grow up. Then shrink it, and it should return to where it 387 // then continue to grow up. Then shrink it, and it should return to where it
366 // was. 388 // was.
367 initialFrame = NSMakeRect(workarea.origin.x, workarea.origin.y + 5, 389 initialFrame = NSMakeRect(workarea.origin.x, workarea.origin.y + 5,
368 200, 200); 390 200, 280);
369 [window setFrame:initialFrame display:YES]; 391 [window setFrame:initialFrame display:YES];
370 [controller_ resetWindowGrowthState]; 392 [controller_ resetWindowGrowthState];
371 [controller_ adjustWindowHeightBy:40]; 393 [controller_ adjustWindowHeightBy:40];
372 finalFrame = [window frame]; 394 finalFrame = [window frame];
373 EXPECT_FLOAT_EQ(NSMinY(workarea), NSMinY(finalFrame)); 395 EXPECT_FLOAT_EQ(NSMinY(workarea), NSMinY(finalFrame));
374 EXPECT_FLOAT_EQ(NSHeight(finalFrame), NSHeight(initialFrame) + 40); 396 EXPECT_FLOAT_EQ(NSHeight(finalFrame), NSHeight(initialFrame) + 40);
375 [controller_ adjustWindowHeightBy:-40]; 397 [controller_ adjustWindowHeightBy:-40];
376 finalFrame = [window frame]; 398 finalFrame = [window frame];
377 EXPECT_FLOAT_EQ(NSMinY(initialFrame), NSMinY(finalFrame)); 399 EXPECT_FLOAT_EQ(NSMinY(initialFrame), NSMinY(finalFrame));
378 EXPECT_FLOAT_EQ(NSHeight(initialFrame), NSHeight(finalFrame)); 400 EXPECT_FLOAT_EQ(NSHeight(initialFrame), NSHeight(finalFrame));
379 401
380 // Inset the window slightly from the workarea. It should not grow to be 402 // Inset the window slightly from the workarea. It should not grow to be
381 // larger than the workarea. Shrink it; it should return to where it started. 403 // larger than the workarea. Shrink it; it should return to where it started.
382 initialFrame = NSInsetRect(workarea, 0, 5); 404 initialFrame = NSInsetRect(workarea, 0, 5);
383 [window setFrame:initialFrame display:YES]; 405 [window setFrame:initialFrame display:YES];
384 [controller_ resetWindowGrowthState]; 406 [controller_ resetWindowGrowthState];
385 [controller_ adjustWindowHeightBy:40]; 407 [controller_ adjustWindowHeightBy:40];
386 finalFrame = [window frame]; 408 finalFrame = [window frame];
387 EXPECT_FLOAT_EQ(NSMinY(workarea), NSMinY(finalFrame)); 409 EXPECT_FLOAT_EQ(NSMinY(workarea), NSMinY(finalFrame));
388 EXPECT_FLOAT_EQ(NSHeight(workarea), NSHeight(finalFrame)); 410 EXPECT_FLOAT_EQ(NSHeight(workarea), NSHeight(finalFrame));
389 [controller_ adjustWindowHeightBy:-40]; 411 [controller_ adjustWindowHeightBy:-40];
390 finalFrame = [window frame]; 412 finalFrame = [window frame];
391 EXPECT_FLOAT_EQ(NSMinY(initialFrame), NSMinY(finalFrame)); 413 EXPECT_FLOAT_EQ(NSMinY(initialFrame), NSMinY(finalFrame));
392 EXPECT_FLOAT_EQ(NSHeight(initialFrame), NSHeight(finalFrame)); 414 EXPECT_FLOAT_EQ(NSHeight(initialFrame), NSHeight(finalFrame));
393 415
394 // Place the window at the bottom of the screen and grow; it should grow 416 // Place the window at the bottom of the screen and grow; it should grow
395 // upwards. Move the window off the bottom, then shrink. It should then shrink 417 // upwards. Move the window off the bottom, then shrink. It should then shrink
396 // from the bottom. 418 // from the bottom.
397 initialFrame = NSMakeRect(workarea.origin.x, workarea.origin.y, 200, 200); 419 initialFrame = NSMakeRect(workarea.origin.x, workarea.origin.y, 200, 280);
398 [window setFrame:initialFrame display:YES]; 420 [window setFrame:initialFrame display:YES];
399 [controller_ resetWindowGrowthState]; 421 [controller_ resetWindowGrowthState];
400 [controller_ adjustWindowHeightBy:40]; 422 [controller_ adjustWindowHeightBy:40];
401 finalFrame = [window frame]; 423 finalFrame = [window frame];
402 EXPECT_FALSE(NSEqualRects(finalFrame, initialFrame)); 424 EXPECT_FALSE(NSEqualRects(finalFrame, initialFrame));
403 EXPECT_FLOAT_EQ(NSMinY(finalFrame), NSMinY(initialFrame)); 425 EXPECT_FLOAT_EQ(NSMinY(finalFrame), NSMinY(initialFrame));
404 EXPECT_FLOAT_EQ(NSHeight(finalFrame), NSHeight(initialFrame) + 40); 426 EXPECT_FLOAT_EQ(NSHeight(finalFrame), NSHeight(initialFrame) + 40);
405 NSPoint oldOrigin = initialFrame.origin; 427 NSPoint oldOrigin = initialFrame.origin;
406 NSPoint newOrigin = NSMakePoint(oldOrigin.x, oldOrigin.y + 10); 428 NSPoint newOrigin = NSMakePoint(oldOrigin.x, oldOrigin.y + 10);
407 [window setFrameOrigin:newOrigin]; 429 [window setFrameOrigin:newOrigin];
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 [controller_ close]; 723 [controller_ close];
702 CocoaProfileTest::TearDown(); 724 CocoaProfileTest::TearDown();
703 } 725 }
704 726
705 public: 727 public:
706 BrowserWindowController* controller_; 728 BrowserWindowController* controller_;
707 }; 729 };
708 730
709 // Check if the window is front most or if one of its child windows (such 731 // Check if the window is front most or if one of its child windows (such
710 // as a status bubble) is front most. 732 // as a status bubble) is front most.
711 static bool IsFrontWindow(NSWindow *window) { 733 static bool IsFrontWindow(NSWindow* window) {
712 NSWindow* frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0]; 734 NSWindow* frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0];
713 return [frontmostWindow isEqual:window] || 735 return [frontmostWindow isEqual:window] ||
714 [[frontmostWindow parentWindow] isEqual:window]; 736 [[frontmostWindow parentWindow] isEqual:window];
715 } 737 }
716 738
717 void WaitForFullScreenTransition() { 739 void WaitForFullScreenTransition() {
718 content::WindowedNotificationObserver observer( 740 content::WindowedNotificationObserver observer(
719 chrome::NOTIFICATION_FULLSCREEN_CHANGED, 741 chrome::NOTIFICATION_FULLSCREEN_CHANGED,
720 content::NotificationService::AllSources()); 742 content::NotificationService::AllSources());
721 observer.Wait(); 743 observer.Wait();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) 797 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400)
776 styleMask:NSBorderlessWindowMask 798 styleMask:NSBorderlessWindowMask
777 backing:NSBackingStoreBuffered 799 backing:NSBackingStoreBuffered
778 defer:NO]); 800 defer:NO]);
779 [[testFullscreenWindow_ contentView] setWantsLayer:YES]; 801 [[testFullscreenWindow_ contentView] setWantsLayer:YES];
780 return testFullscreenWindow_.get(); 802 return testFullscreenWindow_.get();
781 } 803 }
782 @end 804 @end
783 805
784 /* TODO(???): test other methods of BrowserWindowController */ 806 /* TODO(???): test other methods of BrowserWindowController */
OLDNEW
« 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