| 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/aura/wm_window_aura.h" |
| 9 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| 10 #include "ash/common/focus_cycler.h" | 11 #include "ash/common/focus_cycler.h" |
| 11 #include "ash/common/session/session_state_delegate.h" | 12 #include "ash/common/session/session_state_delegate.h" |
| 12 #include "ash/common/shelf/shelf_constants.h" | 13 #include "ash/common/shelf/shelf_constants.h" |
| 13 #include "ash/common/shell_window_ids.h" | 14 #include "ash/common/shell_window_ids.h" |
| 14 #include "ash/common/system/tray/system_tray_item.h" | 15 #include "ash/common/system/tray/system_tray_item.h" |
| 15 #include "ash/common/wm/window_state.h" | 16 #include "ash/common/wm/window_state.h" |
| 16 #include "ash/common/wm_shell.h" | 17 #include "ash/common/wm_shell.h" |
| 17 #include "ash/display/display_manager.h" | 18 #include "ash/display/display_manager.h" |
| 18 #include "ash/display/window_tree_host_manager.h" | 19 #include "ash/display/window_tree_host_manager.h" |
| (...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 EXPECT_EQ(root_windows[0], window1->GetRootWindow()); | 1656 EXPECT_EQ(root_windows[0], window1->GetRootWindow()); |
| 1656 EXPECT_EQ(root_windows[1], window2->GetRootWindow()); | 1657 EXPECT_EQ(root_windows[1], window2->GetRootWindow()); |
| 1657 | 1658 |
| 1658 wm::GetWindowState(window2)->Activate(); | 1659 wm::GetWindowState(window2)->Activate(); |
| 1659 EXPECT_EQ(SHELF_HIDDEN, | 1660 EXPECT_EQ(SHELF_HIDDEN, |
| 1660 root_window_controllers[0]->GetShelfLayoutManager()->visibility_state()); | 1661 root_window_controllers[0]->GetShelfLayoutManager()->visibility_state()); |
| 1661 EXPECT_EQ(SHELF_VISIBLE, | 1662 EXPECT_EQ(SHELF_VISIBLE, |
| 1662 root_window_controllers[1]->GetShelfLayoutManager()->visibility_state()); | 1663 root_window_controllers[1]->GetShelfLayoutManager()->visibility_state()); |
| 1663 } | 1664 } |
| 1664 | 1665 |
| 1666 // Test for Pinned mode. |
| 1667 TEST_F(ShelfLayoutManagerTest, PinnedWindowHidesShelf) { |
| 1668 Shelf* shelf = GetShelf(); |
| 1669 |
| 1670 aura::Window* window1 = CreateTestWindow(); |
| 1671 window1->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1672 window1->Show(); |
| 1673 |
| 1674 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 1675 |
| 1676 wm::PinWindow(window1); |
| 1677 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); |
| 1678 |
| 1679 WmWindowAura::Get(window1)->GetWindowState()->Restore(); |
| 1680 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 1681 } |
| 1665 | 1682 |
| 1666 #if defined(OS_WIN) | 1683 #if defined(OS_WIN) |
| 1667 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 | 1684 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 |
| 1668 #define MAYBE_SetAlignment DISABLED_SetAlignment | 1685 #define MAYBE_SetAlignment DISABLED_SetAlignment |
| 1669 #else | 1686 #else |
| 1670 #define MAYBE_SetAlignment SetAlignment | 1687 #define MAYBE_SetAlignment SetAlignment |
| 1671 #endif | 1688 #endif |
| 1672 | 1689 |
| 1673 // Tests SHELF_ALIGNMENT_(LEFT, RIGHT). | 1690 // Tests SHELF_ALIGNMENT_(LEFT, RIGHT). |
| 1674 TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { | 1691 TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2294 ->shelf_widget() | 2311 ->shelf_widget() |
| 2295 ->status_area_widget(); | 2312 ->status_area_widget(); |
| 2296 EXPECT_TRUE(status_area_widget->IsVisible()); | 2313 EXPECT_TRUE(status_area_widget->IsVisible()); |
| 2297 // Shelf should be in the first display's area. | 2314 // Shelf should be in the first display's area. |
| 2298 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); | 2315 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); |
| 2299 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); | 2316 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); |
| 2300 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); | 2317 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); |
| 2301 } | 2318 } |
| 2302 | 2319 |
| 2303 } // namespace ash | 2320 } // namespace ash |
| OLD | NEW |