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

Side by Side Diff: ash/wm/lock_state_controller_unittest.cc

Issue 2504523002: [Reland-fixing asan failure] Tablet-like power button behavior on Convertible/Tablet ChromeOS devic… (Closed)
Patch Set: fix asan test failure 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« 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