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

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

Issue 8423035: Split out fullscreen logic from Browser into FullscreenController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "base/mac/mac_util.h" 5 #include "base/mac/mac_util.h"
6 #include "base/memory/scoped_nsobject.h" 6 #include "base/memory/scoped_nsobject.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/sync/sync_ui_util.h" 10 #include "chrome/browser/sync/sync_ui_util.h"
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 681
682 // Check if the window is front most or if one of its child windows (such 682 // Check if the window is front most or if one of its child windows (such
683 // as a status bubble) is front most. 683 // as a status bubble) is front most.
684 static bool IsFrontWindow(NSWindow *window) { 684 static bool IsFrontWindow(NSWindow *window) {
685 NSWindow* frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0]; 685 NSWindow* frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0];
686 return [frontmostWindow isEqual:window] || 686 return [frontmostWindow isEqual:window] ||
687 [[frontmostWindow parentWindow] isEqual:window]; 687 [[frontmostWindow parentWindow] isEqual:window];
688 } 688 }
689 689
690 TEST_F(BrowserWindowFullScreenControllerTest, TestFullscreenNotLion) { 690 TEST_F(BrowserWindowFullScreenControllerTest, TestFullscreenNotLion) {
691 CreateBrowserWindow();
691 EXPECT_FALSE([controller_ isFullscreen]); 692 EXPECT_FALSE([controller_ isFullscreen]);
692 [controller_ enterFullscreenForURL:GURL() 693 [controller_ enterFullscreenForURL:GURL()
693 bubbleType:FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION]; 694 bubbleType:FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION];
694 EXPECT_TRUE([controller_ isFullscreen]); 695 EXPECT_TRUE([controller_ isFullscreen]);
695 [controller_ exitFullscreen]; 696 [controller_ exitFullscreen];
696 EXPECT_FALSE([controller_ isFullscreen]); 697 EXPECT_FALSE([controller_ isFullscreen]);
697 } 698 }
698 699
699 // If this test fails, it is usually a sign that the bots have some sort of 700 // If this test fails, it is usually a sign that the bots have some sort of
700 // problem (such as a modal dialog up). This tests is a very useful canary, so 701 // problem (such as a modal dialog up). This tests is a very useful canary, so
701 // please do not mark it as flaky without first verifying that there are no bot 702 // please do not mark it as flaky without first verifying that there are no bot
702 // problems. 703 // problems.
703 TEST_F(BrowserWindowFullScreenControllerTest, TestActivateNotLion) { 704 TEST_F(BrowserWindowFullScreenControllerTest, TestActivateNotLion) {
705 CreateBrowserWindow();
704 EXPECT_FALSE([controller_ isFullscreen]); 706 EXPECT_FALSE([controller_ isFullscreen]);
705 707
706 [controller_ activate]; 708 [controller_ activate];
707 EXPECT_TRUE(IsFrontWindow([controller_ window])); 709 EXPECT_TRUE(IsFrontWindow([controller_ window]));
708 710
709 [controller_ enterFullscreenForURL:GURL() 711 [controller_ enterFullscreenForURL:GURL()
710 bubbleType:FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION]; 712 bubbleType:FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION];
711 [controller_ activate]; 713 [controller_ activate];
712 EXPECT_TRUE(IsFrontWindow([controller_ createFullscreenWindow])); 714 EXPECT_TRUE(IsFrontWindow([controller_ createFullscreenWindow]));
713 715
(...skipping 14 matching lines...) Expand all
728 testFullscreenWindow_.reset( 730 testFullscreenWindow_.reset(
729 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) 731 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400)
730 styleMask:NSBorderlessWindowMask 732 styleMask:NSBorderlessWindowMask
731 backing:NSBackingStoreBuffered 733 backing:NSBackingStoreBuffered
732 defer:NO]); 734 defer:NO]);
733 return testFullscreenWindow_.get(); 735 return testFullscreenWindow_.get();
734 } 736 }
735 @end 737 @end
736 738
737 /* TODO(???): test other methods of BrowserWindowController */ 739 /* TODO(???): test other methods of BrowserWindowController */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698