| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/wm/lock_state_controller.h" | 5 #include "ash/wm/lock_state_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 | 1060 |
| 1061 // Holding volume down and pressing power takes a screenshot. | 1061 // Holding volume down and pressing power takes a screenshot. |
| 1062 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); | 1062 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); |
| 1063 PressVolumeDown(); | 1063 PressVolumeDown(); |
| 1064 PressPowerButton(); | 1064 PressPowerButton(); |
| 1065 ReleasePowerButton(); | 1065 ReleasePowerButton(); |
| 1066 ReleaseVolumeDown(); | 1066 ReleaseVolumeDown(); |
| 1067 EXPECT_EQ(1, delegate->handle_take_screenshot_count()); | 1067 EXPECT_EQ(1, delegate->handle_take_screenshot_count()); |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 // Tests that a lock action is cancellable when quick lock is turned on and | |
| 1071 // maximize mode is not active. | |
| 1072 TEST_F(LockStateControllerTest, QuickLockWhileNotInMaximizeMode) { | |
| 1073 Initialize(false, LoginStatus::USER); | |
| 1074 power_button_controller_->set_enable_quick_lock_for_test(true); | |
| 1075 EnableMaximizeMode(false); | |
| 1076 | |
| 1077 PressPowerButton(); | |
| 1078 | |
| 1079 ExpectPreLockAnimationStarted(); | |
| 1080 EXPECT_TRUE(test_api_->is_animating_lock()); | |
| 1081 EXPECT_TRUE(lock_state_controller_->CanCancelLockAnimation()); | |
| 1082 | |
| 1083 ReleasePowerButton(); | |
| 1084 | |
| 1085 EXPECT_EQ(0, session_manager_client_->request_lock_screen_call_count()); | |
| 1086 } | |
| 1087 | |
| 1088 // Tests that a lock action is not cancellable when quick lock is turned on and | |
| 1089 // maximize mode is active. | |
| 1090 TEST_F(LockStateControllerTest, QuickLockWhileInMaximizeMode) { | |
| 1091 Initialize(false, LoginStatus::USER); | |
| 1092 power_button_controller_->set_enable_quick_lock_for_test(true); | |
| 1093 EnableMaximizeMode(true); | |
| 1094 | |
| 1095 PressPowerButton(); | |
| 1096 | |
| 1097 ExpectPreLockAnimationStarted(); | |
| 1098 EXPECT_TRUE(test_api_->is_animating_lock()); | |
| 1099 EXPECT_FALSE(lock_state_controller_->CanCancelLockAnimation()); | |
| 1100 | |
| 1101 ReleasePowerButton(); | |
| 1102 | |
| 1103 ExpectPreLockAnimationStarted(); | |
| 1104 | |
| 1105 test_animator_->CompleteAllAnimations(true); | |
| 1106 EXPECT_EQ(1, session_manager_client_->request_lock_screen_call_count()); | |
| 1107 } | |
| 1108 | |
| 1109 } // namespace test | 1070 } // namespace test |
| 1110 } // namespace ash | 1071 } // namespace ash |
| OLD | NEW |