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