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/mac/sdk_forward_declarations.h" | 8 #include "base/mac/sdk_forward_declarations.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/devtools/devtools_window.h" | 12 #include "chrome/browser/devtools/devtools_window_testing.h" |
13 #include "chrome/browser/infobars/infobar_service.h" | 13 #include "chrome/browser/infobars/infobar_service.h" |
14 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" | 14 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
17 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 17 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_commands.h" | 19 #include "chrome/browser/ui/browser_commands.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/browser_window_cocoa.h" | 22 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 CGFloat GetViewHeight(ViewID viewID) const { | 128 CGFloat GetViewHeight(ViewID viewID) const { |
129 CGFloat height = NSHeight([GetViewWithID(viewID) frame]); | 129 CGFloat height = NSHeight([GetViewWithID(viewID) frame]); |
130 if (viewID == VIEW_ID_INFO_BAR) { | 130 if (viewID == VIEW_ID_INFO_BAR) { |
131 height -= [[controller() infoBarContainerController] | 131 height -= [[controller() infoBarContainerController] |
132 overlappingTipHeight]; | 132 overlappingTipHeight]; |
133 } | 133 } |
134 return height; | 134 return height; |
135 } | 135 } |
136 | 136 |
137 void SetDevToolsWindowContentsBounds( | |
138 DevToolsWindow* window, const gfx::Rect& bounds) { | |
139 window->SetInspectedPageBounds(bounds); | |
140 } | |
141 | |
142 private: | 137 private: |
143 DISALLOW_COPY_AND_ASSIGN(BrowserWindowControllerTest); | 138 DISALLOW_COPY_AND_ASSIGN(BrowserWindowControllerTest); |
144 }; | 139 }; |
145 | 140 |
146 // Tests that adding the first profile moves the Lion fullscreen button over | 141 // Tests that adding the first profile moves the Lion fullscreen button over |
147 // correctly. | 142 // correctly. |
148 // DISABLED_ because it regularly times out: http://crbug.com/159002. | 143 // DISABLED_ because it regularly times out: http://crbug.com/159002. |
149 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, | 144 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, |
150 DISABLED_ProfileAvatarFullscreenButton) { | 145 DISABLED_ProfileAvatarFullscreenButton) { |
151 if (base::mac::IsOSSnowLeopard()) | 146 if (base::mac::IsOSSnowLeopard()) |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 354 |
360 overlay.reset(); | 355 overlay.reset(); |
361 EXPECT_TRUE(web_contents->GetAllowOverlappingViews()); | 356 EXPECT_TRUE(web_contents->GetAllowOverlappingViews()); |
362 } | 357 } |
363 | 358 |
364 // Tests that status bubble's base frame does move when devTools are docked. | 359 // Tests that status bubble's base frame does move when devTools are docked. |
365 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, | 360 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, |
366 StatusBubblePositioning) { | 361 StatusBubblePositioning) { |
367 NSPoint origin = [controller() statusBubbleBaseFrame].origin; | 362 NSPoint origin = [controller() statusBubbleBaseFrame].origin; |
368 | 363 |
369 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindowForTest( | 364 DevToolsWindow* devtools_window = |
370 browser(), true); | 365 DevToolsWindowTesting::OpenDevToolsWindowSync(browser(), true); |
371 SetDevToolsWindowContentsBounds(devtools_window, gfx::Rect(10, 10, 100, 100)); | 366 DevToolsWindowTesting::Get(devtools_window)->SetInspectedPageBounds( |
| 367 gfx::Rect(10, 10, 100, 100)); |
372 | 368 |
373 NSPoint originWithDevTools = [controller() statusBubbleBaseFrame].origin; | 369 NSPoint originWithDevTools = [controller() statusBubbleBaseFrame].origin; |
374 EXPECT_FALSE(NSEqualPoints(origin, originWithDevTools)); | 370 EXPECT_FALSE(NSEqualPoints(origin, originWithDevTools)); |
| 371 |
| 372 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools_window); |
375 } | 373 } |
OLD | NEW |