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