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 #import "base/mac/mac_util.h" | 7 #import "base/mac/mac_util.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/devtools/devtools_window.h" |
11 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
12 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" | 13 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" |
13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 16 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_commands.h" | 18 #include "chrome/browser/ui/browser_commands.h" |
18 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
19 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
20 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" | 21 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 135 |
135 CGFloat GetViewHeight(ViewID viewID) const { | 136 CGFloat GetViewHeight(ViewID viewID) const { |
136 CGFloat height = NSHeight([GetViewWithID(viewID) frame]); | 137 CGFloat height = NSHeight([GetViewWithID(viewID) frame]); |
137 if (viewID == VIEW_ID_INFO_BAR) { | 138 if (viewID == VIEW_ID_INFO_BAR) { |
138 height -= [[controller() infoBarContainerController] | 139 height -= [[controller() infoBarContainerController] |
139 overlappingTipHeight]; | 140 overlappingTipHeight]; |
140 } | 141 } |
141 return height; | 142 return height; |
142 } | 143 } |
143 | 144 |
| 145 void SetDevToolsWindowContentsInsets( |
| 146 DevToolsWindow* window, int left, int top, int right, int bottom) { |
| 147 window->SetContentsInsets(left, top, right, bottom); |
| 148 } |
| 149 |
144 private: | 150 private: |
145 DISALLOW_COPY_AND_ASSIGN(BrowserWindowControllerTest); | 151 DISALLOW_COPY_AND_ASSIGN(BrowserWindowControllerTest); |
146 }; | 152 }; |
147 | 153 |
148 // Tests that adding the first profile moves the Lion fullscreen button over | 154 // Tests that adding the first profile moves the Lion fullscreen button over |
149 // correctly. | 155 // correctly. |
150 // DISABLED_ because it regularly times out: http://crbug.com/159002. | 156 // DISABLED_ because it regularly times out: http://crbug.com/159002. |
151 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, | 157 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, |
152 DISABLED_ProfileAvatarFullscreenButton) { | 158 DISABLED_ProfileAvatarFullscreenButton) { |
153 if (base::mac::IsOSSnowLeopard()) | 159 if (base::mac::IsOSSnowLeopard()) |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 EXPECT_TRUE(web_contents_view->GetAllowOverlappingViews()); | 365 EXPECT_TRUE(web_contents_view->GetAllowOverlappingViews()); |
360 | 366 |
361 base::scoped_nsobject<HistoryOverlayController> overlay( | 367 base::scoped_nsobject<HistoryOverlayController> overlay( |
362 [[HistoryOverlayController alloc] initForMode:kHistoryOverlayModeBack]); | 368 [[HistoryOverlayController alloc] initForMode:kHistoryOverlayModeBack]); |
363 [overlay showPanelForView:web_contents_view->GetNativeView()]; | 369 [overlay showPanelForView:web_contents_view->GetNativeView()]; |
364 EXPECT_TRUE(web_contents_view->GetAllowOverlappingViews()); | 370 EXPECT_TRUE(web_contents_view->GetAllowOverlappingViews()); |
365 | 371 |
366 overlay.reset(); | 372 overlay.reset(); |
367 EXPECT_TRUE(web_contents_view->GetAllowOverlappingViews()); | 373 EXPECT_TRUE(web_contents_view->GetAllowOverlappingViews()); |
368 } | 374 } |
| 375 |
| 376 // Tests that status bubble's base frame does move when devTools are docked. |
| 377 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, |
| 378 StatusBubblePositioning) { |
| 379 NSPoint origin = [controller() statusBubbleBaseFrame].origin; |
| 380 |
| 381 DevToolsWindow* devtools_window = DevToolsWindow::ToggleDevToolsWindow( |
| 382 browser(), DevToolsToggleAction::Show()); |
| 383 SetDevToolsWindowContentsInsets(devtools_window, 10, 10, 10, 10); |
| 384 |
| 385 NSPoint originWithDevTools = [controller() statusBubbleBaseFrame].origin; |
| 386 EXPECT_FALSE(NSEqualPoints(origin, originWithDevTools)); |
| 387 } |
OLD | NEW |