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