OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" |
6 | 6 |
7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
9 #include "ash/frame/header_painter.h" | 9 #include "ash/frame/header_painter.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "ash/test/immersive_fullscreen_controller_test_api.h" | 11 #include "ash/test/immersive_fullscreen_controller_test_api.h" |
12 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 12 #include "ash/wm/tablet_mode/tablet_mode_controller.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 15 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
16 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 16 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
17 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_test.h" | 17 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_test.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/exclusive_access/fullscreen_controller.h" | 20 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
21 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" | 21 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" |
22 #include "chrome/browser/ui/views/frame/browser_view.h" | 22 #include "chrome/browser/ui/views/frame/browser_view.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 // Teleport the window to another desktop. | 256 // Teleport the window to another desktop. |
257 const AccountId account_id2(AccountId::FromUserEmail("user2")); | 257 const AccountId account_id2(AccountId::FromUserEmail("user2")); |
258 manager->ShowWindowForUser(browser()->window()->GetNativeWindow(), | 258 manager->ShowWindowForUser(browser()->window()->GetNativeWindow(), |
259 account_id2); | 259 account_id2); |
260 // Clicking on the avatar icon should have same behaviour like clicking on | 260 // Clicking on the avatar icon should have same behaviour like clicking on |
261 // the caption area, i.e., allow the user to drag the browser window around. | 261 // the caption area, i.e., allow the user to drag the browser window around. |
262 EXPECT_EQ(HTCAPTION, frame_view->NonClientHitTest(avatar_center)); | 262 EXPECT_EQ(HTCAPTION, frame_view->NonClientHitTest(avatar_center)); |
263 } | 263 } |
264 | 264 |
265 // Tests that FrameCaptionButtonContainer has been relaid out in response to | 265 // Tests that FrameCaptionButtonContainer has been relaid out in response to |
266 // maximize mode being toggled. | 266 // tablet mode being toggled. |
267 IN_PROC_BROWSER_TEST_F(BrowserNonClientFrameViewAshTest, | 267 IN_PROC_BROWSER_TEST_F(BrowserNonClientFrameViewAshTest, |
268 ToggleMaximizeModeRelayout) { | 268 ToggleTabletModeRelayout) { |
269 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); | 269 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); |
270 Widget* widget = browser_view->GetWidget(); | 270 Widget* widget = browser_view->GetWidget(); |
271 // We know we're using Ash, so static cast. | 271 // We know we're using Ash, so static cast. |
272 BrowserNonClientFrameViewAsh* frame_view = | 272 BrowserNonClientFrameViewAsh* frame_view = |
273 static_cast<BrowserNonClientFrameViewAsh*>( | 273 static_cast<BrowserNonClientFrameViewAsh*>( |
274 widget->non_client_view()->frame_view()); | 274 widget->non_client_view()->frame_view()); |
275 | 275 |
276 const gfx::Rect initial = frame_view->caption_button_container_->bounds(); | 276 const gfx::Rect initial = frame_view->caption_button_container_->bounds(); |
277 ash::Shell::Get() | 277 ash::Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager( |
278 ->maximize_mode_controller() | 278 true); |
279 ->EnableMaximizeModeWindowManager(true); | |
280 ash::FrameCaptionButtonContainerView::TestApi test(frame_view-> | 279 ash::FrameCaptionButtonContainerView::TestApi test(frame_view-> |
281 caption_button_container_); | 280 caption_button_container_); |
282 test.EndAnimations(); | 281 test.EndAnimations(); |
283 const gfx::Rect during_maximize = frame_view->caption_button_container_-> | 282 const gfx::Rect during_maximize = frame_view->caption_button_container_-> |
284 bounds(); | 283 bounds(); |
285 EXPECT_GT(initial.width(), during_maximize.width()); | 284 EXPECT_GT(initial.width(), during_maximize.width()); |
286 ash::Shell::Get() | 285 ash::Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager( |
287 ->maximize_mode_controller() | 286 false); |
288 ->EnableMaximizeModeWindowManager(false); | |
289 test.EndAnimations(); | 287 test.EndAnimations(); |
290 const gfx::Rect after_restore = frame_view->caption_button_container_-> | 288 const gfx::Rect after_restore = frame_view->caption_button_container_-> |
291 bounds(); | 289 bounds(); |
292 EXPECT_EQ(initial, after_restore); | 290 EXPECT_EQ(initial, after_restore); |
293 } | 291 } |
OLD | NEW |