Chromium Code Reviews| 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" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 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" |
| 23 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" | 23 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
| 24 #import "chrome/browser/ui/cocoa/fast_resize_view.h" | 24 #import "chrome/browser/ui/cocoa/fast_resize_view.h" |
| 25 #import "chrome/browser/ui/cocoa/history_overlay_controller.h" | 25 #import "chrome/browser/ui/cocoa/history_overlay_controller.h" |
| 26 #import "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h" | 26 #import "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h" |
| 27 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 27 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| 28 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 28 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
| 29 #import "chrome/browser/ui/cocoa/profiles/avatar_base_controller.h" | 29 #import "chrome/browser/ui/cocoa/profiles/avatar_base_controller.h" |
| 30 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" | 30 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" |
| 31 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" | |
| 31 #include "chrome/browser/ui/extensions/application_launch.h" | 32 #include "chrome/browser/ui/extensions/application_launch.h" |
| 32 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 33 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 33 #include "chrome/browser/ui/find_bar/find_bar.h" | 34 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 34 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 35 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 35 #include "chrome/test/base/in_process_browser_test.h" | 36 #include "chrome/test/base/in_process_browser_test.h" |
| 36 #include "chrome/test/base/testing_profile.h" | 37 #include "chrome/test/base/testing_profile.h" |
| 37 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
| 38 #import "testing/gtest_mac.h" | 39 #import "testing/gtest_mac.h" |
| 39 | 40 |
| 40 namespace { | 41 namespace { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 | 128 |
| 128 CGFloat GetViewHeight(ViewID viewID) const { | 129 CGFloat GetViewHeight(ViewID viewID) const { |
| 129 CGFloat height = NSHeight([GetViewWithID(viewID) frame]); | 130 CGFloat height = NSHeight([GetViewWithID(viewID) frame]); |
| 130 if (viewID == VIEW_ID_INFO_BAR) { | 131 if (viewID == VIEW_ID_INFO_BAR) { |
| 131 height -= [[controller() infoBarContainerController] | 132 height -= [[controller() infoBarContainerController] |
| 132 overlappingTipHeight]; | 133 overlappingTipHeight]; |
| 133 } | 134 } |
| 134 return height; | 135 return height; |
| 135 } | 136 } |
| 136 | 137 |
| 138 // The traffic lights should always be in front of the content view and the | |
| 139 // tab strip view. Since the traffic lights change across OSX versions, this | |
| 140 // test verifies that the contentView is in the back, and if the tab strip | |
| 141 // view is a sibling, it is directly in front fo the content view. | |
|
Avi (use Gerrit)
2014/09/03 01:20:23
s/fo/of/
erikchen
2014/09/03 01:55:35
Done.
| |
| 142 void VerifyTrafficLightZOrder() const { | |
| 143 NSView* contentView = [[controller() window] contentView]; | |
| 144 NSView* rootView = [contentView superview]; | |
| 145 EXPECT_EQ(contentView, [[rootView subviews] objectAtIndex:0]); | |
| 146 | |
| 147 NSView* tabStripView = [controller() tabStripView]; | |
| 148 if ([[rootView subviews] containsObject:tabStripView]) | |
| 149 EXPECT_EQ(tabStripView, [[rootView subviews] objectAtIndex:1]); | |
| 150 } | |
| 151 | |
| 137 private: | 152 private: |
| 138 DISALLOW_COPY_AND_ASSIGN(BrowserWindowControllerTest); | 153 DISALLOW_COPY_AND_ASSIGN(BrowserWindowControllerTest); |
| 139 }; | 154 }; |
| 140 | 155 |
| 141 // Tests that adding the first profile moves the Lion fullscreen button over | 156 // Tests that adding the first profile moves the Lion fullscreen button over |
| 142 // correctly. | 157 // correctly. |
| 143 // DISABLED_ because it regularly times out: http://crbug.com/159002. | 158 // DISABLED_ because it regularly times out: http://crbug.com/159002. |
| 144 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, | 159 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, |
| 145 DISABLED_ProfileAvatarFullscreenButton) { | 160 DISABLED_ProfileAvatarFullscreenButton) { |
| 146 if (base::mac::IsOSSnowLeopard()) | 161 if (base::mac::IsOSSnowLeopard()) |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 DevToolsWindow* devtools_window = | 362 DevToolsWindow* devtools_window = |
| 348 DevToolsWindowTesting::OpenDevToolsWindowSync(browser(), true); | 363 DevToolsWindowTesting::OpenDevToolsWindowSync(browser(), true); |
| 349 DevToolsWindowTesting::Get(devtools_window)->SetInspectedPageBounds( | 364 DevToolsWindowTesting::Get(devtools_window)->SetInspectedPageBounds( |
| 350 gfx::Rect(10, 10, 100, 100)); | 365 gfx::Rect(10, 10, 100, 100)); |
| 351 | 366 |
| 352 NSPoint originWithDevTools = [controller() statusBubbleBaseFrame].origin; | 367 NSPoint originWithDevTools = [controller() statusBubbleBaseFrame].origin; |
| 353 EXPECT_FALSE(NSEqualPoints(origin, originWithDevTools)); | 368 EXPECT_FALSE(NSEqualPoints(origin, originWithDevTools)); |
| 354 | 369 |
| 355 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools_window); | 370 DevToolsWindowTesting::CloseDevToolsWindowSync(devtools_window); |
| 356 } | 371 } |
| 372 | |
| 373 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, TrafficLightZOrder) { | |
| 374 // Verify z order immediately after creation. | |
| 375 VerifyTrafficLightZOrder(); | |
| 376 | |
| 377 // Toggle overlay, then verify z order. | |
| 378 [controller() showOverlay]; | |
| 379 [controller() removeOverlay]; | |
| 380 VerifyTrafficLightZOrder(); | |
| 381 | |
| 382 // Toggle immersive fullscreen, then verify z order. | |
| 383 [controller() enterImmersiveFullscreen]; | |
| 384 [controller() exitImmersiveFullscreen]; | |
| 385 VerifyTrafficLightZOrder(); | |
| 386 } | |
| OLD | NEW |