OLD | NEW |
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 "ash/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/accelerators/accelerator_table.h" | 8 #include "ash/accelerators/accelerator_table.h" |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 shell->ToggleAppList(NULL); | 1319 shell->ToggleAppList(NULL); |
1320 EXPECT_TRUE(shell->GetAppListTargetVisibility()); | 1320 EXPECT_TRUE(shell->GetAppListTargetVisibility()); |
1321 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); | 1321 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); |
1322 | 1322 |
1323 // Toggle app list to hide. | 1323 // Toggle app list to hide. |
1324 shell->ToggleAppList(NULL); | 1324 shell->ToggleAppList(NULL); |
1325 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 1325 EXPECT_FALSE(shell->GetAppListTargetVisibility()); |
1326 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); | 1326 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); |
1327 } | 1327 } |
1328 | 1328 |
| 1329 // Tests that the shelf is only hidden for a fullscreen window at the front and |
| 1330 // toggles visibility when another window is activated. |
| 1331 TEST_F(ShelfLayoutManagerTest, FullscreenWindowInFrontHidesShelf) { |
| 1332 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
| 1333 |
| 1334 // Create a window and make it full screen. |
| 1335 aura::Window* window1 = CreateTestWindow(); |
| 1336 window1->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1337 window1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 1338 window1->Show(); |
| 1339 |
| 1340 aura::Window* window2 = CreateTestWindow(); |
| 1341 window2->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1342 window2->Show(); |
| 1343 |
| 1344 wm::GetWindowState(window1)->Activate(); |
| 1345 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); |
| 1346 |
| 1347 wm::GetWindowState(window2)->Activate(); |
| 1348 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); |
| 1349 |
| 1350 wm::GetWindowState(window1)->Activate(); |
| 1351 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); |
| 1352 } |
| 1353 |
| 1354 // Test the behavior of the shelf when a window on one display is fullscreen |
| 1355 // but the other display has the active window. |
| 1356 TEST_F(ShelfLayoutManagerTest, FullscreenWindowOnSecondDisplay) { |
| 1357 if (!SupportsMultipleDisplays()) |
| 1358 return; |
| 1359 |
| 1360 UpdateDisplay("800x600,800x600"); |
| 1361 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 1362 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 1363 Shell::RootWindowControllerList root_window_controllers = |
| 1364 Shell::GetAllRootWindowControllers(); |
| 1365 |
| 1366 // Create windows on either display. |
| 1367 aura::Window* window1 = CreateTestWindow(); |
| 1368 window1->SetBoundsInScreen( |
| 1369 gfx::Rect(0, 0, 100, 100), |
| 1370 display_manager->GetDisplayAt(0)); |
| 1371 window1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 1372 window1->Show(); |
| 1373 |
| 1374 aura::Window* window2 = CreateTestWindow(); |
| 1375 window2->SetBoundsInScreen( |
| 1376 gfx::Rect(800, 0, 100, 100), |
| 1377 display_manager->GetDisplayAt(1)); |
| 1378 window2->Show(); |
| 1379 |
| 1380 EXPECT_EQ(root_windows[0], window1->GetRootWindow()); |
| 1381 EXPECT_EQ(root_windows[1], window2->GetRootWindow()); |
| 1382 |
| 1383 wm::GetWindowState(window2)->Activate(); |
| 1384 EXPECT_EQ(SHELF_HIDDEN, |
| 1385 root_window_controllers[0]->GetShelfLayoutManager()->visibility_state()); |
| 1386 EXPECT_EQ(SHELF_VISIBLE, |
| 1387 root_window_controllers[1]->GetShelfLayoutManager()->visibility_state()); |
| 1388 } |
| 1389 |
| 1390 |
1329 #if defined(OS_WIN) | 1391 #if defined(OS_WIN) |
1330 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 | 1392 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 |
1331 #define MAYBE_SetAlignment DISABLED_SetAlignment | 1393 #define MAYBE_SetAlignment DISABLED_SetAlignment |
1332 #else | 1394 #else |
1333 #define MAYBE_SetAlignment SetAlignment | 1395 #define MAYBE_SetAlignment SetAlignment |
1334 #endif | 1396 #endif |
1335 | 1397 |
1336 // Tests SHELF_ALIGNMENT_(LEFT, RIGHT, TOP). | 1398 // Tests SHELF_ALIGNMENT_(LEFT, RIGHT, TOP). |
1337 TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { | 1399 TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { |
1338 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 1400 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1855 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); | 1917 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); |
1856 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | 1918 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
1857 generator.ClickLeftButton(); | 1919 generator.ClickLeftButton(); |
1858 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); | 1920 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); |
1859 generator.ClickLeftButton(); | 1921 generator.ClickLeftButton(); |
1860 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | 1922 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
1861 } | 1923 } |
1862 | 1924 |
1863 } // namespace internal | 1925 } // namespace internal |
1864 } // namespace ash | 1926 } // namespace ash |
OLD | NEW |