| 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/accelerators/accelerator_controller.h" | 5 #include "ash/accelerators/accelerator_controller.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_table.h" | 7 #include "ash/accelerators/accelerator_table.h" |
| 8 #include "ash/accessibility_delegate.h" | 8 #include "ash/accessibility_delegate.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 18 matching lines...) Expand all Loading... |
| 29 #include "ash/wm/common/wm_event.h" | 29 #include "ash/wm/common/wm_event.h" |
| 30 #include "ash/wm/lock_state_controller.h" | 30 #include "ash/wm/lock_state_controller.h" |
| 31 #include "ash/wm/panels/panel_layout_manager.h" | 31 #include "ash/wm/panels/panel_layout_manager.h" |
| 32 #include "ash/wm/window_state_aura.h" | 32 #include "ash/wm/window_state_aura.h" |
| 33 #include "ash/wm/window_util.h" | 33 #include "ash/wm/window_util.h" |
| 34 #include "base/command_line.h" | 34 #include "base/command_line.h" |
| 35 #include "ui/aura/client/aura_constants.h" | 35 #include "ui/aura/client/aura_constants.h" |
| 36 #include "ui/aura/test/test_window_delegate.h" | 36 #include "ui/aura/test/test_window_delegate.h" |
| 37 #include "ui/aura/test/test_windows.h" | 37 #include "ui/aura/test/test_windows.h" |
| 38 #include "ui/aura/window.h" | 38 #include "ui/aura/window.h" |
| 39 #include "ui/display/screen.h" |
| 39 #include "ui/events/event.h" | 40 #include "ui/events/event.h" |
| 40 #include "ui/events/event_processor.h" | 41 #include "ui/events/event_processor.h" |
| 41 #include "ui/events/test/event_generator.h" | 42 #include "ui/events/test/event_generator.h" |
| 42 #include "ui/gfx/screen.h" | |
| 43 #include "ui/message_center/message_center.h" | 43 #include "ui/message_center/message_center.h" |
| 44 #include "ui/views/widget/widget.h" | 44 #include "ui/views/widget/widget.h" |
| 45 | 45 |
| 46 #if defined(USE_X11) | 46 #if defined(USE_X11) |
| 47 #include <X11/Xlib.h> | 47 #include <X11/Xlib.h> |
| 48 #include "ui/events/test/events_test_utils_x11.h" | 48 #include "ui/events/test/events_test_utils_x11.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 namespace ash { | 51 namespace ash { |
| 52 | 52 |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 } | 641 } |
| 642 | 642 |
| 643 TEST_F(AcceleratorControllerTest, CenterWindowAccelerator) { | 643 TEST_F(AcceleratorControllerTest, CenterWindowAccelerator) { |
| 644 std::unique_ptr<aura::Window> window( | 644 std::unique_ptr<aura::Window> window( |
| 645 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 645 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
| 646 wm::WindowState* window_state = wm::GetWindowState(window.get()); | 646 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
| 647 window_state->Activate(); | 647 window_state->Activate(); |
| 648 | 648 |
| 649 // Center the window using accelerator. | 649 // Center the window using accelerator. |
| 650 GetController()->PerformActionIfEnabled(WINDOW_POSITION_CENTER); | 650 GetController()->PerformActionIfEnabled(WINDOW_POSITION_CENTER); |
| 651 gfx::Rect work_area = gfx::Screen::GetScreen() | 651 gfx::Rect work_area = display::Screen::GetScreen() |
| 652 ->GetDisplayNearestWindow(window.get()) | 652 ->GetDisplayNearestWindow(window.get()) |
| 653 .work_area(); | 653 .work_area(); |
| 654 gfx::Rect bounds = window->GetBoundsInScreen(); | 654 gfx::Rect bounds = window->GetBoundsInScreen(); |
| 655 EXPECT_NEAR(bounds.x() - work_area.x(), | 655 EXPECT_NEAR(bounds.x() - work_area.x(), |
| 656 work_area.right() - bounds.right(), | 656 work_area.right() - bounds.right(), |
| 657 1); | 657 1); |
| 658 EXPECT_NEAR(bounds.y() - work_area.y(), | 658 EXPECT_NEAR(bounds.y() - work_area.y(), |
| 659 work_area.bottom() - bounds.bottom(), | 659 work_area.bottom() - bounds.bottom(), |
| 660 1); | 660 1); |
| 661 | 661 |
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 EXPECT_TRUE(IsMessageCenterEmpty()); | 1589 EXPECT_TRUE(IsMessageCenterEmpty()); |
| 1590 | 1590 |
| 1591 // If the action is LOCK_SCREEN, we must reset the state by unlocking the | 1591 // If the action is LOCK_SCREEN, we must reset the state by unlocking the |
| 1592 // screen before we proceed testing the rest of accelerators. | 1592 // screen before we proceed testing the rest of accelerators. |
| 1593 ResetStateIfNeeded(); | 1593 ResetStateIfNeeded(); |
| 1594 } | 1594 } |
| 1595 } | 1595 } |
| 1596 #endif // defined(OS_CHROMEOS) | 1596 #endif // defined(OS_CHROMEOS) |
| 1597 | 1597 |
| 1598 } // namespace ash | 1598 } // namespace ash |
| OLD | NEW |