| 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/common/accelerators/accelerator_controller.h" |     5 #include "ash/common/accelerators/accelerator_controller.h" | 
|     6  |     6  | 
|     7 #include "ash/aura/wm_window_aura.h" |  | 
|     8 #include "ash/common/accelerators/accelerator_table.h" |     7 #include "ash/common/accelerators/accelerator_table.h" | 
|     9 #include "ash/common/accessibility_delegate.h" |     8 #include "ash/common/accessibility_delegate.h" | 
|    10 #include "ash/common/accessibility_types.h" |     9 #include "ash/common/accessibility_types.h" | 
|    11 #include "ash/common/ash_switches.h" |    10 #include "ash/common/ash_switches.h" | 
|    12 #include "ash/common/ime_control_delegate.h" |    11 #include "ash/common/ime_control_delegate.h" | 
|    13 #include "ash/common/session/session_state_delegate.h" |    12 #include "ash/common/session/session_state_delegate.h" | 
|    14 #include "ash/common/system/brightness_control_delegate.h" |    13 #include "ash/common/system/brightness_control_delegate.h" | 
|    15 #include "ash/common/system/keyboard_brightness_control_delegate.h" |    14 #include "ash/common/system/keyboard_brightness_control_delegate.h" | 
|    16 #include "ash/common/system/tray/system_tray_delegate.h" |    15 #include "ash/common/system/tray/system_tray_delegate.h" | 
|    17 #include "ash/common/test/test_shelf_delegate.h" |    16 #include "ash/common/test/test_shelf_delegate.h" | 
|    18 #include "ash/common/wm/panels/panel_layout_manager.h" |    17 #include "ash/common/wm/panels/panel_layout_manager.h" | 
|    19 #include "ash/common/wm/window_positioning_utils.h" |    18 #include "ash/common/wm/window_positioning_utils.h" | 
|    20 #include "ash/common/wm/window_state.h" |    19 #include "ash/common/wm/window_state.h" | 
|    21 #include "ash/common/wm/wm_event.h" |    20 #include "ash/common/wm/wm_event.h" | 
|    22 #include "ash/common/wm_shell.h" |    21 #include "ash/common/wm_shell.h" | 
 |    22 #include "ash/common/wm_window.h" | 
