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/mac/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/signin/fake_signin_manager.h" | 14 #include "chrome/browser/signin/fake_signin_manager.h" |
15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
16 #include "chrome/browser/signin/signin_manager_factory.h" | 16 #include "chrome/browser/signin/signin_manager_factory.h" |
17 #include "chrome/browser/sync/profile_sync_service.h" | 17 #include "chrome/browser/sync/profile_sync_service.h" |
18 #include "chrome/browser/sync/profile_sync_service_factory.h" | 18 #include "chrome/browser/sync/profile_sync_service_factory.h" |
19 #include "chrome/browser/sync/profile_sync_service_mock.h" | 19 #include "chrome/browser/sync/profile_sync_service_mock.h" |
20 #include "chrome/browser/ui/browser_list.h" | 20 #include "chrome/browser/ui/browser_list.h" |
21 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.h" |
22 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 22 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
23 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" | 23 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" |
| 24 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
24 #include "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" | 25 #include "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" |
25 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 26 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
26 #include "chrome/browser/ui/host_desktop.h" | 27 #include "chrome/browser/ui/host_desktop.h" |
27 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
28 #include "chrome/test/base/testing_profile.h" | 29 #include "chrome/test/base/testing_profile.h" |
29 #include "components/signin/core/browser/fake_auth_status_provider.h" | 30 #include "components/signin/core/browser/fake_auth_status_provider.h" |
30 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 31 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
31 #include "components/signin/core/browser/signin_error_controller.h" | 32 #include "components/signin/core/browser/signin_error_controller.h" |
32 #include "components/signin/core/browser/signin_manager.h" | 33 #include "components/signin/core/browser/signin_manager.h" |
33 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 EXPECT_EQ(screenFrame.size.height, zoomFrame.size.height); | 609 EXPECT_EQ(screenFrame.size.height, zoomFrame.size.height); |
609 EXPECT_EQ(testFrame.origin.x, zoomFrame.origin.x); | 610 EXPECT_EQ(testFrame.origin.x, zoomFrame.origin.x); |
610 EXPECT_EQ(screenFrame.origin.y, zoomFrame.origin.y); | 611 EXPECT_EQ(screenFrame.origin.y, zoomFrame.origin.y); |
611 } | 612 } |
612 | 613 |
613 TEST_F(BrowserWindowControllerTest, TestFindBarOnTop) { | 614 TEST_F(BrowserWindowControllerTest, TestFindBarOnTop) { |
614 FindBarBridge bridge(NULL); | 615 FindBarBridge bridge(NULL); |
615 [controller_ addFindBar:bridge.find_bar_cocoa_controller()]; | 616 [controller_ addFindBar:bridge.find_bar_cocoa_controller()]; |
616 | 617 |
617 // Test that the Z-order of the find bar is on top of everything. | 618 // Test that the Z-order of the find bar is on top of everything. |
618 NSArray* subviews = [[[controller_ window] contentView] subviews]; | 619 NSArray* subviews = [controller_.chromeContentView subviews]; |
619 NSUInteger findBar_index = | 620 NSUInteger findBar_index = |
620 [subviews indexOfObject:[controller_ findBarView]]; | 621 [subviews indexOfObject:[controller_ findBarView]]; |
621 EXPECT_NE(NSNotFound, findBar_index); | 622 EXPECT_NE(NSNotFound, findBar_index); |
622 NSUInteger toolbar_index = | 623 NSUInteger toolbar_index = |
623 [subviews indexOfObject:[controller_ toolbarView]]; | 624 [subviews indexOfObject:[controller_ toolbarView]]; |
624 EXPECT_NE(NSNotFound, toolbar_index); | 625 EXPECT_NE(NSNotFound, toolbar_index); |
625 NSUInteger bookmark_index = | 626 NSUInteger bookmark_index = |
626 [subviews indexOfObject:[controller_ bookmarkView]]; | 627 [subviews indexOfObject:[controller_ bookmarkView]]; |
627 EXPECT_NE(NSNotFound, bookmark_index); | 628 EXPECT_NE(NSNotFound, bookmark_index); |
628 | 629 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 // looks at the window's frame. | 875 // looks at the window's frame. |
875 - (NSWindow*)createFullscreenWindow { | 876 - (NSWindow*)createFullscreenWindow { |
876 if (testFullscreenWindow_.get()) | 877 if (testFullscreenWindow_.get()) |
877 return testFullscreenWindow_.get(); | 878 return testFullscreenWindow_.get(); |
878 | 879 |
879 testFullscreenWindow_.reset( | 880 testFullscreenWindow_.reset( |
880 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) | 881 [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,400,400) |
881 styleMask:NSBorderlessWindowMask | 882 styleMask:NSBorderlessWindowMask |
882 backing:NSBackingStoreBuffered | 883 backing:NSBackingStoreBuffered |
883 defer:NO]); | 884 defer:NO]); |
| 885 [[testFullscreenWindow_ contentView] cr_setWantsLayer:YES]; |
884 return testFullscreenWindow_.get(); | 886 return testFullscreenWindow_.get(); |
885 } | 887 } |
886 @end | 888 @end |
887 | 889 |
888 /* TODO(???): test other methods of BrowserWindowController */ | 890 /* TODO(???): test other methods of BrowserWindowController */ |
OLD | NEW |