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 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 | 1047 |
1048 // Holding volume down and pressing power takes a screenshot. | 1048 // Holding volume down and pressing power takes a screenshot. |
1049 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); | 1049 ASSERT_EQ(0, delegate->handle_take_screenshot_count()); |
1050 PressVolumeDown(); | 1050 PressVolumeDown(); |
1051 PressPowerButton(); | 1051 PressPowerButton(); |
1052 ReleasePowerButton(); | 1052 ReleasePowerButton(); |
1053 ReleaseVolumeDown(); | 1053 ReleaseVolumeDown(); |
1054 EXPECT_EQ(1, delegate->handle_take_screenshot_count()); | 1054 EXPECT_EQ(1, delegate->handle_take_screenshot_count()); |
1055 } | 1055 } |
1056 | 1056 |
| 1057 // Tests that a lock action is cancellable when quick lock is turned on and |
| 1058 // maximize mode is not active. |
| 1059 TEST_F(LockStateControllerTest, QuickLockWhileNotInMaximizeMode) { |
| 1060 Initialize(false, LoginStatus::USER); |
| 1061 power_button_controller_->set_enable_quick_lock_for_test(true); |
| 1062 EnableMaximizeMode(false); |
| 1063 |
| 1064 PressPowerButton(); |
| 1065 |
| 1066 ExpectPreLockAnimationStarted(); |
| 1067 EXPECT_TRUE(test_api_->is_animating_lock()); |
| 1068 EXPECT_TRUE(lock_state_controller_->CanCancelLockAnimation()); |
| 1069 |
| 1070 ReleasePowerButton(); |
| 1071 |
| 1072 EXPECT_EQ(0, session_manager_client_->request_lock_screen_call_count()); |
| 1073 } |
| 1074 |
| 1075 // Tests that a lock action is not cancellable when quick lock is turned on and |
| 1076 // maximize mode is active. |
| 1077 TEST_F(LockStateControllerTest, QuickLockWhileInMaximizeMode) { |
| 1078 Initialize(false, LoginStatus::USER); |
| 1079 power_button_controller_->set_enable_quick_lock_for_test(true); |
| 1080 EnableMaximizeMode(true); |
| 1081 |
| 1082 PressPowerButton(); |
| 1083 |
| 1084 ExpectPreLockAnimationStarted(); |
| 1085 EXPECT_TRUE(test_api_->is_animating_lock()); |
| 1086 EXPECT_FALSE(lock_state_controller_->CanCancelLockAnimation()); |
| 1087 |
| 1088 ReleasePowerButton(); |
| 1089 |
| 1090 ExpectPreLockAnimationStarted(); |
| 1091 |
| 1092 test_animator_->CompleteAllAnimations(true); |
| 1093 EXPECT_EQ(1, session_manager_client_->request_lock_screen_call_count()); |
| 1094 } |
| 1095 |
1057 } // namespace test | 1096 } // namespace test |
1058 } // namespace ash | 1097 } // namespace ash |
OLD | NEW |