Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: chrome/browser/ui/ash/chrome_shell_delegate_browsertest.cc

Issue 25536010: Make packaged apps use AppNonClientFrameViewAsh when maximized (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/command_line.h" 14 #include "base/command_line.h"
15 #include "chrome/browser/apps/app_browsertest_util.h" 15 #include "chrome/browser/apps/app_browsertest_util.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_commands.h" 17 #include "chrome/browser/ui/browser_commands.h"
18 #include "chrome/browser/ui/browser_finder.h" 18 #include "chrome/browser/ui/browser_finder.h"
19 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/immersive_fullscreen_configuration.h" 20 #include "chrome/browser/ui/immersive_fullscreen_configuration.h"
21 #include "chrome/common/chrome_switches.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. Infer whether |window|
27 // is in immersive fullscreen based on whether kFullscreenUsesMinimalChromeKey 28 // is in immersive fullscreen based on whether kFullscreenUsesMinimalChromeKey
28 // is set for |window| because DEPS does not allow the test to use BrowserView. 29 // 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 // (This is not quite right because if a window is in both immersive browser
30 // fullscreen and in tab fullscreen, kFullScreenUsesMinimalChromeKey will 31 // fullscreen and in tab fullscreen, kFullScreenUsesMinimalChromeKey will
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 158
158 shell_delegate->ToggleFullscreen(); 159 shell_delegate->ToggleFullscreen();
159 EXPECT_TRUE(browser_window->IsFullscreen()); 160 EXPECT_TRUE(browser_window->IsFullscreen());
160 EXPECT_FALSE(IsInImmersiveFullscreen(browser_window)); 161 EXPECT_FALSE(IsInImmersiveFullscreen(browser_window));
161 162
162 shell_delegate->ToggleFullscreen(); 163 shell_delegate->ToggleFullscreen();
163 EXPECT_FALSE(browser_window->IsMaximized()); 164 EXPECT_FALSE(browser_window->IsMaximized());
164 EXPECT_FALSE(browser_window->IsFullscreen()); 165 EXPECT_FALSE(browser_window->IsFullscreen());
165 } 166 }
166 167
167 typedef extensions::PlatformAppBrowserTest 168 class ChromeShellDelegatePlatformAppBrowserTest
168 ChromeShellDelegatePlatformAppBrowserTest; 169 : public extensions::PlatformAppBrowserTest {
170 public:
171 ChromeShellDelegatePlatformAppBrowserTest() {}
172 virtual ~ChromeShellDelegatePlatformAppBrowserTest() {}
169 173
170 // Test that ToggleFullscreen() toggles the platform app's fullscreen state. 174 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
175 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line);
176 command_line->AppendSwitch(switches::kOpenAsh);
177 }
178
179 private:
180 DISALLOW_COPY_AND_ASSIGN(ChromeShellDelegatePlatformAppBrowserTest);
181 };
182
183 // Test the behavior of ToggleFullscreen() with packaged apps.
171 IN_PROC_BROWSER_TEST_F(ChromeShellDelegatePlatformAppBrowserTest, 184 IN_PROC_BROWSER_TEST_F(ChromeShellDelegatePlatformAppBrowserTest,
172 ToggleFullscreenPlatformApp) { 185 ToggleFullscreenPlatformApp) {
173 ash::ShellDelegate* shell_delegate = ash::Shell::GetInstance()->delegate(); 186 ash::ShellDelegate* shell_delegate = ash::Shell::GetInstance()->delegate();
174 ASSERT_TRUE(shell_delegate); 187 ASSERT_TRUE(shell_delegate);
175 188
176 const extensions::Extension* extension = LoadAndLaunchPlatformApp("minimal"); 189 const extensions::Extension* extension = LoadAndLaunchPlatformApp("minimal");
177 apps::ShellWindow* shell_window = CreateShellWindow(extension); 190 apps::ShellWindow* shell_window = CreateShellWindow(extension);
178 apps::NativeAppWindow* app_window = shell_window->GetBaseWindow(); 191 apps::NativeAppWindow* app_window = shell_window->GetBaseWindow();
179 ASSERT_TRUE(shell_window->GetBaseWindow()->IsActive()); 192 ASSERT_TRUE(shell_window->GetBaseWindow()->IsActive());
180 EXPECT_FALSE(app_window->IsMaximized()); 193 EXPECT_FALSE(app_window->IsMaximized());
181 EXPECT_FALSE(app_window->IsFullscreen()); 194 EXPECT_FALSE(app_window->IsFullscreen());
182 195
183 shell_delegate->ToggleFullscreen(); 196 shell_delegate->ToggleFullscreen();
184 EXPECT_TRUE(app_window->IsFullscreen()); 197 // If packaged app uses the same frame as hosted apps, ToggleFullscreen()
198 // should maximize the app.
199 if (ash::switches::UseSameFrameForV1AndV2Apps()) {
200 EXPECT_TRUE(app_window->IsMaximized());
201 } else {
202 EXPECT_TRUE(app_window->IsFullscreen());
185 203
186 shell_delegate->ToggleFullscreen(); 204 shell_delegate->ToggleFullscreen();
187 EXPECT_FALSE(app_window->IsMaximized()); 205 EXPECT_FALSE(app_window->IsMaximized());
188 EXPECT_FALSE(app_window->IsFullscreen()); 206 EXPECT_FALSE(app_window->IsFullscreen());
207 }
189 208
190 CloseShellWindow(shell_window); 209 CloseShellWindow(shell_window);
191 } 210 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.cc ('k') | chrome/browser/ui/views/apps/native_app_window_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698