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/ash_switches.h" | 7 #include "ash/ash_switches.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 "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 } // namespace | 57 } // namespace |
58 | 58 |
59 typedef InProcessBrowserTest AcceleratorCommandsBrowserTest; | 59 typedef InProcessBrowserTest AcceleratorCommandsBrowserTest; |
60 | 60 |
61 // Confirm that toggling window miximized works properly | 61 // Confirm that toggling window miximized works properly |
62 IN_PROC_BROWSER_TEST_F(AcceleratorCommandsBrowserTest, ToggleMaximized) { | 62 IN_PROC_BROWSER_TEST_F(AcceleratorCommandsBrowserTest, ToggleMaximized) { |
63 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
64 // Run the test on Win Ash only. | 64 // Run the test on Win Ash only. |
65 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 65 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 66 switches::kAshBrowserTests)) |
66 return; | 67 return; |
67 #endif | 68 #endif |
68 | 69 |
69 ASSERT_TRUE(ash::Shell::HasInstance()) << "No Instance"; | 70 ASSERT_TRUE(ash::Shell::HasInstance()) << "No Instance"; |
70 ash::wm::WindowState* window_state = ash::wm::GetActiveWindowState(); | 71 ash::wm::WindowState* window_state = ash::wm::GetActiveWindowState(); |
71 ASSERT_TRUE(window_state); | 72 ASSERT_TRUE(window_state); |
72 | 73 |
73 // When not in fullscreen, accelerators::ToggleMaximized toggles Maximized. | 74 // When not in fullscreen, accelerators::ToggleMaximized toggles Maximized. |
74 EXPECT_FALSE(window_state->IsMaximized()); | 75 EXPECT_FALSE(window_state->IsMaximized()); |
75 ash::accelerators::ToggleMaximized(); | 76 ash::accelerators::ToggleMaximized(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 ui::WindowShowState initial_show_state_; | 122 ui::WindowShowState initial_show_state_; |
122 | 123 |
123 DISALLOW_COPY_AND_ASSIGN(AcceleratorCommandsFullscreenBrowserTest); | 124 DISALLOW_COPY_AND_ASSIGN(AcceleratorCommandsFullscreenBrowserTest); |
124 }; | 125 }; |
125 | 126 |
126 // Test that toggling window fullscreen works properly. | 127 // Test that toggling window fullscreen works properly. |
127 IN_PROC_BROWSER_TEST_P(AcceleratorCommandsFullscreenBrowserTest, | 128 IN_PROC_BROWSER_TEST_P(AcceleratorCommandsFullscreenBrowserTest, |
128 ToggleFullscreen) { | 129 ToggleFullscreen) { |
129 #if defined(OS_WIN) | 130 #if defined(OS_WIN) |
130 // Run the test on Win Ash only. | 131 // Run the test on Win Ash only. |
131 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 132 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 133 switches::kAshBrowserTests)) |
132 return; | 134 return; |
133 #endif | 135 #endif |
134 | 136 |
135 ASSERT_TRUE(ash::Shell::HasInstance()) << "No Instance"; | 137 ASSERT_TRUE(ash::Shell::HasInstance()) << "No Instance"; |
136 | 138 |
137 // 1) Browser windows. | 139 // 1) Browser windows. |
138 ASSERT_TRUE(browser()->is_type_tabbed()); | 140 ASSERT_TRUE(browser()->is_type_tabbed()); |
139 ash::wm::WindowState* window_state = | 141 ash::wm::WindowState* window_state = |
140 ash::wm::GetWindowState(browser()->window()->GetNativeWindow()); | 142 ash::wm::GetWindowState(browser()->window()->GetNativeWindow()); |
141 ASSERT_TRUE(window_state->IsActive()); | 143 ASSERT_TRUE(window_state->IsActive()); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 ui::WindowShowState initial_show_state_; | 261 ui::WindowShowState initial_show_state_; |
260 | 262 |
261 DISALLOW_COPY_AND_ASSIGN(AcceleratorCommandsPlatformAppFullscreenBrowserTest); | 263 DISALLOW_COPY_AND_ASSIGN(AcceleratorCommandsPlatformAppFullscreenBrowserTest); |
262 }; | 264 }; |
263 | 265 |
264 // Test the behavior of platform apps when ToggleFullscreen() is called. | 266 // Test the behavior of platform apps when ToggleFullscreen() is called. |
265 IN_PROC_BROWSER_TEST_P(AcceleratorCommandsPlatformAppFullscreenBrowserTest, | 267 IN_PROC_BROWSER_TEST_P(AcceleratorCommandsPlatformAppFullscreenBrowserTest, |
266 ToggleFullscreen) { | 268 ToggleFullscreen) { |
267 #if defined(OS_WIN) | 269 #if defined(OS_WIN) |
268 // Run the test on Win Ash only. | 270 // Run the test on Win Ash only. |
269 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 271 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 272 switches::kAshBrowserTests)) |
270 return; | 273 return; |
271 #endif | 274 #endif |
272 | 275 |
273 ASSERT_TRUE(ash::Shell::HasInstance()) << "No Instance"; | 276 ASSERT_TRUE(ash::Shell::HasInstance()) << "No Instance"; |
274 const extensions::Extension* extension = LoadAndLaunchPlatformApp("minimal", | 277 const extensions::Extension* extension = LoadAndLaunchPlatformApp("minimal", |
275 "Launched"); | 278 "Launched"); |
276 | 279 |
277 { | 280 { |
278 // Test that ToggleFullscreen() toggles a platform's app's fullscreen | 281 // Test that ToggleFullscreen() toggles a platform's app's fullscreen |
279 // state and that it additionally puts the app into immersive fullscreen | 282 // state and that it additionally puts the app into immersive fullscreen |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 CloseAppWindow(app_window); | 328 CloseAppWindow(app_window); |
326 } | 329 } |
327 } | 330 } |
328 | 331 |
329 INSTANTIATE_TEST_CASE_P(InitiallyRestored, | 332 INSTANTIATE_TEST_CASE_P(InitiallyRestored, |
330 AcceleratorCommandsPlatformAppFullscreenBrowserTest, | 333 AcceleratorCommandsPlatformAppFullscreenBrowserTest, |
331 Values(ui::SHOW_STATE_NORMAL)); | 334 Values(ui::SHOW_STATE_NORMAL)); |
332 INSTANTIATE_TEST_CASE_P(InitiallyMaximized, | 335 INSTANTIATE_TEST_CASE_P(InitiallyMaximized, |
333 AcceleratorCommandsPlatformAppFullscreenBrowserTest, | 336 AcceleratorCommandsPlatformAppFullscreenBrowserTest, |
334 Values(ui::SHOW_STATE_MAXIMIZED)); | 337 Values(ui::SHOW_STATE_MAXIMIZED)); |
OLD | NEW |