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