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_testing.h" | 12 #include "chrome/browser/devtools/devtools_window.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 |
137 private: | 142 private: |
138 DISALLOW_COPY_AND_ASSIGN(BrowserWindowControllerTest); | 143 DISALLOW_COPY_AND_ASSIGN(BrowserWindowControllerTest); |
139 }; | 144 }; |
140 | 145 |
141 // Tests that adding the first profile moves the Lion fullscreen button over | 146 // Tests that adding the first profile moves the Lion fullscreen button over |
142 // correctly. | 147 // correctly. |
143 // DISABLED_ because it regularly times out: http://crbug.com/159002. | 148 // DISABLED_ because it regularly times out: http://crbug.com/159002. |
144 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, | 149 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, |
145 DISABLED_ProfileAvatarFullscreenButton) { | 150 DISABLED_ProfileAvatarFullscreenButton) { |
146 if (base::mac::IsOSSnowLeopard()) | 151 if (base::mac::IsOSSnowLeopard()) |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 359 |
355 overlay.reset(); | 360 overlay.reset(); |
356 EXPECT_TRUE(web_contents->GetAllowOverlappingViews()); | 361 EXPECT_TRUE(web_contents->GetAllowOverlappingViews()); |
357 } | 362 } |
358 | 363 |
359 // Tests that status bubble's base frame does move when devTools are docked. | 364 // Tests that status bubble's base frame does move when devTools are docked. |
360 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, | 365 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, |
361 StatusBubblePositioning) { | 366 StatusBubblePositioning) { |
362 NSPoint origin = [controller() statusBubbleBaseFrame].origin; | 367 NSPoint origin = [controller() statusBubbleBaseFrame].origin; |
363 | 368 |
364 DevToolsWindow* devtools_window = | 369 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindowForTest( |
365 DevToolsWindowTesting::OpenDevToolsWindowSync(browser(), true); | 370 browser(), true); |
366 DevToolsWindowTesting::Get(devtools_window)->SetInspectedPageBounds( | 371 SetDevToolsWindowContentsBounds(devtools_window, gfx::Rect(10, 10, 100, 100)); |
367 gfx::Rect(10, 10, 100, 100)); | |
368 | 372 |
369 NSPoint originWithDevTools = [controller() statusBubbleBaseFrame].origin; | 373 NSPoint originWithDevTools = [controller() statusBubbleBaseFrame].origin; |
370 EXPECT_FALSE(NSEqualPoints(origin, originWithDevTools)); | 374 EXPECT_FALSE(NSEqualPoints(origin, originWithDevTools)); |
371 } | 375 } |
OLD | NEW |