| 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" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/accelerators/accelerator_table.h" | 8 #include "ash/common/accelerators/accelerator_table.h" |
| 9 #include "ash/common/accessibility_delegate.h" | 9 #include "ash/common/accessibility_delegate.h" |
| 10 #include "ash/common/accessibility_types.h" | 10 #include "ash/common/accessibility_types.h" |
| 11 #include "ash/common/ime_control_delegate.h" | 11 #include "ash/common/ime_control_delegate.h" |
| 12 #include "ash/common/session/session_state_delegate.h" | 12 #include "ash/common/session/session_state_delegate.h" |
| 13 #include "ash/common/system/brightness_control_delegate.h" | 13 #include "ash/common/system/brightness_control_delegate.h" |
| 14 #include "ash/common/system/keyboard_brightness_control_delegate.h" | 14 #include "ash/common/system/keyboard_brightness_control_delegate.h" |
| 15 #include "ash/common/system/tray/system_tray_delegate.h" | 15 #include "ash/common/system/tray/system_tray_delegate.h" |
| 16 #include "ash/common/test/test_shelf_delegate.h" | 16 #include "ash/common/test/test_shelf_delegate.h" |
| 17 #include "ash/common/wm/panels/panel_layout_manager.h" | 17 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 18 #include "ash/common/wm/window_positioning_utils.h" | 18 #include "ash/common/wm/window_positioning_utils.h" |
| 19 #include "ash/common/wm/window_state.h" | 19 #include "ash/common/wm/window_state.h" |
| 20 #include "ash/common/wm/wm_event.h" | 20 #include "ash/common/wm/wm_event.h" |
| 21 #include "ash/common/wm_shell.h" | 21 #include "ash/common/wm_shell.h" |
| 22 #include "ash/public/cpp/shell_window_ids.h" | 22 #include "ash/public/cpp/shell_window_ids.h" |
| 23 #include "ash/shell.h" | 23 #include "ash/shell.h" |
| 24 #include "ash/test/ash_test_base.h" | 24 #include "ash/test/ash_test_base.h" |
| 25 #include "ash/test/lock_state_controller_test_api.h" |
| 25 #include "ash/test/test_screenshot_delegate.h" | 26 #include "ash/test/test_screenshot_delegate.h" |
| 26 #include "ash/test/test_session_state_animator.h" | 27 #include "ash/test/test_session_state_animator.h" |
| 27 #include "ash/wm/lock_state_controller.h" | 28 #include "ash/wm/lock_state_controller.h" |
| 28 #include "ash/wm/window_state_aura.h" | 29 #include "ash/wm/window_state_aura.h" |
| 29 #include "ash/wm/window_util.h" | 30 #include "ash/wm/window_util.h" |
| 30 #include "base/test/user_action_tester.cc" | 31 #include "base/test/user_action_tester.cc" |
| 31 #include "ui/aura/client/aura_constants.h" | 32 #include "ui/aura/client/aura_constants.h" |
| 32 #include "ui/aura/test/test_window_delegate.h" | 33 #include "ui/aura/test/test_window_delegate.h" |
| 33 #include "ui/aura/test/test_windows.h" | 34 #include "ui/aura/test/test_windows.h" |
| 34 #include "ui/aura/window.h" | 35 #include "ui/aura/window.h" |
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 wm::ActivateWindow(w1); | 1108 wm::ActivateWindow(w1); |
| 1108 | 1109 |
| 1109 wm::WMEvent fullscreen(wm::WM_EVENT_FULLSCREEN); | 1110 wm::WMEvent fullscreen(wm::WM_EVENT_FULLSCREEN); |
| 1110 wm::WindowState* w1_state = wm::GetWindowState(w1); | 1111 wm::WindowState* w1_state = wm::GetWindowState(w1); |
| 1111 w1_state->OnWMEvent(&fullscreen); | 1112 w1_state->OnWMEvent(&fullscreen); |
| 1112 ASSERT_TRUE(w1_state->IsFullscreen()); | 1113 ASSERT_TRUE(w1_state->IsFullscreen()); |
| 1113 | 1114 |
| 1114 ui::test::EventGenerator& generator = GetEventGenerator(); | 1115 ui::test::EventGenerator& generator = GetEventGenerator(); |
| 1115 #if defined(OS_CHROMEOS) | 1116 #if defined(OS_CHROMEOS) |
| 1116 // Power key (reserved) should always be handled. | 1117 // Power key (reserved) should always be handled. |
| 1117 LockStateController::TestApi test_api( | 1118 test::LockStateControllerTestApi test_api( |
| 1118 Shell::GetInstance()->lock_state_controller()); | 1119 Shell::GetInstance()->lock_state_controller()); |
| 1119 EXPECT_FALSE(test_api.is_animating_lock()); | 1120 EXPECT_FALSE(test_api.is_animating_lock()); |
| 1120 generator.PressKey(ui::VKEY_POWER, ui::EF_NONE); | 1121 generator.PressKey(ui::VKEY_POWER, ui::EF_NONE); |
| 1121 EXPECT_TRUE(test_api.is_animating_lock()); | 1122 EXPECT_TRUE(test_api.is_animating_lock()); |
| 1122 #endif | 1123 #endif |
| 1123 | 1124 |
| 1124 auto press_and_release_alt_tab = [&generator]() { | 1125 auto press_and_release_alt_tab = [&generator]() { |
| 1125 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); | 1126 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); |
| 1126 // Release the alt key to trigger the window activation. | 1127 // Release the alt key to trigger the window activation. |
| 1127 generator.ReleaseKey(ui::VKEY_MENU, ui::EF_NONE); | 1128 generator.ReleaseKey(ui::VKEY_MENU, ui::EF_NONE); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1157 { | 1158 { |
| 1158 wm::WMEvent pin_event(wm::WM_EVENT_PIN); | 1159 wm::WMEvent pin_event(wm::WM_EVENT_PIN); |
| 1159 wm::WindowState* w1_state = wm::GetWindowState(w1); | 1160 wm::WindowState* w1_state = wm::GetWindowState(w1); |
| 1160 w1_state->OnWMEvent(&pin_event); | 1161 w1_state->OnWMEvent(&pin_event); |
| 1161 ASSERT_TRUE(w1_state->IsPinned()); | 1162 ASSERT_TRUE(w1_state->IsPinned()); |
| 1162 } | 1163 } |
| 1163 | 1164 |
| 1164 ui::test::EventGenerator& generator = GetEventGenerator(); | 1165 ui::test::EventGenerator& generator = GetEventGenerator(); |
| 1165 #if defined(OS_CHROMEOS) | 1166 #if defined(OS_CHROMEOS) |
| 1166 // Power key (reserved) should always be handled. | 1167 // Power key (reserved) should always be handled. |
| 1167 LockStateController::TestApi test_api( | 1168 test::LockStateControllerTestApi test_api( |
| 1168 Shell::GetInstance()->lock_state_controller()); | 1169 Shell::GetInstance()->lock_state_controller()); |
| 1169 EXPECT_FALSE(test_api.is_animating_lock()); | 1170 EXPECT_FALSE(test_api.is_animating_lock()); |
| 1170 generator.PressKey(ui::VKEY_POWER, ui::EF_NONE); | 1171 generator.PressKey(ui::VKEY_POWER, ui::EF_NONE); |
| 1171 EXPECT_TRUE(test_api.is_animating_lock()); | 1172 EXPECT_TRUE(test_api.is_animating_lock()); |
| 1172 #endif | 1173 #endif |
| 1173 | 1174 |
| 1174 // A pinned window can consume ALT-TAB (preferred), but no side effect. | 1175 // A pinned window can consume ALT-TAB (preferred), but no side effect. |
| 1175 ASSERT_EQ(w1, wm::GetActiveWindow()); | 1176 ASSERT_EQ(w1, wm::GetActiveWindow()); |
| 1176 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); | 1177 generator.PressKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); |
| 1177 generator.ReleaseKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); | 1178 generator.ReleaseKey(ui::VKEY_TAB, ui::EF_ALT_DOWN); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 EXPECT_TRUE(IsMessageCenterEmpty()); | 1411 EXPECT_TRUE(IsMessageCenterEmpty()); |
| 1411 | 1412 |
| 1412 // If the action is LOCK_SCREEN, we must reset the state by unlocking the | 1413 // If the action is LOCK_SCREEN, we must reset the state by unlocking the |
| 1413 // screen before we proceed testing the rest of accelerators. | 1414 // screen before we proceed testing the rest of accelerators. |
| 1414 ResetStateIfNeeded(); | 1415 ResetStateIfNeeded(); |
| 1415 } | 1416 } |
| 1416 } | 1417 } |
| 1417 #endif // defined(OS_CHROMEOS) | 1418 #endif // defined(OS_CHROMEOS) |
| 1418 | 1419 |
| 1419 } // namespace ash | 1420 } // namespace ash |
| OLD | NEW |