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 "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
16 #include "chrome/browser/ui/browser_commands.h" | 16 #include "chrome/browser/ui/browser_commands.h" |
17 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 17 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
18 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" | 18 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" |
19 #include "chrome/browser/ui/views/frame/browser_view.h" | 19 #include "chrome/browser/ui/views/frame/browser_view.h" |
20 #include "chrome/browser/ui/views/frame/test_with_browser_view.h" | 20 #include "chrome/browser/ui/views/frame/test_with_browser_view.h" |
21 #include "chrome/browser/ui/views/frame/top_container_view.h" | 21 #include "chrome/browser/ui/views/frame/top_container_view.h" |
22 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 22 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
23 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 23 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
24 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
25 #include "ui/views/controls/webview/webview.h" | 25 #include "ui/views/controls/webview/webview.h" |
26 | 26 |
27 class ImmersiveModeControllerAshTest : public TestWithBrowserView { | 27 class ImmersiveModeControllerAshTest : public TestWithBrowserView { |
28 public: | 28 public: |
29 ImmersiveModeControllerAshTest() | 29 ImmersiveModeControllerAshTest() |
30 : TestWithBrowserView(Browser::TYPE_TABBED, | 30 : TestWithBrowserView(Browser::TYPE_TABBED, false) {} |
31 chrome::HOST_DESKTOP_TYPE_ASH, | 31 ImmersiveModeControllerAshTest(Browser::Type browser_type, bool hosted_app) |
32 false) { | 32 : TestWithBrowserView(browser_type, hosted_app) {} |
33 } | |
34 ImmersiveModeControllerAshTest( | |
35 Browser::Type browser_type, | |
36 chrome::HostDesktopType host_desktop_type, | |
37 bool hosted_app) | |
38 : TestWithBrowserView(browser_type, | |
39 host_desktop_type, | |
40 hosted_app) { | |
41 } | |
42 ~ImmersiveModeControllerAshTest() override {} | 33 ~ImmersiveModeControllerAshTest() override {} |
43 | 34 |
44 // TestWithBrowserView override: | 35 // TestWithBrowserView override: |
45 void SetUp() override { | 36 void SetUp() override { |
46 TestWithBrowserView::SetUp(); | 37 TestWithBrowserView::SetUp(); |
47 | 38 |
48 browser()->window()->Show(); | 39 browser()->window()->Show(); |
49 | 40 |
50 controller_ = browser_view()->immersive_mode_controller(); | 41 controller_ = browser_view()->immersive_mode_controller(); |
51 controller_->SetupForTest(); | 42 controller_->SetupForTest(); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 ToggleFullscreen(); | 260 ToggleFullscreen(); |
270 ASSERT_FALSE(controller()->IsEnabled()); | 261 ASSERT_FALSE(controller()->IsEnabled()); |
271 EXPECT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); | 262 EXPECT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); |
272 EXPECT_TRUE(controller()->ShouldHideTabIndicators()); | 263 EXPECT_TRUE(controller()->ShouldHideTabIndicators()); |
273 } | 264 } |
274 | 265 |
275 class ImmersiveModeControllerAshTestHostedApp | 266 class ImmersiveModeControllerAshTestHostedApp |
276 : public ImmersiveModeControllerAshTest { | 267 : public ImmersiveModeControllerAshTest { |
277 public: | 268 public: |
278 ImmersiveModeControllerAshTestHostedApp() | 269 ImmersiveModeControllerAshTestHostedApp() |
279 : ImmersiveModeControllerAshTest(Browser::TYPE_POPUP, | 270 : ImmersiveModeControllerAshTest(Browser::TYPE_POPUP, true) {} |
280 chrome::HOST_DESKTOP_TYPE_ASH, | |
281 true) { | |
282 } | |
283 ~ImmersiveModeControllerAshTestHostedApp() override {} | 271 ~ImmersiveModeControllerAshTestHostedApp() override {} |
284 | 272 |
285 private: | 273 private: |
286 DISALLOW_COPY_AND_ASSIGN(ImmersiveModeControllerAshTestHostedApp); | 274 DISALLOW_COPY_AND_ASSIGN(ImmersiveModeControllerAshTestHostedApp); |
287 }; | 275 }; |
288 | 276 |
289 // Test the layout and visibility of the TopContainerView and web contents when | 277 // Test the layout and visibility of the TopContainerView and web contents when |
290 // a hosted app is put into immersive fullscreen. | 278 // a hosted app is put into immersive fullscreen. |
291 TEST_F(ImmersiveModeControllerAshTestHostedApp, Layout) { | 279 TEST_F(ImmersiveModeControllerAshTestHostedApp, Layout) { |
292 // Add a tab because the browser starts out without any tabs at all. | 280 // Add a tab because the browser starts out without any tabs at all. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 327 |
340 // Exit immersive fullscreen. The web contents should be back below the window | 328 // Exit immersive fullscreen. The web contents should be back below the window |
341 // header. | 329 // header. |
342 ToggleFullscreen(); | 330 ToggleFullscreen(); |
343 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); | 331 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); |
344 EXPECT_FALSE(controller()->IsEnabled()); | 332 EXPECT_FALSE(controller()->IsEnabled()); |
345 EXPECT_FALSE(tabstrip->visible()); | 333 EXPECT_FALSE(tabstrip->visible()); |
346 EXPECT_FALSE(toolbar->visible()); | 334 EXPECT_FALSE(toolbar->visible()); |
347 EXPECT_EQ(header_height, GetBoundsInWidget(contents_web_view).y()); | 335 EXPECT_EQ(header_height, GetBoundsInWidget(contents_web_view).y()); |
348 } | 336 } |
OLD | NEW |