| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ash/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
| 6 | 6 |
| 7 #include "apps/native_app_window.h" |
| 7 #include "apps/shell_window.h" | 8 #include "apps/shell_window.h" |
| 8 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 9 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 10 #include "ash/shell_delegate.h" | 11 #include "ash/shell_delegate.h" |
| 11 #include "ash/wm/window_properties.h" | 12 #include "ash/wm/window_properties.h" |
| 12 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
| 13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 14 #include "chrome/browser/extensions/platform_app_browsertest_util.h" | 15 #include "chrome/browser/extensions/platform_app_browsertest_util.h" |
| 15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_commands.h" | 17 #include "chrome/browser/ui/browser_commands.h" |
| 17 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/browser/ui/extensions/native_app_window.h" | |
| 20 #include "chrome/browser/ui/immersive_fullscreen_configuration.h" | 20 #include "chrome/browser/ui/immersive_fullscreen_configuration.h" |
| 21 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
| 22 #include "ui/aura/client/aura_constants.h" | 22 #include "ui/aura/client/aura_constants.h" |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 // Returns true if |window| is in immersive fullscreen. Infer whether |window| | 26 // Returns true if |window| is in immersive fullscreen. Infer whether |window| |
| 27 // is in immersive fullscreen based on whether kFullscreenUsesMinimalChromeKey | 27 // is in immersive fullscreen based on whether kFullscreenUsesMinimalChromeKey |
| 28 // is set for |window| because DEPS does not allow the test to use BrowserView. | 28 // is set for |window| because DEPS does not allow the test to use BrowserView. |
| 29 // (This is not quite right because if a window is in both immersive browser | 29 // (This is not quite right because if a window is in both immersive browser |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 ChromeShellDelegatePlatformAppBrowserTest; | 168 ChromeShellDelegatePlatformAppBrowserTest; |
| 169 | 169 |
| 170 // Test that ToggleFullscreen() toggles the platform app's fullscreen state. | 170 // Test that ToggleFullscreen() toggles the platform app's fullscreen state. |
| 171 IN_PROC_BROWSER_TEST_F(ChromeShellDelegatePlatformAppBrowserTest, | 171 IN_PROC_BROWSER_TEST_F(ChromeShellDelegatePlatformAppBrowserTest, |
| 172 ToggleFullscreenPlatformApp) { | 172 ToggleFullscreenPlatformApp) { |
| 173 ash::ShellDelegate* shell_delegate = ash::Shell::GetInstance()->delegate(); | 173 ash::ShellDelegate* shell_delegate = ash::Shell::GetInstance()->delegate(); |
| 174 ASSERT_TRUE(shell_delegate); | 174 ASSERT_TRUE(shell_delegate); |
| 175 | 175 |
| 176 const extensions::Extension* extension = LoadAndLaunchPlatformApp("minimal"); | 176 const extensions::Extension* extension = LoadAndLaunchPlatformApp("minimal"); |
| 177 apps::ShellWindow* shell_window = CreateShellWindow(extension); | 177 apps::ShellWindow* shell_window = CreateShellWindow(extension); |
| 178 NativeAppWindow* app_window = shell_window->GetBaseWindow(); | 178 apps::NativeAppWindow* app_window = shell_window->GetBaseWindow(); |
| 179 ASSERT_TRUE(shell_window->GetBaseWindow()->IsActive()); | 179 ASSERT_TRUE(shell_window->GetBaseWindow()->IsActive()); |
| 180 EXPECT_FALSE(app_window->IsMaximized()); | 180 EXPECT_FALSE(app_window->IsMaximized()); |
| 181 EXPECT_FALSE(app_window->IsFullscreen()); | 181 EXPECT_FALSE(app_window->IsFullscreen()); |
| 182 | 182 |
| 183 shell_delegate->ToggleFullscreen(); | 183 shell_delegate->ToggleFullscreen(); |
| 184 EXPECT_TRUE(app_window->IsFullscreen()); | 184 EXPECT_TRUE(app_window->IsFullscreen()); |
| 185 | 185 |
| 186 shell_delegate->ToggleFullscreen(); | 186 shell_delegate->ToggleFullscreen(); |
| 187 EXPECT_FALSE(app_window->IsMaximized()); | 187 EXPECT_FALSE(app_window->IsMaximized()); |
| 188 EXPECT_FALSE(app_window->IsFullscreen()); | 188 EXPECT_FALSE(app_window->IsFullscreen()); |
| 189 | 189 |
| 190 CloseShellWindow(shell_window); | 190 CloseShellWindow(shell_window); |
| 191 } | 191 } |
| OLD | NEW |