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

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc

Issue 2808723004: Renames WmShell to ShellPort (Closed)
Patch Set: feedback Created 3 years, 8 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
OLDNEW
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/root_window_controller.h" 10 #include "ash/root_window_controller.h"
11 #include "ash/screen_util.h" 11 #include "ash/screen_util.h"
12 #include "ash/shelf/wm_shelf.h" 12 #include "ash/shelf/wm_shelf.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/shell_port.h"
14 #include "ash/test/ash_test_base.h" 15 #include "ash/test/ash_test_base.h"
15 #include "ash/test/shell_test_api.h" 16 #include "ash/test/shell_test_api.h"
16 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 17 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
17 #include "ash/wm/mru_window_tracker.h" 18 #include "ash/wm/mru_window_tracker.h"
18 #include "ash/wm/overview/window_selector_controller.h" 19 #include "ash/wm/overview/window_selector_controller.h"
19 #include "ash/wm/switchable_windows.h" 20 #include "ash/wm/switchable_windows.h"
20 #include "ash/wm/window_properties.h" 21 #include "ash/wm/window_properties.h"
21 #include "ash/wm/window_state.h" 22 #include "ash/wm/window_state.h"
22 #include "ash/wm/window_state_aura.h" 23 #include "ash/wm/window_state_aura.h"
23 #include "ash/wm/window_state_observer.h" 24 #include "ash/wm/window_state_observer.h"
24 #include "ash/wm/window_util.h" 25 #include "ash/wm/window_util.h"
25 #include "ash/wm/wm_event.h" 26 #include "ash/wm/wm_event.h"
26 #include "ash/wm_shell.h"
27 #include "ash/wm_window.h" 27 #include "ash/wm_window.h"
28 #include "base/command_line.h" 28 #include "base/command_line.h"
29 #include "base/strings/stringprintf.h" 29 #include "base/strings/stringprintf.h"
30 #include "base/strings/utf_string_conversions.h" 30 #include "base/strings/utf_string_conversions.h"
31 #include "base/values.h" 31 #include "base/values.h"
32 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" 32 #include "services/ui/public/interfaces/window_manager_constants.mojom.h"
33 #include "ui/aura/client/aura_constants.h" 33 #include "ui/aura/client/aura_constants.h"
34 #include "ui/aura/test/test_window_delegate.h" 34 #include "ui/aura/test/test_window_delegate.h"
35 #include "ui/aura/test/test_windows.h" 35 #include "ui/aura/test/test_windows.h"
36 #include "ui/aura/window.h" 36 #include "ui/aura/window.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 std::unique_ptr<aura::Window> w8( 251 std::unique_ptr<aura::Window> w8(
252 CreateWindow(ui::wm::WINDOW_TYPE_TOOLTIP, rect)); 252 CreateWindow(ui::wm::WINDOW_TYPE_TOOLTIP, rect));
253 EXPECT_FALSE(wm::GetWindowState(w1.get())->IsMaximized()); 253 EXPECT_FALSE(wm::GetWindowState(w1.get())->IsMaximized());
254 EXPECT_FALSE(wm::GetWindowState(w2.get())->IsMaximized()); 254 EXPECT_FALSE(wm::GetWindowState(w2.get())->IsMaximized());
255 EXPECT_FALSE(wm::GetWindowState(w3.get())->IsMaximized()); 255 EXPECT_FALSE(wm::GetWindowState(w3.get())->IsMaximized());
256 EXPECT_EQ(rect1.ToString(), w1->bounds().ToString()); 256 EXPECT_EQ(rect1.ToString(), w1->bounds().ToString());
257 EXPECT_EQ(rect2.ToString(), w2->bounds().ToString()); 257 EXPECT_EQ(rect2.ToString(), w2->bounds().ToString());
258 EXPECT_EQ(rect3.ToString(), w3->bounds().ToString()); 258 EXPECT_EQ(rect3.ToString(), w3->bounds().ToString());
259 259
260 // Enable system modal dialog, and make sure both shelves are still hidden. 260 // Enable system modal dialog, and make sure both shelves are still hidden.
261 WmShell::Get()->SimulateModalWindowOpenForTesting(true); 261 ShellPort::Get()->SimulateModalWindowOpenForTesting(true);
262 EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen()); 262 EXPECT_TRUE(ShellPort::Get()->IsSystemModalWindowOpen());
263 263
264 // Create the manager and make sure that all qualifying windows were detected 264 // Create the manager and make sure that all qualifying windows were detected
265 // and changed. 265 // and changed.
266 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager(); 266 MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager();
267 ASSERT_TRUE(manager); 267 ASSERT_TRUE(manager);
268 EXPECT_EQ(3, manager->GetNumberOfManagedWindows()); 268 EXPECT_EQ(3, manager->GetNumberOfManagedWindows());
269 EXPECT_TRUE(wm::GetWindowState(w1.get())->IsMaximized()); 269 EXPECT_TRUE(wm::GetWindowState(w1.get())->IsMaximized());
270 EXPECT_TRUE(wm::GetWindowState(w2.get())->IsMaximized()); 270 EXPECT_TRUE(wm::GetWindowState(w2.get())->IsMaximized());
271 EXPECT_FALSE(wm::GetWindowState(w3.get())->IsMaximized()); 271 EXPECT_FALSE(wm::GetWindowState(w3.get())->IsMaximized());
272 EXPECT_NE(rect3.origin().ToString(), w3->bounds().origin().ToString()); 272 EXPECT_NE(rect3.origin().ToString(), w3->bounds().origin().ToString());
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
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. 1295 // TODO: investigate failure. http://crbug.com/698093.
1296 if (WmShell::Get()->IsRunningInMash()) 1296 if (ShellPort::Get()->IsRunningInMash())
1297 return; 1297 return;
1298 1298
1299 gfx::Rect rect(10, 10, 200, 50); 1299 gfx::Rect rect(10, 10, 200, 50);
1300 std::unique_ptr<aura::Window> background_window( 1300 std::unique_ptr<aura::Window> background_window(
1301 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); 1301 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
1302 std::unique_ptr<aura::Window> foreground_window( 1302 std::unique_ptr<aura::Window> foreground_window(
1303 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); 1303 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
1304 wm::WindowState* background_window_state = 1304 wm::WindowState* background_window_state =
1305 wm::GetWindowState(background_window.get()); 1305 wm::GetWindowState(background_window.get());
1306 wm::WindowState* foreground_window_state = 1306 wm::WindowState* foreground_window_state =
(...skipping 23 matching lines...) Expand all
1330 1330
1331 EXPECT_FALSE(foreground_window_state->IsFullscreen()); 1331 EXPECT_FALSE(foreground_window_state->IsFullscreen());
1332 EXPECT_TRUE(background_window_state->IsFullscreen()); 1332 EXPECT_TRUE(background_window_state->IsFullscreen());
1333 1333
1334 DestroyMaximizeModeWindowManager(); 1334 DestroyMaximizeModeWindowManager();
1335 } 1335 }
1336 1336
1337 // 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.
1338 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeSwipeFromBottom) { 1338 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeSwipeFromBottom) {
1339 // TODO: investigate failure. http://crbug.com/698093. 1339 // TODO: investigate failure. http://crbug.com/698093.
1340 if (WmShell::Get()->IsRunningInMash()) 1340 if (ShellPort::Get()->IsRunningInMash())
1341 return; 1341 return;
1342 1342
1343 gfx::Rect rect(10, 10, 200, 50); 1343 gfx::Rect rect(10, 10, 200, 50);
1344 std::unique_ptr<aura::Window> background_window( 1344 std::unique_ptr<aura::Window> background_window(
1345 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); 1345 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
1346 std::unique_ptr<aura::Window> foreground_window( 1346 std::unique_ptr<aura::Window> foreground_window(
1347 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); 1347 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
1348 wm::WindowState* background_window_state = 1348 wm::WindowState* background_window_state =
1349 wm::GetWindowState(background_window.get()); 1349 wm::GetWindowState(background_window.get());
1350 wm::WindowState* foreground_window_state = 1350 wm::WindowState* foreground_window_state =
(...skipping 17 matching lines...) Expand all
1368 1368
1369 EXPECT_FALSE(foreground_window_state->IsFullscreen()); 1369 EXPECT_FALSE(foreground_window_state->IsFullscreen());
1370 EXPECT_TRUE(background_window_state->IsFullscreen()); 1370 EXPECT_TRUE(background_window_state->IsFullscreen());
1371 1371
1372 DestroyMaximizeModeWindowManager(); 1372 DestroyMaximizeModeWindowManager();
1373 } 1373 }
1374 1374
1375 // 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.
1376 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeTouchAtTop) { 1376 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeTouchAtTop) {
1377 // TODO: investigate failure. http://crbug.com/698093. 1377 // TODO: investigate failure. http://crbug.com/698093.
1378 if (WmShell::Get()->IsRunningInMash()) 1378 if (ShellPort::Get()->IsRunningInMash())
1379 return; 1379 return;
1380 1380
1381 gfx::Rect rect(10, 10, 200, 50); 1381 gfx::Rect rect(10, 10, 200, 50);
1382 std::unique_ptr<aura::Window> background_window( 1382 std::unique_ptr<aura::Window> background_window(
1383 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); 1383 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
1384 std::unique_ptr<aura::Window> foreground_window( 1384 std::unique_ptr<aura::Window> foreground_window(
1385 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); 1385 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
1386 wm::WindowState* background_window_state = 1386 wm::WindowState* background_window_state =
1387 wm::GetWindowState(background_window.get()); 1387 wm::GetWindowState(background_window.get());
1388 wm::WindowState* foreground_window_state = 1388 wm::WindowState* foreground_window_state =
(...skipping 19 matching lines...) Expand all
1408 generator.GestureTapAt(gfx::Point(100, 0)); 1408 generator.GestureTapAt(gfx::Point(100, 0));
1409 EXPECT_FALSE(foreground_window_state->IsFullscreen()); 1409 EXPECT_FALSE(foreground_window_state->IsFullscreen());
1410 EXPECT_TRUE(background_window_state->IsFullscreen()); 1410 EXPECT_TRUE(background_window_state->IsFullscreen());
1411 1411
1412 DestroyMaximizeModeWindowManager(); 1412 DestroyMaximizeModeWindowManager();
1413 } 1413 }
1414 1414
1415 // 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.
1416 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeTouchAtBottom) { 1416 TEST_F(MaximizeModeWindowManagerTest, ExitFullScreenWithEdgeTouchAtBottom) {
1417 // TODO: investigate failure. http://crbug.com/698093. 1417 // TODO: investigate failure. http://crbug.com/698093.
1418 if (WmShell::Get()->IsRunningInMash()) 1418 if (ShellPort::Get()->IsRunningInMash())
1419 return; 1419 return;
1420 1420
1421 gfx::Rect rect(10, 10, 200, 50); 1421 gfx::Rect rect(10, 10, 200, 50);
1422 std::unique_ptr<aura::Window> background_window( 1422 std::unique_ptr<aura::Window> background_window(
1423 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); 1423 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
1424 std::unique_ptr<aura::Window> foreground_window( 1424 std::unique_ptr<aura::Window> foreground_window(
1425 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect)); 1425 CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
1426 wm::WindowState* background_window_state = 1426 wm::WindowState* background_window_state =
1427 wm::GetWindowState(background_window.get()); 1427 wm::GetWindowState(background_window.get());
1428 wm::WindowState* foreground_window_state = 1428 wm::WindowState* foreground_window_state =
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 EXPECT_EQ(1, observer.GetPostCountAndReset()); 1697 EXPECT_EQ(1, observer.GetPostCountAndReset());
1698 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED, 1698 EXPECT_EQ(wm::WINDOW_STATE_TYPE_MINIMIZED,
1699 observer.GetLastOldStateAndReset()); 1699 observer.GetLastOldStateAndReset());
1700 1700
1701 window_state->RemoveObserver(&observer); 1701 window_state->RemoveObserver(&observer);
1702 1702
1703 DestroyMaximizeModeWindowManager(); 1703 DestroyMaximizeModeWindowManager();
1704 } 1704 }
1705 1705
1706 } // namespace ash 1706 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698