| 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 "ash/accelerators/accelerator_commands.h" | 5 #include "ash/accelerators/accelerator_commands.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_commands_aura.h" | 7 #include "ash/accelerators/accelerator_commands_aura.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
| 10 #include "ash/wm_window.h" | |
| 11 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 12 #include "base/macros.h" | 11 #include "base/macros.h" |
| 13 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 14 #include "chrome/browser/apps/app_browsertest_util.h" | 13 #include "chrome/browser/apps/app_browsertest_util.h" |
| 15 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_commands.h" | 15 #include "chrome/browser/ui/browser_commands.h" |
| 17 #include "chrome/browser/ui/browser_finder.h" | 16 #include "chrome/browser/ui/browser_finder.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
| 21 #include "extensions/browser/app_window/app_window.h" | 20 #include "extensions/browser/app_window/app_window.h" |
| 22 #include "extensions/browser/app_window/native_app_window.h" | 21 #include "extensions/browser/app_window/native_app_window.h" |
| 23 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 22 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 24 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
| 24 #include "ui/aura/window.h" |
| 25 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
| 26 #include "ui/views/widget/widget_delegate.h" | 26 #include "ui/views/widget/widget_delegate.h" |
| 27 | 27 |
| 28 using testing::Combine; | 28 using testing::Combine; |
| 29 using testing::Values; | 29 using testing::Values; |
| 30 using testing::WithParamInterface; | 30 using testing::WithParamInterface; |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 // WidgetDelegateView which allows the widget to be maximized. | 34 // WidgetDelegateView which allows the widget to be maximized. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 65 | 65 |
| 66 // When not in fullscreen, accelerators::ToggleMaximized toggles Maximized. | 66 // When not in fullscreen, accelerators::ToggleMaximized toggles Maximized. |
| 67 EXPECT_FALSE(window_state->IsMaximized()); | 67 EXPECT_FALSE(window_state->IsMaximized()); |
| 68 ash::accelerators::ToggleMaximized(); | 68 ash::accelerators::ToggleMaximized(); |
| 69 EXPECT_TRUE(window_state->IsMaximized()); | 69 EXPECT_TRUE(window_state->IsMaximized()); |
| 70 ash::accelerators::ToggleMaximized(); | 70 ash::accelerators::ToggleMaximized(); |
| 71 EXPECT_FALSE(window_state->IsMaximized()); | 71 EXPECT_FALSE(window_state->IsMaximized()); |
| 72 | 72 |
| 73 // When in fullscreen accelerators::ToggleMaximized gets out of fullscreen. | 73 // When in fullscreen accelerators::ToggleMaximized gets out of fullscreen. |
| 74 EXPECT_FALSE(window_state->IsFullscreen()); | 74 EXPECT_FALSE(window_state->IsFullscreen()); |
| 75 Browser* browser = chrome::FindBrowserWithWindow( | 75 Browser* browser = chrome::FindBrowserWithWindow(window_state->window()); |
| 76 ash::WmWindow::GetAuraWindow(window_state->window())); | |
| 77 ASSERT_TRUE(browser); | 76 ASSERT_TRUE(browser); |
| 78 chrome::ToggleFullscreenMode(browser); | 77 chrome::ToggleFullscreenMode(browser); |
| 79 EXPECT_TRUE(window_state->IsFullscreen()); | 78 EXPECT_TRUE(window_state->IsFullscreen()); |
| 80 ash::accelerators::ToggleMaximized(); | 79 ash::accelerators::ToggleMaximized(); |
| 81 EXPECT_FALSE(window_state->IsFullscreen()); | 80 EXPECT_FALSE(window_state->IsFullscreen()); |
| 82 EXPECT_FALSE(window_state->IsMaximized()); | 81 EXPECT_FALSE(window_state->IsMaximized()); |
| 83 ash::accelerators::ToggleMaximized(); | 82 ash::accelerators::ToggleMaximized(); |
| 84 EXPECT_FALSE(window_state->IsFullscreen()); | 83 EXPECT_FALSE(window_state->IsFullscreen()); |
| 85 EXPECT_TRUE(window_state->IsMaximized()); | 84 EXPECT_TRUE(window_state->IsMaximized()); |
| 86 } | 85 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 131 |
| 133 ash::accelerators::ToggleFullscreen(); | 132 ash::accelerators::ToggleFullscreen(); |
| 134 EXPECT_TRUE(window_state->IsFullscreen()); | 133 EXPECT_TRUE(window_state->IsFullscreen()); |
| 135 EXPECT_TRUE(IsInImmersiveFullscreen(window_state)); | 134 EXPECT_TRUE(IsInImmersiveFullscreen(window_state)); |
| 136 | 135 |
| 137 ash::accelerators::ToggleFullscreen(); | 136 ash::accelerators::ToggleFullscreen(); |
| 138 EXPECT_TRUE(IsInitialShowState(window_state)); | 137 EXPECT_TRUE(IsInitialShowState(window_state)); |
| 139 | 138 |
| 140 // 2) ToggleFullscreen() should have no effect on windows which cannot be | 139 // 2) ToggleFullscreen() should have no effect on windows which cannot be |
| 141 // maximized. | 140 // maximized. |
| 142 ash::WmWindow::GetAuraWindow(window_state->window()) | 141 window_state->window()->SetProperty(aura::client::kResizeBehaviorKey, |
| 143 ->SetProperty(aura::client::kResizeBehaviorKey, | 142 ui::mojom::kResizeBehaviorNone); |
| 144 ui::mojom::kResizeBehaviorNone); | |
| 145 ash::accelerators::ToggleFullscreen(); | 143 ash::accelerators::ToggleFullscreen(); |
| 146 EXPECT_TRUE(IsInitialShowState(window_state)); | 144 EXPECT_TRUE(IsInitialShowState(window_state)); |
| 147 | 145 |
| 148 // 3) Hosted apps. | 146 // 3) Hosted apps. |
| 149 Browser::CreateParams browser_create_params( | 147 Browser::CreateParams browser_create_params( |
| 150 Browser::CreateParams::CreateForApp("Test", true /* trusted_source */, | 148 Browser::CreateParams::CreateForApp("Test", true /* trusted_source */, |
| 151 gfx::Rect(), browser()->profile(), | 149 gfx::Rect(), browser()->profile(), |
| 152 true)); | 150 true)); |
| 153 | 151 |
| 154 Browser* app_host_browser = new Browser(browser_create_params); | 152 Browser* app_host_browser = new Browser(browser_create_params); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 CloseAppWindow(app_window); | 305 CloseAppWindow(app_window); |
| 308 } | 306 } |
| 309 } | 307 } |
| 310 | 308 |
| 311 INSTANTIATE_TEST_CASE_P(InitiallyRestored, | 309 INSTANTIATE_TEST_CASE_P(InitiallyRestored, |
| 312 AcceleratorCommandsPlatformAppFullscreenBrowserTest, | 310 AcceleratorCommandsPlatformAppFullscreenBrowserTest, |
| 313 Values(ui::SHOW_STATE_NORMAL)); | 311 Values(ui::SHOW_STATE_NORMAL)); |
| 314 INSTANTIATE_TEST_CASE_P(InitiallyMaximized, | 312 INSTANTIATE_TEST_CASE_P(InitiallyMaximized, |
| 315 AcceleratorCommandsPlatformAppFullscreenBrowserTest, | 313 AcceleratorCommandsPlatformAppFullscreenBrowserTest, |
| 316 Values(ui::SHOW_STATE_MAXIMIZED)); | 314 Values(ui::SHOW_STATE_MAXIMIZED)); |
| OLD | NEW |