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/common/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
9 #include "ash/common/shelf/shelf_types.h" | 9 #include "ash/common/shelf/shelf_types.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
11 #include "ash/shelf/shelf_layout_manager.h" | 11 #include "ash/shelf/shelf_layout_manager.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
| 14 #include "ash/test/immersive_fullscreen_controller_test_api.h" |
14 #include "base/command_line.h" | 15 #include "base/command_line.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "chrome/app/chrome_command_ids.h" | 17 #include "chrome/app/chrome_command_ids.h" |
17 #include "chrome/browser/ui/browser_commands.h" | 18 #include "chrome/browser/ui/browser_commands.h" |
18 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 19 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
19 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" | 20 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" |
20 #include "chrome/browser/ui/views/frame/browser_view.h" | 21 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 22 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" |
21 #include "chrome/browser/ui/views/frame/test_with_browser_view.h" | 23 #include "chrome/browser/ui/views/frame/test_with_browser_view.h" |
22 #include "chrome/browser/ui/views/frame/top_container_view.h" | 24 #include "chrome/browser/ui/views/frame/top_container_view.h" |
23 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 25 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
24 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 26 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
25 #include "ui/aura/window.h" | 27 #include "ui/aura/window.h" |
26 #include "ui/views/controls/webview/webview.h" | 28 #include "ui/views/controls/webview/webview.h" |
27 | 29 |
28 class ImmersiveModeControllerAshTest : public TestWithBrowserView { | 30 class ImmersiveModeControllerAshTest : public TestWithBrowserView { |
29 public: | 31 public: |
30 ImmersiveModeControllerAshTest() | 32 ImmersiveModeControllerAshTest() |
31 : TestWithBrowserView(Browser::TYPE_TABBED, false) {} | 33 : TestWithBrowserView(Browser::TYPE_TABBED, false) {} |
32 ImmersiveModeControllerAshTest(Browser::Type browser_type, bool hosted_app) | 34 ImmersiveModeControllerAshTest(Browser::Type browser_type, bool hosted_app) |
33 : TestWithBrowserView(browser_type, hosted_app) {} | 35 : TestWithBrowserView(browser_type, hosted_app) {} |
34 ~ImmersiveModeControllerAshTest() override {} | 36 ~ImmersiveModeControllerAshTest() override {} |
35 | 37 |
36 // TestWithBrowserView override: | 38 // TestWithBrowserView override: |
37 void SetUp() override { | 39 void SetUp() override { |
38 TestWithBrowserView::SetUp(); | 40 TestWithBrowserView::SetUp(); |
39 | 41 |
40 browser()->window()->Show(); | 42 browser()->window()->Show(); |
41 | 43 |
42 controller_ = browser_view()->immersive_mode_controller(); | 44 controller_ = browser_view()->immersive_mode_controller(); |
43 controller_->SetupForTest(); | 45 ASSERT_EQ(ImmersiveModeController::Type::ASH, controller_->type()); |
| 46 ash::ImmersiveFullscreenControllerTestApi( |
| 47 static_cast<ImmersiveModeControllerAsh*>(controller_)->controller()) |
| 48 .SetupForTest(); |
44 } | 49 } |
45 | 50 |
46 // Returns the bounds of |view| in widget coordinates. | 51 // Returns the bounds of |view| in widget coordinates. |
47 gfx::Rect GetBoundsInWidget(views::View* view) { | 52 gfx::Rect GetBoundsInWidget(views::View* view) { |
48 return view->ConvertRectToWidget(view->GetLocalBounds()); | 53 return view->ConvertRectToWidget(view->GetLocalBounds()); |
49 } | 54 } |
50 | 55 |
51 // Toggle the browser's fullscreen state. | 56 // Toggle the browser's fullscreen state. |
52 void ToggleFullscreen() { | 57 void ToggleFullscreen() { |
53 // NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. The notification | 58 // NOTIFICATION_FULLSCREEN_CHANGED is sent asynchronously. The notification |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 376 |
372 // Exit immersive fullscreen. The web contents should be back below the window | 377 // Exit immersive fullscreen. The web contents should be back below the window |
373 // header. | 378 // header. |
374 ToggleFullscreen(); | 379 ToggleFullscreen(); |
375 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); | 380 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); |
376 EXPECT_FALSE(controller()->IsEnabled()); | 381 EXPECT_FALSE(controller()->IsEnabled()); |
377 EXPECT_FALSE(tabstrip->visible()); | 382 EXPECT_FALSE(tabstrip->visible()); |
378 EXPECT_FALSE(toolbar->visible()); | 383 EXPECT_FALSE(toolbar->visible()); |
379 EXPECT_EQ(header_height, GetBoundsInWidget(contents_web_view).y()); | 384 EXPECT_EQ(header_height, GetBoundsInWidget(contents_web_view).y()); |
380 } | 385 } |
OLD | NEW |