|    23 #include "ash/public/cpp/shell_window_ids.h" |    23 #include "ash/public/cpp/shell_window_ids.h" | 
|    24 #include "ash/shell.h" |    24 #include "ash/shell.h" | 
|    25 #include "ash/test/ash_test_base.h" |    25 #include "ash/test/ash_test_base.h" | 
|    26 #include "ash/test/lock_state_controller_test_api.h" |    26 #include "ash/test/lock_state_controller_test_api.h" | 
|    27 #include "ash/test/test_screenshot_delegate.h" |    27 #include "ash/test/test_screenshot_delegate.h" | 
|    28 #include "ash/test/test_session_state_animator.h" |    28 #include "ash/test/test_session_state_animator.h" | 
|    29 #include "ash/wm/lock_state_controller.h" |    29 #include "ash/wm/lock_state_controller.h" | 
|    30 #include "ash/wm/window_state_aura.h" |    30 #include "ash/wm/window_state_aura.h" | 
|    31 #include "ash/wm/window_util.h" |    31 #include "ash/wm/window_util.h" | 
|    32 #include "base/command_line.h" |    32 #include "base/command_line.h" | 
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   247   static bool is_ui_shown(ExitWarningHandler* ewh) { return !!ewh->widget_; } |   247   static bool is_ui_shown(ExitWarningHandler* ewh) { return !!ewh->widget_; } | 
|   248   static bool is_idle(ExitWarningHandler* ewh) { |   248   static bool is_idle(ExitWarningHandler* ewh) { | 
|   249     return ewh->state_ == ExitWarningHandler::IDLE; |   249     return ewh->state_ == ExitWarningHandler::IDLE; | 
|   250   } |   250   } | 
|   251   static bool is_exiting(ExitWarningHandler* ewh) { |   251   static bool is_exiting(ExitWarningHandler* ewh) { | 
|   252     return ewh->state_ == ExitWarningHandler::EXITING; |   252     return ewh->state_ == ExitWarningHandler::EXITING; | 
|   253   } |   253   } | 
|   254   aura::Window* CreatePanel() { |   254   aura::Window* CreatePanel() { | 
|   255     aura::Window* window = CreateTestWindowInShellWithDelegateAndType( |   255     aura::Window* window = CreateTestWindowInShellWithDelegateAndType( | 
|   256         NULL, ui::wm::WINDOW_TYPE_PANEL, 0, gfx::Rect(5, 5, 20, 20)); |   256         NULL, ui::wm::WINDOW_TYPE_PANEL, 0, gfx::Rect(5, 5, 20, 20)); | 
|   257     WmWindow* wm_window = WmWindowAura::Get(window); |   257     WmWindow* wm_window = WmWindow::Get(window); | 
|   258     test::TestShelfDelegate::instance()->AddShelfItem(wm_window); |   258     test::TestShelfDelegate::instance()->AddShelfItem(wm_window); | 
|   259     PanelLayoutManager::Get(wm_window)->Relayout(); |   259     PanelLayoutManager::Get(wm_window)->Relayout(); | 
|   260     return window; |   260     return window; | 
|   261   } |   261   } | 
|   262  |   262  | 
|   263   void SetBrightnessControlDelegate( |   263   void SetBrightnessControlDelegate( | 
|   264       std::unique_ptr<BrightnessControlDelegate> delegate) { |   264       std::unique_ptr<BrightnessControlDelegate> delegate) { | 
|   265     WmShell::Get()->brightness_control_delegate_ = std::move(delegate); |   265     WmShell::Get()->brightness_control_delegate_ = std::move(delegate); | 
|   266   } |   266   } | 
|   267  |   267  | 
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   427 TEST_F(AcceleratorControllerTest, WindowSnap) { |   427 TEST_F(AcceleratorControllerTest, WindowSnap) { | 
|   428   std::unique_ptr<aura::Window> window( |   428   std::unique_ptr<aura::Window> window( | 
|   429       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |   429       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 
|   430   wm::WindowState* window_state = wm::GetWindowState(window.get()); |   430   wm::WindowState* window_state = wm::GetWindowState(window.get()); | 
|   431  |   431  | 
|   432   window_state->Activate(); |   432   window_state->Activate(); | 
|   433  |   433  | 
|   434   { |   434   { | 
|   435     GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |   435     GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 
|   436     gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( |   436     gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( | 
|   437         WmWindowAura::Get(window.get())); |   437         WmWindow::Get(window.get())); | 
|   438     EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); |   438     EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); | 
|   439   } |   439   } | 
|   440   { |   440   { | 
|   441     GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |   441     GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 
|   442     gfx::Rect expected_bounds = wm::GetDefaultRightSnappedWindowBoundsInParent( |   442     gfx::Rect expected_bounds = wm::GetDefaultRightSnappedWindowBoundsInParent( | 
|   443         WmWindowAura::Get(window.get())); |   443         WmWindow::Get(window.get())); | 
|   444     EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); |   444     EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); | 
|   445   } |   445   } | 
|   446   { |   446   { | 
|   447     gfx::Rect normal_bounds = window_state->GetRestoreBoundsInParent(); |   447     gfx::Rect normal_bounds = window_state->GetRestoreBoundsInParent(); | 
|   448  |   448  | 
|   449     GetController()->PerformActionIfEnabled(TOGGLE_MAXIMIZED); |   449     GetController()->PerformActionIfEnabled(TOGGLE_MAXIMIZED); | 
|   450     EXPECT_TRUE(window_state->IsMaximized()); |   450     EXPECT_TRUE(window_state->IsMaximized()); | 
|   451     EXPECT_NE(normal_bounds.ToString(), window->bounds().ToString()); |   451     EXPECT_NE(normal_bounds.ToString(), window->bounds().ToString()); | 
|   452  |   452  | 
|   453     GetController()->PerformActionIfEnabled(TOGGLE_MAXIMIZED); |   453     GetController()->PerformActionIfEnabled(TOGGLE_MAXIMIZED); | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
|   484   std::unique_ptr<aura::Window> window( |   484   std::unique_ptr<aura::Window> window( | 
|   485       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |   485       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 
|   486  |   486  | 
|   487   wm::WindowState* window_state = wm::GetWindowState(window.get()); |   487   wm::WindowState* window_state = wm::GetWindowState(window.get()); | 
|   488   window_state->Activate(); |   488   window_state->Activate(); | 
|   489  |   489  | 
|   490   // Snap right. |   490   // Snap right. | 
|   491   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |   491   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 
|   492   gfx::Rect normal_bounds = window_state->GetRestoreBoundsInParent(); |   492   gfx::Rect normal_bounds = window_state->GetRestoreBoundsInParent(); | 
|   493   gfx::Rect expected_bounds = wm::GetDefaultRightSnappedWindowBoundsInParent( |   493   gfx::Rect expected_bounds = wm::GetDefaultRightSnappedWindowBoundsInParent( | 
|   494       WmWindowAura::Get(window.get())); |   494       WmWindow::Get(window.get())); | 
|   495   EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); |   495   EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); | 
|   496   EXPECT_TRUE(window_state->IsSnapped()); |   496   EXPECT_TRUE(window_state->IsSnapped()); | 
|   497   // Snap right again ->> becomes normal. |   497   // Snap right again ->> becomes normal. | 
|   498   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |   498   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 
|   499   EXPECT_TRUE(window_state->IsNormalStateType()); |   499   EXPECT_TRUE(window_state->IsNormalStateType()); | 
|   500   EXPECT_FALSE(window_state->IsDocked()); |   500   EXPECT_FALSE(window_state->IsDocked()); | 
|   501   EXPECT_EQ(normal_bounds.ToString(), window->bounds().ToString()); |   501   EXPECT_EQ(normal_bounds.ToString(), window->bounds().ToString()); | 
|   502   // Snap right. |   502   // Snap right. | 
|   503   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |   503   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 
|   504   EXPECT_TRUE(window_state->IsSnapped()); |   504   EXPECT_TRUE(window_state->IsSnapped()); | 
|   505   EXPECT_FALSE(window_state->IsDocked()); |   505   EXPECT_FALSE(window_state->IsDocked()); | 
|   506   // Snap left. |   506   // Snap left. | 
|   507   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |   507   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 
|   508   EXPECT_TRUE(window_state->IsSnapped()); |   508   EXPECT_TRUE(window_state->IsSnapped()); | 
|   509   EXPECT_FALSE(window_state->IsDocked()); |   509   EXPECT_FALSE(window_state->IsDocked()); | 
|   510   expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( |   510   expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( | 
|   511       WmWindowAura::Get(window.get())); |   511       WmWindow::Get(window.get())); | 
|   512   EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); |   512   EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString()); | 
|   513   // Snap left again ->> becomes normal. |   513   // Snap left again ->> becomes normal. | 
|   514   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |   514   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 
|   515   EXPECT_TRUE(window_state->IsNormalStateType()); |   515   EXPECT_TRUE(window_state->IsNormalStateType()); | 
|   516   EXPECT_FALSE(window_state->IsDocked()); |   516   EXPECT_FALSE(window_state->IsDocked()); | 
|   517   EXPECT_EQ(normal_bounds.ToString(), window->bounds().ToString()); |   517   EXPECT_EQ(normal_bounds.ToString(), window->bounds().ToString()); | 
|   518 } |   518 } | 
|   519  |   519  | 
|   520 // Test class used for testing docked windows. |   520 // Test class used for testing docked windows. | 
|   521 class EnabledDockedWindowsAcceleratorControllerTest |   521 class EnabledDockedWindowsAcceleratorControllerTest | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
|   539   std::unique_ptr<aura::Window> window0( |   539   std::unique_ptr<aura::Window> window0( | 
|   540       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |   540       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 
|   541   std::unique_ptr<aura::Window> window1( |   541   std::unique_ptr<aura::Window> window1( | 
|   542       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |   542       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 
|   543   wm::WindowState* window1_state = wm::GetWindowState(window1.get()); |   543   wm::WindowState* window1_state = wm::GetWindowState(window1.get()); | 
|   544   window1_state->Activate(); |   544   window1_state->Activate(); | 
|   545  |   545  | 
|   546   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |   546   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 
|   547   gfx::Rect normal_bounds = window1_state->GetRestoreBoundsInParent(); |   547   gfx::Rect normal_bounds = window1_state->GetRestoreBoundsInParent(); | 
|   548   gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( |   548   gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( | 
|   549       WmWindowAura::Get(window1.get())); |   549       WmWindow::Get(window1.get())); | 
|   550   EXPECT_EQ(expected_bounds.ToString(), window1->bounds().ToString()); |   550   EXPECT_EQ(expected_bounds.ToString(), window1->bounds().ToString()); | 
|   551   EXPECT_TRUE(window1_state->IsSnapped()); |   551   EXPECT_TRUE(window1_state->IsSnapped()); | 
|   552   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |   552   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 
|   553   EXPECT_FALSE(window1_state->IsNormalOrSnapped()); |   553   EXPECT_FALSE(window1_state->IsNormalOrSnapped()); | 
|   554   EXPECT_TRUE(window1_state->IsDocked()); |   554   EXPECT_TRUE(window1_state->IsDocked()); | 
|   555   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |   555   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 
|   556   EXPECT_FALSE(window1_state->IsDocked()); |   556   EXPECT_FALSE(window1_state->IsDocked()); | 
|   557   EXPECT_EQ(normal_bounds.ToString(), window1->bounds().ToString()); |   557   EXPECT_EQ(normal_bounds.ToString(), window1->bounds().ToString()); | 
|   558 } |   558 } | 
|   559  |   559  | 
|   560 TEST_F(EnabledDockedWindowsAcceleratorControllerTest, |   560 TEST_F(EnabledDockedWindowsAcceleratorControllerTest, | 
|   561        WindowSnapRightDockRightRestore) { |   561        WindowSnapRightDockRightRestore) { | 
|   562   std::unique_ptr<aura::Window> window0( |   562   std::unique_ptr<aura::Window> window0( | 
|   563       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |   563       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 
|   564   std::unique_ptr<aura::Window> window1( |   564   std::unique_ptr<aura::Window> window1( | 
|   565       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |   565       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 
|   566  |   566  | 
|   567   wm::WindowState* window1_state = wm::GetWindowState(window1.get()); |   567   wm::WindowState* window1_state = wm::GetWindowState(window1.get()); | 
|   568   window1_state->Activate(); |   568   window1_state->Activate(); | 
|   569  |   569  | 
|   570   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |   570   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 
|   571   gfx::Rect normal_bounds = window1_state->GetRestoreBoundsInParent(); |   571   gfx::Rect normal_bounds = window1_state->GetRestoreBoundsInParent(); | 
|   572   gfx::Rect expected_bounds = wm::GetDefaultRightSnappedWindowBoundsInParent( |   572   gfx::Rect expected_bounds = wm::GetDefaultRightSnappedWindowBoundsInParent( | 
|   573       WmWindowAura::Get(window1.get())); |   573       WmWindow::Get(window1.get())); | 
|   574   EXPECT_EQ(expected_bounds.ToString(), window1->bounds().ToString()); |   574   EXPECT_EQ(expected_bounds.ToString(), window1->bounds().ToString()); | 
|   575   EXPECT_TRUE(window1_state->IsSnapped()); |   575   EXPECT_TRUE(window1_state->IsSnapped()); | 
|   576   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |   576   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 
|   577   EXPECT_FALSE(window1_state->IsNormalOrSnapped()); |   577   EXPECT_FALSE(window1_state->IsNormalOrSnapped()); | 
|   578   EXPECT_TRUE(window1_state->IsDocked()); |   578   EXPECT_TRUE(window1_state->IsDocked()); | 
|   579   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |   579   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 
|   580   EXPECT_FALSE(window1_state->IsDocked()); |   580   EXPECT_FALSE(window1_state->IsDocked()); | 
|   581   EXPECT_EQ(normal_bounds.ToString(), window1->bounds().ToString()); |   581   EXPECT_EQ(normal_bounds.ToString(), window1->bounds().ToString()); | 
|   582 } |   582 } | 
|   583  |   583  | 
|   584 TEST_F(EnabledDockedWindowsAcceleratorControllerTest, |   584 TEST_F(EnabledDockedWindowsAcceleratorControllerTest, | 
|   585        WindowSnapLeftDockLeftSnapRight) { |   585        WindowSnapLeftDockLeftSnapRight) { | 
|   586   std::unique_ptr<aura::Window> window0( |   586   std::unique_ptr<aura::Window> window0( | 
|   587       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |   587       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 
|   588   std::unique_ptr<aura::Window> window1( |   588   std::unique_ptr<aura::Window> window1( | 
|   589       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |   589       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 
|   590  |   590  | 
|   591   wm::WindowState* window1_state = wm::GetWindowState(window1.get()); |   591   wm::WindowState* window1_state = wm::GetWindowState(window1.get()); | 
|   592   window1_state->Activate(); |   592   window1_state->Activate(); | 
|   593  |   593  | 
|   594   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |   594   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 
|   595   gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( |   595   gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( | 
|   596       WmWindowAura::Get(window1.get())); |   596       WmWindow::Get(window1.get())); | 
|   597   gfx::Rect expected_bounds2 = wm::GetDefaultRightSnappedWindowBoundsInParent( |   597   gfx::Rect expected_bounds2 = wm::GetDefaultRightSnappedWindowBoundsInParent( | 
|   598       WmWindowAura::Get(window1.get())); |   598       WmWindow::Get(window1.get())); | 
|   599   EXPECT_EQ(expected_bounds.ToString(), window1->bounds().ToString()); |   599   EXPECT_EQ(expected_bounds.ToString(), window1->bounds().ToString()); | 
|   600   EXPECT_TRUE(window1_state->IsSnapped()); |   600   EXPECT_TRUE(window1_state->IsSnapped()); | 
|   601   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |   601   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 
|   602   EXPECT_FALSE(window1_state->IsNormalOrSnapped()); |   602   EXPECT_FALSE(window1_state->IsNormalOrSnapped()); | 
|   603   EXPECT_TRUE(window1_state->IsDocked()); |   603   EXPECT_TRUE(window1_state->IsDocked()); | 
|   604   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |   604   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 
|   605   EXPECT_FALSE(window1_state->IsDocked()); |   605   EXPECT_FALSE(window1_state->IsDocked()); | 
|   606   EXPECT_TRUE(window1_state->IsSnapped()); |   606   EXPECT_TRUE(window1_state->IsSnapped()); | 
|   607   EXPECT_EQ(expected_bounds2.ToString(), window1->bounds().ToString()); |   607   EXPECT_EQ(expected_bounds2.ToString(), window1->bounds().ToString()); | 
|   608 } |   608 } | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   660   std::unique_ptr<aura::Window> window0( |   660   std::unique_ptr<aura::Window> window0( | 
|   661       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |   661       CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | 
|   662  |   662  | 
|   663   std::unique_ptr<aura::Window> window(CreatePanel()); |   663   std::unique_ptr<aura::Window> window(CreatePanel()); | 
|   664   wm::WindowState* window_state = wm::GetWindowState(window.get()); |   664   wm::WindowState* window_state = wm::GetWindowState(window.get()); | 
|   665   window_state->Activate(); |   665   window_state->Activate(); | 
|   666  |   666  | 
|   667   gfx::Rect window_restore_bounds2 = window->bounds(); |   667   gfx::Rect window_restore_bounds2 = window->bounds(); | 
|   668   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |   668   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 
|   669   gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( |   669   gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( | 
|   670       WmWindowAura::Get(window.get())); |   670       WmWindow::Get(window.get())); | 
|   671   gfx::Rect window_restore_bounds = window_state->GetRestoreBoundsInScreen(); |   671   gfx::Rect window_restore_bounds = window_state->GetRestoreBoundsInScreen(); | 
|   672   EXPECT_NE(expected_bounds.ToString(), window->bounds().ToString()); |   672   EXPECT_NE(expected_bounds.ToString(), window->bounds().ToString()); | 
|   673   EXPECT_FALSE(window_state->IsSnapped()); |   673   EXPECT_FALSE(window_state->IsSnapped()); | 
|   674   EXPECT_FALSE(window_state->IsNormalOrSnapped()); |   674   EXPECT_FALSE(window_state->IsNormalOrSnapped()); | 
|   675   EXPECT_TRUE(window_state->IsDocked()); |   675   EXPECT_TRUE(window_state->IsDocked()); | 
|   676   window_state->Restore(); |   676   window_state->Restore(); | 
|   677   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |   677   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 
|   678   EXPECT_TRUE(window_state->IsDocked()); |   678   EXPECT_TRUE(window_state->IsDocked()); | 
|   679   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |   679   GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 
|   680   EXPECT_FALSE(window_state->IsDocked()); |   680   EXPECT_FALSE(window_state->IsDocked()); | 
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1436     // Expect no notifications from the new accelerators. |  1436     // Expect no notifications from the new accelerators. | 
|  1437     EXPECT_TRUE(IsMessageCenterEmpty()); |  1437     EXPECT_TRUE(IsMessageCenterEmpty()); | 
|  1438  |  1438  | 
|  1439     // If the action is LOCK_SCREEN, we must reset the state by unlocking the |  1439     // If the action is LOCK_SCREEN, we must reset the state by unlocking the | 
|  1440     // screen before we proceed testing the rest of accelerators. |  1440     // screen before we proceed testing the rest of accelerators. | 
|  1441     ResetStateIfNeeded(); |  1441     ResetStateIfNeeded(); | 
|  1442   } |  1442   } | 
|  1443 } |  1443 } | 
|  1444  |  1444  | 
|  1445 }  // namespace ash |  1445 }  // namespace ash | 
| OLD | NEW |