| 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/common/wm/maximize_mode/maximize_mode_window_manager.h" | 5 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/common/ash_switches.h" | 9 #include "ash/common/ash_switches.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| (...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 ASSERT_TRUE(window_selector_controller->ToggleOverview()); | 1285 ASSERT_TRUE(window_selector_controller->ToggleOverview()); |
| 1286 ASSERT_TRUE(window_selector_controller->IsSelecting()); | 1286 ASSERT_TRUE(window_selector_controller->IsSelecting()); |
| 1287 // Destroy the manager again and check that the windows return to their | 1287 // Destroy the manager again and check that the windows return to their |
| 1288 // previous state. | 1288 // previous state. |
| 1289 DestroyMaximizeModeWindowManager(); | 1289 DestroyMaximizeModeWindowManager(); |
| 1290 EXPECT_FALSE(window_selector_controller->IsSelecting()); | 1290 EXPECT_FALSE(window_selector_controller->IsSelecting()); |
| 1291 } | 1291 } |
| 1292 | 1292 |
| 1293 // Test that an edge swipe from the top will end full screen mode. | 1293 // Test that an edge swipe from the top will end full screen mode. |
| 1294 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeSwipeFromTop) { | 1294 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeSwipeFromTop) { |
| 1295 // TODO: investigate failure. http://crbug.com/698093. |
| 1296 if (WmShell::Get()->IsRunningInMash()) |
| 1297 return; |
| 1298 |
| 1295 gfx::Rect rect(10, 10, 200, 50); | 1299 gfx::Rect rect(10, 10, 200, 50); |
| 1296 std::unique_ptr<aura::Window> background_window( | 1300 std::unique_ptr<aura::Window> background_window( |
| 1297 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1301 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1298 std::unique_ptr<aura::Window> foreground_window( | 1302 std::unique_ptr<aura::Window> foreground_window( |
| 1299 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1303 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1300 wm::WindowState* background_window_state = | 1304 wm::WindowState* background_window_state = |
| 1301 wm::GetWindowState(background_window.get()); | 1305 wm::GetWindowState(background_window.get()); |
| 1302 wm::WindowState* foreground_window_state = | 1306 wm::WindowState* foreground_window_state = |
| 1303 wm::GetWindowState(foreground_window.get()); | 1307 wm::GetWindowState(foreground_window.get()); |
| 1304 wm::ActivateWindow(foreground_window.get()); | 1308 wm::ActivateWindow(foreground_window.get()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1325 base::TimeDelta::FromMilliseconds(20), 10); | 1329 base::TimeDelta::FromMilliseconds(20), 10); |
| 1326 | 1330 |
| 1327 EXPECT_FALSE(foreground_window_state->IsFullscreen()); | 1331 EXPECT_FALSE(foreground_window_state->IsFullscreen()); |
| 1328 EXPECT_TRUE(background_window_state->IsFullscreen()); | 1332 EXPECT_TRUE(background_window_state->IsFullscreen()); |
| 1329 | 1333 |
| 1330 DestroyMaximizeModeWindowManager(); | 1334 DestroyMaximizeModeWindowManager(); |
| 1331 } | 1335 } |
| 1332 | 1336 |
| 1333 // Test that an edge swipe from the bottom will end full screen mode. | 1337 // Test that an edge swipe from the bottom will end full screen mode. |
| 1334 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeSwipeFromBottom) { | 1338 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeSwipeFromBottom) { |
| 1339 // TODO: investigate failure. http://crbug.com/698093. |
| 1340 if (WmShell::Get()->IsRunningInMash()) |
| 1341 return; |
| 1342 |
| 1335 gfx::Rect rect(10, 10, 200, 50); | 1343 gfx::Rect rect(10, 10, 200, 50); |
| 1336 std::unique_ptr<aura::Window> background_window( | 1344 std::unique_ptr<aura::Window> background_window( |
| 1337 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1345 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1338 std::unique_ptr<aura::Window> foreground_window( | 1346 std::unique_ptr<aura::Window> foreground_window( |
| 1339 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1347 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1340 wm::WindowState* background_window_state = | 1348 wm::WindowState* background_window_state = |
| 1341 wm::GetWindowState(background_window.get()); | 1349 wm::GetWindowState(background_window.get()); |
| 1342 wm::WindowState* foreground_window_state = | 1350 wm::WindowState* foreground_window_state = |
| 1343 wm::GetWindowState(foreground_window.get()); | 1351 wm::GetWindowState(foreground_window.get()); |
| 1344 wm::ActivateWindow(foreground_window.get()); | 1352 wm::ActivateWindow(foreground_window.get()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1359 base::TimeDelta::FromMilliseconds(20), 10); | 1367 base::TimeDelta::FromMilliseconds(20), 10); |
| 1360 | 1368 |
| 1361 EXPECT_FALSE(foreground_window_state->IsFullscreen()); | 1369 EXPECT_FALSE(foreground_window_state->IsFullscreen()); |
| 1362 EXPECT_TRUE(background_window_state->IsFullscreen()); | 1370 EXPECT_TRUE(background_window_state->IsFullscreen()); |
| 1363 | 1371 |
| 1364 DestroyMaximizeModeWindowManager(); | 1372 DestroyMaximizeModeWindowManager(); |
| 1365 } | 1373 } |
| 1366 | 1374 |
| 1367 // Test that an edge touch press at the top will end full screen mode. | 1375 // Test that an edge touch press at the top will end full screen mode. |
| 1368 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeTouchAtTop) { | 1376 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeTouchAtTop) { |
| 1377 // TODO: investigate failure. http://crbug.com/698093. |
| 1378 if (WmShell::Get()->IsRunningInMash()) |
| 1379 return; |
| 1380 |
| 1369 gfx::Rect rect(10, 10, 200, 50); | 1381 gfx::Rect rect(10, 10, 200, 50); |
| 1370 std::unique_ptr<aura::Window> background_window( | 1382 std::unique_ptr<aura::Window> background_window( |
| 1371 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1383 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1372 std::unique_ptr<aura::Window> foreground_window( | 1384 std::unique_ptr<aura::Window> foreground_window( |
| 1373 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1385 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1374 wm::WindowState* background_window_state = | 1386 wm::WindowState* background_window_state = |
| 1375 wm::GetWindowState(background_window.get()); | 1387 wm::GetWindowState(background_window.get()); |
| 1376 wm::WindowState* foreground_window_state = | 1388 wm::WindowState* foreground_window_state = |
| 1377 wm::GetWindowState(foreground_window.get()); | 1389 wm::GetWindowState(foreground_window.get()); |
| 1378 wm::ActivateWindow(foreground_window.get()); | 1390 wm::ActivateWindow(foreground_window.get()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1395 // Try the same again and see that nothing changes. | 1407 // Try the same again and see that nothing changes. |
| 1396 generator.GestureTapAt(gfx::Point(100, 0)); | 1408 generator.GestureTapAt(gfx::Point(100, 0)); |
| 1397 EXPECT_FALSE(foreground_window_state->IsFullscreen()); | 1409 EXPECT_FALSE(foreground_window_state->IsFullscreen()); |
| 1398 EXPECT_TRUE(background_window_state->IsFullscreen()); | 1410 EXPECT_TRUE(background_window_state->IsFullscreen()); |
| 1399 | 1411 |
| 1400 DestroyMaximizeModeWindowManager(); | 1412 DestroyMaximizeModeWindowManager(); |
| 1401 } | 1413 } |
| 1402 | 1414 |
| 1403 // Test that an edge touch press at the bottom will end full screen mode. | 1415 // Test that an edge touch press at the bottom will end full screen mode. |
| 1404 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeTouchAtBottom) { | 1416 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeTouchAtBottom) { |
| 1417 // TODO: investigate failure. http://crbug.com/698093. |
| 1418 if (WmShell::Get()->IsRunningInMash()) |
| 1419 return; |
| 1420 |
| 1405 gfx::Rect rect(10, 10, 200, 50); | 1421 gfx::Rect rect(10, 10, 200, 50); |
| 1406 std::unique_ptr<aura::Window> background_window( | 1422 std::unique_ptr<aura::Window> background_window( |
| 1407 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1423 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1408 std::unique_ptr<aura::Window> foreground_window( | 1424 std::unique_ptr<aura::Window> foreground_window( |
| 1409 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); | 1425 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); |
| 1410 wm::WindowState* background_window_state = | 1426 wm::WindowState* background_window_state = |
| 1411 wm::GetWindowState(background_window.get()); | 1427 wm::GetWindowState(background_window.get()); |
| 1412 wm::WindowState* foreground_window_state = | 1428 wm::WindowState* foreground_window_state = |
| 1413 wm::GetWindowState(foreground_window.get()); | 1429 wm::GetWindowState(foreground_window.get()); |
| 1414 wm::ActivateWindow(foreground_window.get()); | 1430 wm::ActivateWindow(foreground_window.get()); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 EXPECT_EQ(1, observer.GetPostCountAndReset()); | 1718 EXPECT_EQ(1, observer.GetPostCountAndReset()); |
| 1703 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, | 1719 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, |
| 1704 observer.GetLastOldStateAndReset()); | 1720 observer.GetLastOldStateAndReset()); |
| 1705 | 1721 |
| 1706 window_state->RemoveObserver(&observer); | 1722 window_state->RemoveObserver(&observer); |
| 1707 | 1723 |
| 1708 DestroyMaximizeModeWindowManager(); | 1724 DestroyMaximizeModeWindowManager(); |
| 1709 } | 1725 } |
| 1710 | 1726 |
| 1711 } // namespace ash | 1727 } // namespace ash |
| OLD | NEW |