| 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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 gfx::Rect bounds = window->GetBoundsInScreen(); | 646 gfx::Rect bounds = window->GetBoundsInScreen(); |
| 647 EXPECT_NEAR(bounds.x() - work_area.x(), | 647 EXPECT_NEAR(bounds.x() - work_area.x(), |
| 648 work_area.right() - bounds.right(), | 648 work_area.right() - bounds.right(), |
| 649 1); | 649 1); |
| 650 EXPECT_NEAR(bounds.y() - work_area.y(), | 650 EXPECT_NEAR(bounds.y() - work_area.y(), |
| 651 work_area.bottom() - bounds.bottom(), | 651 work_area.bottom() - bounds.bottom(), |
| 652 1); | 652 1); |
| 653 | 653 |
| 654 // Add the window to docked container and try to center it. | 654 // Add the window to docked container and try to center it. |
| 655 window->SetBounds(gfx::Rect(0, 0, 20, 20)); | 655 window->SetBounds(gfx::Rect(0, 0, 20, 20)); |
| 656 aura::Window* docked_container = Shell::GetContainer( | 656 const wm::WMEvent event(wm::WM_EVENT_DOCK); |
| 657 window->GetRootWindow(), kShellWindowId_DockedContainer); | 657 wm::GetWindowState(window.get())->OnWMEvent(&event); |
| 658 docked_container->AddChild(window.get()); | 658 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); |
| 659 |
| 659 gfx::Rect docked_bounds = window->GetBoundsInScreen(); | 660 gfx::Rect docked_bounds = window->GetBoundsInScreen(); |
| 660 GetController()->PerformActionIfEnabled(WINDOW_POSITION_CENTER); | 661 GetController()->PerformActionIfEnabled(WINDOW_POSITION_CENTER); |
| 661 // It should not get centered and should remain docked. | 662 // It should not get centered and should remain docked. |
| 662 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); | 663 EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); |
| 663 EXPECT_EQ(docked_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 664 EXPECT_EQ(docked_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
| 664 } | 665 } |
| 665 | 666 |
| 666 TEST_F(AcceleratorControllerTest, AutoRepeat) { | 667 TEST_F(AcceleratorControllerTest, AutoRepeat) { |
| 667 ui::Accelerator accelerator_a(ui::VKEY_A, ui::EF_CONTROL_DOWN); | 668 ui::Accelerator accelerator_a(ui::VKEY_A, ui::EF_CONTROL_DOWN); |
| 668 accelerator_a.set_type(ui::ET_KEY_PRESSED); | 669 accelerator_a.set_type(ui::ET_KEY_PRESSED); |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 wm::ActivateWindow(window.get()); | 1408 wm::ActivateWindow(window.get()); |
| 1408 GetController()->PerformActionIfEnabled(WINDOW_MINIMIZE); | 1409 GetController()->PerformActionIfEnabled(WINDOW_MINIMIZE); |
| 1409 delegate->TriggerAccessibilityAlert(ui::A11Y_ALERT_NONE); | 1410 delegate->TriggerAccessibilityAlert(ui::A11Y_ALERT_NONE); |
| 1410 GetController()->PerformActionIfEnabled(kActionsNeedingWindow[i]); | 1411 GetController()->PerformActionIfEnabled(kActionsNeedingWindow[i]); |
| 1411 EXPECT_NE(delegate->GetLastAccessibilityAlert(), | 1412 EXPECT_NE(delegate->GetLastAccessibilityAlert(), |
| 1412 ui::A11Y_ALERT_WINDOW_NEEDED); | 1413 ui::A11Y_ALERT_WINDOW_NEEDED); |
| 1413 } | 1414 } |
| 1414 } | 1415 } |
| 1415 | 1416 |
| 1416 } // namespace ash | 1417 } // namespace ash |
| OLD | NEW |