Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Unified Diff: ash/wm/lock_state_controller_unittest.cc

Issue 2496043004: Revert of Tablet-like power button behavior on Convertible/Tablet ChromeOS devices (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/lock_state_controller.h ('k') | ash/wm/power_button_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/lock_state_controller_unittest.cc
diff --git a/ash/wm/lock_state_controller_unittest.cc b/ash/wm/lock_state_controller_unittest.cc
index 9eeb32014e44d2beeb45669c2f86a082735536a1..26479526f7cb47a91c229ddf6857001830761913 100644
--- a/ash/wm/lock_state_controller_unittest.cc
+++ b/ash/wm/lock_state_controller_unittest.cc
@@ -1054,5 +1054,44 @@
EXPECT_EQ(1, delegate->handle_take_screenshot_count());
}
+// Tests that a lock action is cancellable when quick lock is turned on and
+// maximize mode is not active.
+TEST_F(LockStateControllerTest, QuickLockWhileNotInMaximizeMode) {
+ Initialize(false, LoginStatus::USER);
+ power_button_controller_->set_enable_quick_lock_for_test(true);
+ EnableMaximizeMode(false);
+
+ PressPowerButton();
+
+ ExpectPreLockAnimationStarted();
+ EXPECT_TRUE(test_api_->is_animating_lock());
+ EXPECT_TRUE(lock_state_controller_->CanCancelLockAnimation());
+
+ ReleasePowerButton();
+
+ EXPECT_EQ(0, session_manager_client_->request_lock_screen_call_count());
+}
+
+// Tests that a lock action is not cancellable when quick lock is turned on and
+// maximize mode is active.
+TEST_F(LockStateControllerTest, QuickLockWhileInMaximizeMode) {
+ Initialize(false, LoginStatus::USER);
+ power_button_controller_->set_enable_quick_lock_for_test(true);
+ EnableMaximizeMode(true);
+
+ PressPowerButton();
+
+ ExpectPreLockAnimationStarted();
+ EXPECT_TRUE(test_api_->is_animating_lock());
+ EXPECT_FALSE(lock_state_controller_->CanCancelLockAnimation());
+
+ ReleasePowerButton();
+
+ ExpectPreLockAnimationStarted();
+
+ test_animator_->CompleteAllAnimations(true);
+ EXPECT_EQ(1, session_manager_client_->request_lock_screen_call_count());
+}
+
} // namespace test
} // namespace ash
« no previous file with comments | « ash/wm/lock_state_controller.h ('k') | ash/wm/power_button_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698