| 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 "apps/app_window.h" | 7 #include "apps/app_window.h" |
| 8 #include "apps/ui/native_app_window.h" | |
| 9 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 10 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 11 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
| 12 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 13 #include "chrome/browser/apps/app_browsertest_util.h" | 12 #include "chrome/browser/apps/app_browsertest_util.h" |
| 14 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_commands.h" | 14 #include "chrome/browser/ui/browser_commands.h" |
| 16 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
| 17 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
| 18 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
| 20 #include "chrome/test/base/test_switches.h" | 19 #include "chrome/test/base/test_switches.h" |
| 20 #include "extensions/browser/app_window/native_app_window.h" |
| 21 #include "ui/aura/client/aura_constants.h" | 21 #include "ui/aura/client/aura_constants.h" |
| 22 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 23 #include "ui/views/widget/widget_delegate.h" | 23 #include "ui/views/widget/widget_delegate.h" |
| 24 | 24 |
| 25 using testing::Combine; | 25 using testing::Combine; |
| 26 using testing::Values; | 26 using testing::Values; |
| 27 using testing::WithParamInterface; | 27 using testing::WithParamInterface; |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 const extensions::Extension* extension = LoadAndLaunchPlatformApp("minimal", | 274 const extensions::Extension* extension = LoadAndLaunchPlatformApp("minimal", |
| 275 "Launched"); | 275 "Launched"); |
| 276 | 276 |
| 277 { | 277 { |
| 278 // Test that ToggleFullscreen() toggles a platform's app's fullscreen | 278 // Test that ToggleFullscreen() toggles a platform's app's fullscreen |
| 279 // state and that it additionally puts the app into immersive fullscreen | 279 // state and that it additionally puts the app into immersive fullscreen |
| 280 // if put_all_windows_in_immersive() returns true. | 280 // if put_all_windows_in_immersive() returns true. |
| 281 apps::AppWindow::CreateParams params; | 281 apps::AppWindow::CreateParams params; |
| 282 params.frame = apps::AppWindow::FRAME_CHROME; | 282 params.frame = apps::AppWindow::FRAME_CHROME; |
| 283 apps::AppWindow* app_window = CreateAppWindowFromParams(extension, params); | 283 apps::AppWindow* app_window = CreateAppWindowFromParams(extension, params); |
| 284 apps::NativeAppWindow* native_app_window = app_window->GetBaseWindow(); | 284 extensions::NativeAppWindow* native_app_window = |
| 285 app_window->GetBaseWindow(); |
| 285 SetToInitialShowState(app_window); | 286 SetToInitialShowState(app_window); |
| 286 ASSERT_TRUE(app_window->GetBaseWindow()->IsActive()); | 287 ASSERT_TRUE(app_window->GetBaseWindow()->IsActive()); |
| 287 EXPECT_TRUE(IsInitialShowState(app_window)); | 288 EXPECT_TRUE(IsInitialShowState(app_window)); |
| 288 | 289 |
| 289 ash::accelerators::ToggleFullscreen(); | 290 ash::accelerators::ToggleFullscreen(); |
| 290 EXPECT_TRUE(native_app_window->IsFullscreen()); | 291 EXPECT_TRUE(native_app_window->IsFullscreen()); |
| 291 ash::wm::WindowState* window_state = | 292 ash::wm::WindowState* window_state = |
| 292 ash::wm::GetWindowState(native_app_window->GetNativeWindow()); | 293 ash::wm::GetWindowState(native_app_window->GetNativeWindow()); |
| 293 EXPECT_TRUE(IsInImmersiveFullscreen(window_state)); | 294 EXPECT_TRUE(IsInImmersiveFullscreen(window_state)); |
| 294 | 295 |
| 295 ash::accelerators::ToggleFullscreen(); | 296 ash::accelerators::ToggleFullscreen(); |
| 296 EXPECT_TRUE(IsInitialShowState(app_window)); | 297 EXPECT_TRUE(IsInitialShowState(app_window)); |
| 297 | 298 |
| 298 CloseAppWindow(app_window); | 299 CloseAppWindow(app_window); |
| 299 } | 300 } |
| 300 | 301 |
| 301 { | 302 { |
| 302 // Repeat the test, but make sure that frameless platform apps are never put | 303 // Repeat the test, but make sure that frameless platform apps are never put |
| 303 // into immersive fullscreen. | 304 // into immersive fullscreen. |
| 304 apps::AppWindow::CreateParams params; | 305 apps::AppWindow::CreateParams params; |
| 305 params.frame = apps::AppWindow::FRAME_NONE; | 306 params.frame = apps::AppWindow::FRAME_NONE; |
| 306 apps::AppWindow* app_window = CreateAppWindowFromParams(extension, params); | 307 apps::AppWindow* app_window = CreateAppWindowFromParams(extension, params); |
| 307 apps::NativeAppWindow* native_app_window = app_window->GetBaseWindow(); | 308 extensions::NativeAppWindow* native_app_window = |
| 309 app_window->GetBaseWindow(); |
| 308 ASSERT_TRUE(app_window->GetBaseWindow()->IsActive()); | 310 ASSERT_TRUE(app_window->GetBaseWindow()->IsActive()); |
| 309 SetToInitialShowState(app_window); | 311 SetToInitialShowState(app_window); |
| 310 EXPECT_TRUE(IsInitialShowState(app_window)); | 312 EXPECT_TRUE(IsInitialShowState(app_window)); |
| 311 | 313 |
| 312 ash::accelerators::ToggleFullscreen(); | 314 ash::accelerators::ToggleFullscreen(); |
| 313 EXPECT_TRUE(native_app_window->IsFullscreen()); | 315 EXPECT_TRUE(native_app_window->IsFullscreen()); |
| 314 ash::wm::WindowState* window_state = | 316 ash::wm::WindowState* window_state = |
| 315 ash::wm::GetWindowState(native_app_window->GetNativeWindow()); | 317 ash::wm::GetWindowState(native_app_window->GetNativeWindow()); |
| 316 EXPECT_FALSE(IsInImmersiveFullscreen(window_state)); | 318 EXPECT_FALSE(IsInImmersiveFullscreen(window_state)); |
| 317 | 319 |
| 318 ash::accelerators::ToggleFullscreen(); | 320 ash::accelerators::ToggleFullscreen(); |
| 319 EXPECT_TRUE(IsInitialShowState(app_window)); | 321 EXPECT_TRUE(IsInitialShowState(app_window)); |
| 320 | 322 |
| 321 CloseAppWindow(app_window); | 323 CloseAppWindow(app_window); |
| 322 } | 324 } |
| 323 } | 325 } |
| 324 | 326 |
| 325 INSTANTIATE_TEST_CASE_P(InitiallyRestored, | 327 INSTANTIATE_TEST_CASE_P(InitiallyRestored, |
| 326 AcceleratorCommandsPlatformAppFullscreenBrowserTest, | 328 AcceleratorCommandsPlatformAppFullscreenBrowserTest, |
| 327 Values(ui::SHOW_STATE_NORMAL)); | 329 Values(ui::SHOW_STATE_NORMAL)); |
| 328 INSTANTIATE_TEST_CASE_P(InitiallyMaximized, | 330 INSTANTIATE_TEST_CASE_P(InitiallyMaximized, |
| 329 AcceleratorCommandsPlatformAppFullscreenBrowserTest, | 331 AcceleratorCommandsPlatformAppFullscreenBrowserTest, |
| 330 Values(ui::SHOW_STATE_MAXIMIZED)); | 332 Values(ui::SHOW_STATE_MAXIMIZED)); |
| OLD | NEW |