| OLD | NEW |
| 1 // Copyright 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); | 693 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); |
| 694 | 694 |
| 695 NSView* bookmarkView = [controller_ bookmarkView]; | 695 NSView* bookmarkView = [controller_ bookmarkView]; |
| 696 NSView* contentView = [[controller_ window] contentView]; | 696 NSView* contentView = [[controller_ window] contentView]; |
| 697 NSPoint point = [bookmarkView convertPoint:NSMakePoint(1, 1) | 697 NSPoint point = [bookmarkView convertPoint:NSMakePoint(1, 1) |
| 698 toView:[contentView superview]]; | 698 toView:[contentView superview]]; |
| 699 | 699 |
| 700 EXPECT_TRUE([[contentView hitTest:point] isDescendantOf:bookmarkView]); | 700 EXPECT_TRUE([[contentView hitTest:point] isDescendantOf:bookmarkView]); |
| 701 } | 701 } |
| 702 | 702 |
| 703 // Check that when the window becomes/resigns main, the tab strip's background | |
| 704 // view is redrawn. | |
| 705 TEST_F(BrowserWindowControllerTest, TabStripBackgroundViewRedrawTest) { | |
| 706 NSView* view = controller_.tabStripBackgroundView; | |
| 707 id partial_mock = [OCMockObject partialMockForObject:view]; | |
| 708 | |
| 709 [[partial_mock expect] setNeedsDisplay:YES]; | |
| 710 [[NSNotificationCenter defaultCenter] | |
| 711 postNotificationName:NSWindowDidBecomeMainNotification | |
| 712 object:controller_.window]; | |
| 713 [partial_mock verify]; | |
| 714 | |
| 715 [[partial_mock expect] setNeedsDisplay:YES]; | |
| 716 [[NSNotificationCenter defaultCenter] | |
| 717 postNotificationName:NSWindowDidResignMainNotification | |
| 718 object:controller_.window]; | |
| 719 [partial_mock verify]; | |
| 720 } | |
| 721 | |
| 722 @interface BrowserWindowControllerFakeFullscreen : BrowserWindowController { | 703 @interface BrowserWindowControllerFakeFullscreen : BrowserWindowController { |
| 723 @private | 704 @private |
| 724 // We release the window ourselves, so we don't have to rely on the unittest | 705 // We release the window ourselves, so we don't have to rely on the unittest |
| 725 // doing it for us. | 706 // doing it for us. |
| 726 base::scoped_nsobject<NSWindow> testFullscreenWindow_; | 707 base::scoped_nsobject<NSWindow> testFullscreenWindow_; |
| 727 } | 708 } |
| 728 @end | 709 @end |
| 729 | 710 |
| 730 class BrowserWindowFullScreenControllerTest : public CocoaProfileTest { | 711 class BrowserWindowFullScreenControllerTest : public CocoaProfileTest { |
| 731 public: | 712 public: |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) | 797 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) |
| 817 styleMask:NSBorderlessWindowMask | 798 styleMask:NSBorderlessWindowMask |
| 818 backing:NSBackingStoreBuffered | 799 backing:NSBackingStoreBuffered |
| 819 defer:NO]); | 800 defer:NO]); |
| 820 [[testFullscreenWindow_ contentView] setWantsLayer:YES]; | 801 [[testFullscreenWindow_ contentView] setWantsLayer:YES]; |
| 821 return testFullscreenWindow_.get(); | 802 return testFullscreenWindow_.get(); |
| 822 } | 803 } |
| 823 @end | 804 @end |
| 824 | 805 |
| 825 /* TODO(???): test other methods of BrowserWindowController */ | 806 /* TODO(???): test other methods of BrowserWindowController */ |
| OLD | NEW |