| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/wm/maximize_mode/maximize_mode_window_manager.h" | 5 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/public/cpp/config.h" |
| 10 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
| 11 #include "ash/screen_util.h" | 12 #include "ash/screen_util.h" |
| 12 #include "ash/shelf/wm_shelf.h" | 13 #include "ash/shelf/wm_shelf.h" |
| 13 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 14 #include "ash/shell_port.h" | 15 #include "ash/shell_port.h" |
| 15 #include "ash/test/ash_test_base.h" | 16 #include "ash/test/ash_test_base.h" |
| 16 #include "ash/test/shell_test_api.h" | 17 #include "ash/test/shell_test_api.h" |
| 17 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 18 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| 18 #include "ash/wm/mru_window_tracker.h" | 19 #include "ash/wm/mru_window_tracker.h" |
| 19 #include "ash/wm/overview/window_selector_controller.h" | 20 #include "ash/wm/overview/window_selector_controller.h" |
| (...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 ASSERT_TRUE(window_selector_controller->IsSelecting()); | 1287 ASSERT_TRUE(window_selector_controller->IsSelecting()); |
| 1287 // Destroy the manager again and check that the windows return to their | 1288 // Destroy the manager again and check that the windows return to their |
| 1288 // previous state. | 1289 // previous state. |
| 1289 DestroyMaximizeModeWindowManager(); | 1290 DestroyMaximizeModeWindowManager(); |
| 1290 EXPECT_FALSE(window_selector_controller->IsSelecting()); | 1291 EXPECT_FALSE(window_selector_controller->IsSelecting()); |
| 1291 } | 1292 } |
| 1292 | 1293 |
| 1293 // Test that an edge swipe from the top will end full screen mode. | 1294 // Test that an edge swipe from the top will end full screen mode. |
| 1294 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeSwipeFromTop) { | 1295 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeSwipeFromTop) { |
| 1295 // TODO: investigate failure. http://crbug.com/698093. | 1296 // TODO: investigate failure. http://crbug.com/698093. |
| 1296 if (ShellPort::Get()->IsRunningInMash()) | 1297 if (Shell::GetAshConfig() == Config::MASH) |
| 1297 return; | 1298 return; |
| 1298 | 1299 |
| 1299 gfx::Rect rect(10, 10, 200, 50); | 1300 gfx::Rect rect(10, 10, 200, 50); |
| 1300 std::unique_ptr<aura::Window> background_window( | 1301 std::unique_ptr<aura::Window> background_window( |
| 1301 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1302 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1302 std::unique_ptr<aura::Window> foreground_window( | 1303 std::unique_ptr<aura::Window> foreground_window( |
| 1303 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1304 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1304 wm::WindowState* background_window_state = | 1305 wm::WindowState* background_window_state = |
| 1305 wm::GetWindowState(background_window.get()); | 1306 wm::GetWindowState(background_window.get()); |
| 1306 wm::WindowState* foreground_window_state = | 1307 wm::WindowState* foreground_window_state = |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1330 | 1331 |
| 1331 EXPECT_FALSE(foreground_window_state->IsFullscreen()); | 1332 EXPECT_FALSE(foreground_window_state->IsFullscreen()); |
| 1332 EXPECT_TRUE(background_window_state->IsFullscreen()); | 1333 EXPECT_TRUE(background_window_state->IsFullscreen()); |
| 1333 | 1334 |
| 1334 DestroyMaximizeModeWindowManager(); | 1335 DestroyMaximizeModeWindowManager(); |
| 1335 } | 1336 } |
| 1336 | 1337 |
| 1337 // Test that an edge swipe from the bottom will end full screen mode. | 1338 // Test that an edge swipe from the bottom will end full screen mode. |
| 1338 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeSwipeFromBottom) { | 1339 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeSwipeFromBottom) { |
| 1339 // TODO: investigate failure. http://crbug.com/698093. | 1340 // TODO: investigate failure. http://crbug.com/698093. |
| 1340 if (ShellPort::Get()->IsRunningInMash()) | 1341 if (Shell::GetAshConfig() == Config::MASH) |
| 1341 return; | 1342 return; |
| 1342 | 1343 |
| 1343 gfx::Rect rect(10, 10, 200, 50); | 1344 gfx::Rect rect(10, 10, 200, 50); |
| 1344 std::unique_ptr<aura::Window> background_window( | 1345 std::unique_ptr<aura::Window> background_window( |
| 1345 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1346 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1346 std::unique_ptr<aura::Window> foreground_window( | 1347 std::unique_ptr<aura::Window> foreground_window( |
| 1347 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1348 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1348 wm::WindowState* background_window_state = | 1349 wm::WindowState* background_window_state = |
| 1349 wm::GetWindowState(background_window.get()); | 1350 wm::GetWindowState(background_window.get()); |
| 1350 wm::WindowState* foreground_window_state = | 1351 wm::WindowState* foreground_window_state = |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1368 | 1369 |
| 1369 EXPECT_FALSE(foreground_window_state->IsFullscreen()); | 1370 EXPECT_FALSE(foreground_window_state->IsFullscreen()); |
| 1370 EXPECT_TRUE(background_window_state->IsFullscreen()); | 1371 EXPECT_TRUE(background_window_state->IsFullscreen()); |
| 1371 | 1372 |
| 1372 DestroyMaximizeModeWindowManager(); | 1373 DestroyMaximizeModeWindowManager(); |
| 1373 } | 1374 } |
| 1374 | 1375 |
| 1375 // Test that an edge touch press at the top will end full screen mode. | 1376 // Test that an edge touch press at the top will end full screen mode. |
| 1376 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeTouchAtTop) { | 1377 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeTouchAtTop) { |
| 1377 // TODO: investigate failure. http://crbug.com/698093. | 1378 // TODO: investigate failure. http://crbug.com/698093. |
| 1378 if (ShellPort::Get()->IsRunningInMash()) | 1379 if (Shell::GetAshConfig() == Config::MASH) |
| 1379 return; | 1380 return; |
| 1380 | 1381 |
| 1381 gfx::Rect rect(10, 10, 200, 50); | 1382 gfx::Rect rect(10, 10, 200, 50); |
| 1382 std::unique_ptr<aura::Window> background_window( | 1383 std::unique_ptr<aura::Window> background_window( |
| 1383 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1384 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1384 std::unique_ptr<aura::Window> foreground_window( | 1385 std::unique_ptr<aura::Window> foreground_window( |
| 1385 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1386 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1386 wm::WindowState* background_window_state = | 1387 wm::WindowState* background_window_state = |
| 1387 wm::GetWindowState(background_window.get()); | 1388 wm::GetWindowState(background_window.get()); |
| 1388 wm::WindowState* foreground_window_state = | 1389 wm::WindowState* foreground_window_state = |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1408 generator.GestureTapAt(gfx::Point(100, 0)); | 1409 generator.GestureTapAt(gfx::Point(100, 0)); |
| 1409 EXPECT_FALSE(foreground_window_state->IsFullscreen()); | 1410 EXPECT_FALSE(foreground_window_state->IsFullscreen()); |
| 1410 EXPECT_TRUE(background_window_state->IsFullscreen()); | 1411 EXPECT_TRUE(background_window_state->IsFullscreen()); |
| 1411 | 1412 |
| 1412 DestroyMaximizeModeWindowManager(); | 1413 DestroyMaximizeModeWindowManager(); |
| 1413 } | 1414 } |
| 1414 | 1415 |
| 1415 // Test that an edge touch press at the bottom will end full screen mode. | 1416 // Test that an edge touch press at the bottom will end full screen mode. |
| 1416 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeTouchAtBottom) { | 1417 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeTouchAtBottom) { |
| 1417 // TODO: investigate failure. http://crbug.com/698093. | 1418 // TODO: investigate failure. http://crbug.com/698093. |
| 1418 if (ShellPort::Get()->IsRunningInMash()) | 1419 if (Shell::GetAshConfig() == Config::MASH) |
| 1419 return; | 1420 return; |
| 1420 | 1421 |
| 1421 gfx::Rect rect(10, 10, 200, 50); | 1422 gfx::Rect rect(10, 10, 200, 50); |
| 1422 std::unique_ptr<aura::Window> background_window( | 1423 std::unique_ptr<aura::Window> background_window( |
| 1423 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1424 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1424 std::unique_ptr<aura::Window> foreground_window( | 1425 std::unique_ptr<aura::Window> foreground_window( |
| 1425 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1426 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1426 wm::WindowState* background_window_state = | 1427 wm::WindowState* background_window_state = |
| 1427 wm::GetWindowState(background_window.get()); | 1428 wm::GetWindowState(background_window.get()); |
| 1428 wm::WindowState* foreground_window_state = | 1429 wm::WindowState* foreground_window_state = |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 EXPECT_EQ(1, observer.GetPostCountAndReset()); | 1698 EXPECT_EQ(1, observer.GetPostCountAndReset()); |
| 1698 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, | 1699 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, |
| 1699 observer.GetLastOldStateAndReset()); | 1700 observer.GetLastOldStateAndReset()); |
| 1700 | 1701 |
| 1701 window_state->RemoveObserver(&observer); | 1702 window_state->RemoveObserver(&observer); |
| 1702 | 1703 |
| 1703 DestroyMaximizeModeWindowManager(); | 1704 DestroyMaximizeModeWindowManager(); |
| 1704 } | 1705 } |
| 1705 | 1706 |
| 1706 } // namespace ash | 1707 } // namespace ash |
| OLD | NEW |