| 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/focus_cycler.h" | 9 #include "ash/focus_cycler.h" |
| 10 #include "ash/public/cpp/config.h" | 10 #include "ash/public/cpp/config.h" |
| 11 #include "ash/public/cpp/shell_window_ids.h" | 11 #include "ash/public/cpp/shell_window_ids.h" |
| 12 #include "ash/root_window_controller.h" |
| 12 #include "ash/session/session_controller.h" | 13 #include "ash/session/session_controller.h" |
| 13 #include "ash/shelf/shelf.h" | 14 #include "ash/shelf/shelf.h" |
| 14 #include "ash/shelf/shelf_constants.h" | 15 #include "ash/shelf/shelf_constants.h" |
| 15 #include "ash/shelf/shelf_layout_manager_observer.h" | 16 #include "ash/shelf/shelf_layout_manager_observer.h" |
| 16 #include "ash/shelf/shelf_view.h" | 17 #include "ash/shelf/shelf_view.h" |
| 17 #include "ash/shelf/shelf_widget.h" | 18 #include "ash/shelf/shelf_widget.h" |
| 18 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 19 #include "ash/shell_port.h" | 20 #include "ash/shell_port.h" |
| 20 #include "ash/system/status_area_widget.h" | 21 #include "ash/system/status_area_widget.h" |
| 21 #include "ash/system/tray/system_tray.h" | 22 #include "ash/system/tray/system_tray.h" |
| (...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1552 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1553 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 1553 wm::GetWindowState(window_two)->Restore(); | 1554 wm::GetWindowState(window_two)->Restore(); |
| 1554 | 1555 |
| 1555 // With the flag off, shelf no longer auto-hides. | 1556 // With the flag off, shelf no longer auto-hides. |
| 1556 widget_one->Activate(); | 1557 widget_one->Activate(); |
| 1557 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 1558 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 1558 wm::GetWindowState(window_two) | 1559 wm::GetWindowState(window_two) |
| 1559 ->set_autohide_shelf_when_maximized_or_fullscreen(false); | 1560 ->set_autohide_shelf_when_maximized_or_fullscreen(false); |
| 1560 widget_two->Activate(); | 1561 widget_two->Activate(); |
| 1561 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 1562 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 1563 |
| 1564 wm::GetWindowState(window_two) |
| 1565 ->set_autohide_shelf_when_maximized_or_fullscreen(true); |
| 1566 window_two->SetProperty(aura::client::kAlwaysOnTopKey, true); |
| 1567 |
| 1568 auto* shelf_window = shelf->GetWindow(); |
| 1569 aura::Window* container = shelf_window->GetRootWindow()->GetChildById( |
| 1570 kShellWindowId_AlwaysOnTopContainer); |
| 1571 auto iter = std::find(container->children().begin(), |
| 1572 container->children().end(), window_two); |
| 1573 EXPECT_NE(iter, container->children().end()); |
| 1574 |
| 1575 widget_two->Maximize(); |
| 1576 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 1577 |
| 1578 wm::WorkspaceWindowState window_state = |
| 1579 RootWindowController::ForWindow(shelf_window)->GetWorkspaceWindowState(); |
| 1580 EXPECT_EQ(wm::WORKSPACE_WINDOW_STATE_MAXIMIZED, window_state); |
| 1562 } | 1581 } |
| 1563 | 1582 |
| 1564 TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) { | 1583 TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) { |
| 1565 // TODO: investigate failure in mash, http://crbug.com/695686. | 1584 // TODO: investigate failure in mash, http://crbug.com/695686. |
| 1566 if (Shell::GetAshConfig() == Config::MASH) | 1585 if (Shell::GetAshConfig() == Config::MASH) |
| 1567 return; | 1586 return; |
| 1568 | 1587 |
| 1569 Shelf* shelf = GetPrimaryShelf(); | 1588 Shelf* shelf = GetPrimaryShelf(); |
| 1570 | 1589 |
| 1571 // Create a visible window so auto-hide behavior is enforced. | 1590 // Create a visible window so auto-hide behavior is enforced. |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 // Open keyboard in sticky mode. | 1893 // Open keyboard in sticky mode. |
| 1875 kb_controller->ShowKeyboard(true); | 1894 kb_controller->ShowKeyboard(true); |
| 1876 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); | 1895 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); |
| 1877 | 1896 |
| 1878 // Work area should be changed. | 1897 // Work area should be changed. |
| 1879 EXPECT_NE(orig_work_area, | 1898 EXPECT_NE(orig_work_area, |
| 1880 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | 1899 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); |
| 1881 } | 1900 } |
| 1882 | 1901 |
| 1883 } // namespace ash | 1902 } // namespace ash |
| OLD | NEW |