| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/memory/scoped_nsobject.h" | 8 #import "base/memory/scoped_nsobject.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/sync/sync_ui_util.h" | 12 #include "chrome/browser/sync/sync_ui_util.h" |
| 13 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
| 14 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
| 15 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 15 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 16 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" | 16 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" |
| 17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 19 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
| 20 #include "chrome/test/base/ui_test_utils.h" | |
| 21 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 21 #include "content/public/test/test_utils.h" |
| 22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
| 23 #include "ui/base/l10n/l10n_util_mac.h" | 23 #include "ui/base/l10n/l10n_util_mac.h" |
| 24 | 24 |
| 25 @interface BrowserWindowController (JustForTesting) | 25 @interface BrowserWindowController (JustForTesting) |
| 26 // Already defined in BWC. | 26 // Already defined in BWC. |
| 27 - (void)saveWindowPositionIfNeeded; | 27 - (void)saveWindowPositionIfNeeded; |
| 28 - (void)layoutSubviews; | 28 - (void)layoutSubviews; |
| 29 @end | 29 @end |
| 30 | 30 |
| 31 @interface BrowserWindowController (ExposedForTesting) | 31 @interface BrowserWindowController (ExposedForTesting) |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 | 661 |
| 662 // Check if the window is front most or if one of its child windows (such | 662 // Check if the window is front most or if one of its child windows (such |
| 663 // as a status bubble) is front most. | 663 // as a status bubble) is front most. |
| 664 static bool IsFrontWindow(NSWindow *window) { | 664 static bool IsFrontWindow(NSWindow *window) { |
| 665 NSWindow* frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0]; | 665 NSWindow* frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0]; |
| 666 return [frontmostWindow isEqual:window] || | 666 return [frontmostWindow isEqual:window] || |
| 667 [[frontmostWindow parentWindow] isEqual:window]; | 667 [[frontmostWindow parentWindow] isEqual:window]; |
| 668 } | 668 } |
| 669 | 669 |
| 670 void WaitForFullScreenTransition() { | 670 void WaitForFullScreenTransition() { |
| 671 ui_test_utils::WindowedNotificationObserver observer( | 671 content::WindowedNotificationObserver observer( |
| 672 chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 672 chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
| 673 content::NotificationService::AllSources()); | 673 content::NotificationService::AllSources()); |
| 674 observer.Wait(); | 674 observer.Wait(); |
| 675 } | 675 } |
| 676 | 676 |
| 677 TEST_F(BrowserWindowFullScreenControllerTest, TestFullscreen) { | 677 TEST_F(BrowserWindowFullScreenControllerTest, TestFullscreen) { |
| 678 CreateBrowserWindow(); | 678 CreateBrowserWindow(); |
| 679 [controller_ showWindow:nil]; | 679 [controller_ showWindow:nil]; |
| 680 EXPECT_FALSE([controller_ isFullscreen]); | 680 EXPECT_FALSE([controller_ isFullscreen]); |
| 681 | 681 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 testFullscreenWindow_.reset( | 729 testFullscreenWindow_.reset( |
| 730 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) | 730 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) |
| 731 styleMask:NSBorderlessWindowMask | 731 styleMask:NSBorderlessWindowMask |
| 732 backing:NSBackingStoreBuffered | 732 backing:NSBackingStoreBuffered |
| 733 defer:NO]); | 733 defer:NO]); |
| 734 return testFullscreenWindow_.get(); | 734 return testFullscreenWindow_.get(); |
| 735 } | 735 } |
| 736 @end | 736 @end |
| 737 | 737 |
| 738 /* TODO(???): test other methods of BrowserWindowController */ | 738 /* TODO(???): test other methods of BrowserWindowController */ |
| OLD | NEW |