| OLD | NEW |
| 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/memory/scoped_nsobject.h" | 5 #include "base/memory/scoped_nsobject.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
| 9 #include "chrome/browser/sync/sync_ui_util.h" | 9 #include "chrome/browser/sync/sync_ui_util.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 NSPoint bubbleOriginWithDevTools = [controller_ statusBubbleBaseFrame].origin; | 637 NSPoint bubbleOriginWithDevTools = [controller_ statusBubbleBaseFrame].origin; |
| 638 | 638 |
| 639 // Make sure that status bubble frame is moved. | 639 // Make sure that status bubble frame is moved. |
| 640 EXPECT_FALSE(NSEqualPoints(bubbleOrigin, bubbleOriginWithDevTools)); | 640 EXPECT_FALSE(NSEqualPoints(bubbleOrigin, bubbleOriginWithDevTools)); |
| 641 } | 641 } |
| 642 | 642 |
| 643 @interface BrowserWindowControllerFakeFullscreen : BrowserWindowController { | 643 @interface BrowserWindowControllerFakeFullscreen : BrowserWindowController { |
| 644 @private | 644 @private |
| 645 // We release the window ourselves, so we don't have to rely on the unittest | 645 // We release the window ourselves, so we don't have to rely on the unittest |
| 646 // doing it for us. | 646 // doing it for us. |
| 647 scoped_nsobject<NSWindow> fullscreenWindow_; | 647 scoped_nsobject<NSWindow> testFullscreenWindow_; |
| 648 } | 648 } |
| 649 @end | 649 @end |
| 650 | 650 |
| 651 class BrowserWindowFullScreenControllerTest : public CocoaTest { | 651 class BrowserWindowFullScreenControllerTest : public CocoaTest { |
| 652 public: | 652 public: |
| 653 virtual void SetUp() { | 653 virtual void SetUp() { |
| 654 CocoaTest::SetUp(); | 654 CocoaTest::SetUp(); |
| 655 Browser* browser = browser_helper_.browser(); | 655 Browser* browser = browser_helper_.browser(); |
| 656 controller_ = | 656 controller_ = |
| 657 [[BrowserWindowControllerFakeFullscreen alloc] initWithBrowser:browser | 657 [[BrowserWindowControllerFakeFullscreen alloc] initWithBrowser:browser |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 [controller_ setFullscreen:NO]; | 706 [controller_ setFullscreen:NO]; |
| 707 } | 707 } |
| 708 | 708 |
| 709 @implementation BrowserWindowControllerFakeFullscreen | 709 @implementation BrowserWindowControllerFakeFullscreen |
| 710 // Override |-createFullscreenWindow| to return a dummy window. This isn't | 710 // Override |-createFullscreenWindow| to return a dummy window. This isn't |
| 711 // needed to pass the test, but because the dummy window is only 100x100, it | 711 // needed to pass the test, but because the dummy window is only 100x100, it |
| 712 // prevents the real fullscreen window from flashing up and taking over the | 712 // prevents the real fullscreen window from flashing up and taking over the |
| 713 // whole screen. We have to return an actual window because |-layoutSubviews| | 713 // whole screen. We have to return an actual window because |-layoutSubviews| |
| 714 // looks at the window's frame. | 714 // looks at the window's frame. |
| 715 - (NSWindow*)createFullscreenWindow { | 715 - (NSWindow*)createFullscreenWindow { |
| 716 if (fullscreenWindow_.get()) | 716 if (testFullscreenWindow_.get()) |
| 717 return fullscreenWindow_.get(); | 717 return testFullscreenWindow_.get(); |
| 718 | 718 |
| 719 fullscreenWindow_.reset( | 719 testFullscreenWindow_.reset( |
| 720 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) | 720 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) |
| 721 styleMask:NSBorderlessWindowMask | 721 styleMask:NSBorderlessWindowMask |
| 722 backing:NSBackingStoreBuffered | 722 backing:NSBackingStoreBuffered |
| 723 defer:NO]); | 723 defer:NO]); |
| 724 return fullscreenWindow_.get(); | 724 return testFullscreenWindow_.get(); |
| 725 } | 725 } |
| 726 @end | 726 @end |
| 727 | 727 |
| 728 /* TODO(???): test other methods of BrowserWindowController */ | 728 /* TODO(???): test other methods of BrowserWindowController */ |
| OLD | NEW |