| 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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 } | 639 } |
| 640 | 640 |
| 641 TEST_F(AcceleratorControllerTest, CenterWindowAccelerator) { | 641 TEST_F(AcceleratorControllerTest, CenterWindowAccelerator) { |
| 642 scoped_ptr<aura::Window> window( | 642 scoped_ptr<aura::Window> window( |
| 643 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 643 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
| 644 wm::WindowState* window_state = wm::GetWindowState(window.get()); | 644 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
| 645 window_state->Activate(); | 645 window_state->Activate(); |
| 646 | 646 |
| 647 // Center the window using accelerator. | 647 // Center the window using accelerator. |
| 648 GetController()->PerformActionIfEnabled(WINDOW_POSITION_CENTER); | 648 GetController()->PerformActionIfEnabled(WINDOW_POSITION_CENTER); |
| 649 gfx::Rect work_area = | 649 gfx::Rect work_area = gfx::Screen::GetScreen() |
| 650 Shell::GetScreen()->GetDisplayNearestWindow(window.get()).work_area(); | 650 ->GetDisplayNearestWindow(window.get()) |
| 651 .work_area(); |
| 651 gfx::Rect bounds = window->GetBoundsInScreen(); | 652 gfx::Rect bounds = window->GetBoundsInScreen(); |
| 652 EXPECT_NEAR(bounds.x() - work_area.x(), | 653 EXPECT_NEAR(bounds.x() - work_area.x(), |
| 653 work_area.right() - bounds.right(), | 654 work_area.right() - bounds.right(), |
| 654 1); | 655 1); |
| 655 EXPECT_NEAR(bounds.y() - work_area.y(), | 656 EXPECT_NEAR(bounds.y() - work_area.y(), |
| 656 work_area.bottom() - bounds.bottom(), | 657 work_area.bottom() - bounds.bottom(), |
| 657 1); | 658 1); |
| 658 | 659 |
| 659 // Add the window to docked container and try to center it. | 660 // Add the window to docked container and try to center it. |
| 660 window->SetBounds(gfx::Rect(0, 0, 20, 20)); | 661 window->SetBounds(gfx::Rect(0, 0, 20, 20)); |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1574 EXPECT_TRUE(IsMessageCenterEmpty()); | 1575 EXPECT_TRUE(IsMessageCenterEmpty()); |
| 1575 | 1576 |
| 1576 // If the action is LOCK_SCREEN, we must reset the state by unlocking the | 1577 // If the action is LOCK_SCREEN, we must reset the state by unlocking the |
| 1577 // screen before we proceed testing the rest of accelerators. | 1578 // screen before we proceed testing the rest of accelerators. |
| 1578 ResetStateIfNeeded(); | 1579 ResetStateIfNeeded(); |
| 1579 } | 1580 } |
| 1580 } | 1581 } |
| 1581 #endif // defined(OS_CHROMEOS) | 1582 #endif // defined(OS_CHROMEOS) |
| 1582 | 1583 |
| 1583 } // namespace ash | 1584 } // namespace ash |
| OLD | NEW |