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/native_app_window.h" |
8 #include "apps/shell_window.h" | 8 #include "apps/shell_window.h" |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "ash/shell_delegate.h" | 11 #include "ash/shell_delegate.h" |
12 #include "ash/wm/window_properties.h" | 12 #include "ash/wm/window_properties.h" |
13 #include "ash/wm/window_state.h" | 13 #include "ash/wm/window_state.h" |
| 14 #include "ash/wm/wm_types.h" |
14 #include "base/command_line.h" | 15 #include "base/command_line.h" |
15 #include "chrome/browser/apps/app_browsertest_util.h" | 16 #include "chrome/browser/apps/app_browsertest_util.h" |
16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_commands.h" | 18 #include "chrome/browser/ui/browser_commands.h" |
18 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
19 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
20 #include "chrome/browser/ui/immersive_fullscreen_configuration.h" | 21 #include "chrome/browser/ui/immersive_fullscreen_configuration.h" |
21 #include "chrome/test/base/in_process_browser_test.h" | 22 #include "chrome/test/base/in_process_browser_test.h" |
22 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 // Returns true if |window| is in immersive fullscreen. Infer whether |window| | 27 // Returns true if |window| is in immersive fullscreen. |
27 // is in immersive fullscreen based on whether kFullscreenUsesMinimalChromeKey | |
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 | |
30 // fullscreen and in tab fullscreen, kFullScreenUsesMinimalChromeKey will | |
31 // not be set). | |
32 bool IsInImmersiveFullscreen(BrowserWindow* browser_window) { | 28 bool IsInImmersiveFullscreen(BrowserWindow* browser_window) { |
33 return browser_window->IsFullscreen() && | 29 if (!browser_window->IsFullscreen()) |
| 30 return false; |
| 31 ash::wm::FullscreenType fullscreen_type = |
34 browser_window->GetNativeWindow()->GetProperty( | 32 browser_window->GetNativeWindow()->GetProperty( |
35 ash::internal::kFullscreenUsesMinimalChromeKey); | 33 ash::internal::kFullscreenTypeKey); |
| 34 return ash::wm::IsImmersiveFullscreenType(fullscreen_type); |
36 } | 35 } |
37 | 36 |
38 } // namespace | 37 } // namespace |
39 | 38 |
40 typedef InProcessBrowserTest ChromeShellDelegateBrowserTest; | 39 typedef InProcessBrowserTest ChromeShellDelegateBrowserTest; |
41 | 40 |
42 // Confirm that toggling window miximized works properly | 41 // Confirm that toggling window miximized works properly |
43 IN_PROC_BROWSER_TEST_F(ChromeShellDelegateBrowserTest, ToggleMaximized) { | 42 IN_PROC_BROWSER_TEST_F(ChromeShellDelegateBrowserTest, ToggleMaximized) { |
44 ash::ShellDelegate* shell_delegate = ash::Shell::GetInstance()->delegate(); | 43 ash::ShellDelegate* shell_delegate = ash::Shell::GetInstance()->delegate(); |
45 ASSERT_TRUE(shell_delegate); | 44 ASSERT_TRUE(shell_delegate); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 181 |
183 shell_delegate->ToggleFullscreen(); | 182 shell_delegate->ToggleFullscreen(); |
184 EXPECT_TRUE(app_window->IsFullscreen()); | 183 EXPECT_TRUE(app_window->IsFullscreen()); |
185 | 184 |
186 shell_delegate->ToggleFullscreen(); | 185 shell_delegate->ToggleFullscreen(); |
187 EXPECT_FALSE(app_window->IsMaximized()); | 186 EXPECT_FALSE(app_window->IsMaximized()); |
188 EXPECT_FALSE(app_window->IsFullscreen()); | 187 EXPECT_FALSE(app_window->IsFullscreen()); |
189 | 188 |
190 CloseShellWindow(shell_window); | 189 CloseShellWindow(shell_window); |
191 } | 190 } |
OLD | NEW |