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

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

Issue 7715012: Make unit_tests runnable on Lion without crashing. Now tests just fail. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove the autocomplete_text_field change Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/hover_image_button_unittest.mm » ('j') | 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) 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/memory/scoped_nsobject.h" 6 #include "base/memory/scoped_nsobject.h"
6 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
7 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/sync/sync_ui_util.h" 10 #include "chrome/browser/sync/sync_ui_util.h"
10 #include "chrome/browser/ui/browser_list.h" 11 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/browser/ui/browser_window.h" 12 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/cocoa/browser_test_helper.h" 13 #include "chrome/browser/ui/cocoa/browser_test_helper.h"
13 #include "chrome/browser/ui/cocoa/browser_window_controller.h" 14 #include "chrome/browser/ui/cocoa/browser_window_controller.h"
14 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" 15 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 // We release the window ourselves, so we don't have to rely on the unittest 648 // We release the window ourselves, so we don't have to rely on the unittest
648 // doing it for us. 649 // doing it for us.
649 scoped_nsobject<NSWindow> testFullscreenWindow_; 650 scoped_nsobject<NSWindow> testFullscreenWindow_;
650 } 651 }
651 @end 652 @end
652 653
653 class BrowserWindowFullScreenControllerTest : public CocoaTest { 654 class BrowserWindowFullScreenControllerTest : public CocoaTest {
654 public: 655 public:
655 virtual void SetUp() { 656 virtual void SetUp() {
656 CocoaTest::SetUp(); 657 CocoaTest::SetUp();
658
659 // This test case crashes when run on Lion. Fail early.
660 if (base::mac::IsOSLionOrLater()) {
661 controller_ = nil; // Need to make sure this isn't uninitialized memory.
662 FAIL() << "This test crashes on Lion; http://crbug.com/93925";
663 }
664
657 Browser* browser = browser_helper_.browser(); 665 Browser* browser = browser_helper_.browser();
658 controller_ = 666 controller_ =
659 [[BrowserWindowControllerFakeFullscreen alloc] initWithBrowser:browser 667 [[BrowserWindowControllerFakeFullscreen alloc] initWithBrowser:browser
660 takeOwnership:NO]; 668 takeOwnership:NO];
661 } 669 }
662 670
663 virtual void TearDown() { 671 virtual void TearDown() {
664 [controller_ close]; 672 [controller_ close];
665 CocoaTest::TearDown(); 673 CocoaTest::TearDown();
666 } 674 }
667 675
668 public: 676 public:
669 BrowserTestHelper browser_helper_; 677 BrowserTestHelper browser_helper_;
670 BrowserWindowController* controller_; 678 BrowserWindowController* controller_;
671 }; 679 };
672 680
673 @interface BrowserWindowController (PrivateAPI) 681 @interface BrowserWindowController (PrivateAPI)
674 - (BOOL)supportsFullscreen; 682 - (BOOL)supportsFullscreen;
675 @end 683 @end
676 684
677 // Check if the window is front most or if one of its child windows (such 685 // Check if the window is front most or if one of its child windows (such
678 // as a status bubble) is front most. 686 // as a status bubble) is front most.
679 static bool IsFrontWindow(NSWindow *window) { 687 static bool IsFrontWindow(NSWindow *window) {
680 NSWindow* frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0]; 688 NSWindow* frontmostWindow = [[NSApp orderedWindows] objectAtIndex:0];
681 return [frontmostWindow isEqual:window] || 689 return [frontmostWindow isEqual:window] ||
682 [[frontmostWindow parentWindow] isEqual:window]; 690 [[frontmostWindow parentWindow] isEqual:window];
683 } 691 }
684 692
685 TEST_F(BrowserWindowFullScreenControllerTest, TestFullscreen) { 693 TEST_F(BrowserWindowFullScreenControllerTest, TestFullscreenNotLion) {
686 EXPECT_FALSE([controller_ isFullscreen]); 694 EXPECT_FALSE([controller_ isFullscreen]);
687 [controller_ setFullscreen:YES]; 695 [controller_ setFullscreen:YES];
688 EXPECT_TRUE([controller_ isFullscreen]); 696 EXPECT_TRUE([controller_ isFullscreen]);
689 [controller_ setFullscreen:NO]; 697 [controller_ setFullscreen:NO];
690 EXPECT_FALSE([controller_ isFullscreen]); 698 EXPECT_FALSE([controller_ isFullscreen]);
691 } 699 }
692 700
693 // If this test fails, it is usually a sign that the bots have some sort of 701 // If this test fails, it is usually a sign that the bots have some sort of
694 // problem (such as a modal dialog up). This tests is a very useful canary, so 702 // problem (such as a modal dialog up). This tests is a very useful canary, so
695 // please do not mark it as flaky without first verifying that there are no bot 703 // please do not mark it as flaky without first verifying that there are no bot
696 // problems. 704 // problems.
697 TEST_F(BrowserWindowFullScreenControllerTest, TestActivate) { 705 TEST_F(BrowserWindowFullScreenControllerTest, TestActivateNotLion) {
698 EXPECT_FALSE([controller_ isFullscreen]); 706 EXPECT_FALSE([controller_ isFullscreen]);
699 707
700 [controller_ activate]; 708 [controller_ activate];
701 EXPECT_TRUE(IsFrontWindow([controller_ window])); 709 EXPECT_TRUE(IsFrontWindow([controller_ window]));
702 710
703 [controller_ setFullscreen:YES]; 711 [controller_ setFullscreen:YES];
704 [controller_ activate]; 712 [controller_ activate];
705 EXPECT_TRUE(IsFrontWindow([controller_ createFullscreenWindow])); 713 EXPECT_TRUE(IsFrontWindow([controller_ createFullscreenWindow]));
706 714
707 // We have to cleanup after ourselves by unfullscreening. 715 // We have to cleanup after ourselves by unfullscreening.
(...skipping 13 matching lines...) Expand all
721 testFullscreenWindow_.reset( 729 testFullscreenWindow_.reset(
722 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) 730 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400)
723 styleMask:NSBorderlessWindowMask 731 styleMask:NSBorderlessWindowMask
724 backing:NSBackingStoreBuffered 732 backing:NSBackingStoreBuffered
725 defer:NO]); 733 defer:NO]);
726 return testFullscreenWindow_.get(); 734 return testFullscreenWindow_.get();
727 } 735 }
728 @end 736 @end
729 737
730 /* TODO(???): test other methods of BrowserWindowController */ 738 /* TODO(???): test other methods of BrowserWindowController */
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/hover_image_button_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698