OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/immersive_mode_controller_ash.h" | 5 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
10 #include "ash/shelf/shelf_types.h" | 10 #include "ash/shelf/shelf_types.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
| 13 #include "ash/wm/window_state.h" |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
15 #include "chrome/browser/ui/browser_commands.h" | 16 #include "chrome/browser/ui/browser_commands.h" |
16 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 17 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
17 #include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h" | 18 #include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h" |
18 #include "chrome/browser/ui/views/frame/browser_view.h" | 19 #include "chrome/browser/ui/views/frame/browser_view.h" |
19 #include "chrome/browser/ui/views/frame/test_with_browser_view.h" | 20 #include "chrome/browser/ui/views/frame/test_with_browser_view.h" |
20 #include "chrome/browser/ui/views/frame/top_container_view.h" | 21 #include "chrome/browser/ui/views/frame/top_container_view.h" |
21 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 22 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
22 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 23 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // 3) Test that exiting tab fullscreen and immersive fullscreen | 256 // 3) Test that exiting tab fullscreen and immersive fullscreen |
256 // simultaneously correctly updates the shelf visibility and whether the tab | 257 // simultaneously correctly updates the shelf visibility and whether the tab |
257 // indicators should be hidden. | 258 // indicators should be hidden. |
258 SetTabFullscreen(true); | 259 SetTabFullscreen(true); |
259 ToggleFullscreen(); | 260 ToggleFullscreen(); |
260 ASSERT_FALSE(controller()->IsEnabled()); | 261 ASSERT_FALSE(controller()->IsEnabled()); |
261 EXPECT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); | 262 EXPECT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); |
262 EXPECT_TRUE(controller()->ShouldHideTabIndicators()); | 263 EXPECT_TRUE(controller()->ShouldHideTabIndicators()); |
263 } | 264 } |
264 | 265 |
| 266 // Check that the window state gets properly marked for immersive mode. |
| 267 TEST_F(ImmersiveModeControllerAshTest, WindowStateImmersiveModeFullscreen) { |
| 268 AddTab(browser(), GURL("about:blank")); |
| 269 |
| 270 ash::wm::WindowState* window_state = |
| 271 ash::wm::GetWindowState(browser()->window()->GetNativeWindow()); |
| 272 |
| 273 EXPECT_FALSE(window_state->immersive_mode()); |
| 274 ToggleFullscreen(); |
| 275 ASSERT_TRUE(controller()->IsEnabled()); |
| 276 EXPECT_TRUE(window_state->immersive_mode()); |
| 277 |
| 278 ToggleFullscreen(); |
| 279 ASSERT_FALSE(controller()->IsEnabled()); |
| 280 EXPECT_FALSE(window_state->immersive_mode()); |
| 281 } |
| 282 |
265 class ImmersiveModeControllerAshTestHostedApp | 283 class ImmersiveModeControllerAshTestHostedApp |
266 : public ImmersiveModeControllerAshTest { | 284 : public ImmersiveModeControllerAshTest { |
267 public: | 285 public: |
268 ImmersiveModeControllerAshTestHostedApp() | 286 ImmersiveModeControllerAshTestHostedApp() |
269 : ImmersiveModeControllerAshTest(Browser::TYPE_POPUP, | 287 : ImmersiveModeControllerAshTest(Browser::TYPE_POPUP, |
270 chrome::HOST_DESKTOP_TYPE_ASH, | 288 chrome::HOST_DESKTOP_TYPE_ASH, |
271 true) { | 289 true) { |
272 } | 290 } |
273 virtual ~ImmersiveModeControllerAshTestHostedApp() {} | 291 virtual ~ImmersiveModeControllerAshTestHostedApp() {} |
274 | 292 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 347 |
330 // Exit immersive fullscreen. The web contents should be back below the window | 348 // Exit immersive fullscreen. The web contents should be back below the window |
331 // header. | 349 // header. |
332 ToggleFullscreen(); | 350 ToggleFullscreen(); |
333 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); | 351 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); |
334 EXPECT_FALSE(controller()->IsEnabled()); | 352 EXPECT_FALSE(controller()->IsEnabled()); |
335 EXPECT_FALSE(tabstrip->visible()); | 353 EXPECT_FALSE(tabstrip->visible()); |
336 EXPECT_FALSE(toolbar->visible()); | 354 EXPECT_FALSE(toolbar->visible()); |
337 EXPECT_EQ(header_height, GetBoundsInWidget(contents_web_view).y()); | 355 EXPECT_EQ(header_height, GetBoundsInWidget(contents_web_view).y()); |
338 } | 356 } |
OLD | NEW |