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

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

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months 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.cc ('k') | ash/wm/lock_window_state.cc » ('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 27 matching lines...) Expand all
38 38
39 void CheckCalledCallback(bool* flag) { 39 void CheckCalledCallback(bool* flag) {
40 if (flag) 40 if (flag)
41 (*flag) = true; 41 (*flag) = true;
42 } 42 }
43 43
44 } // namespace 44 } // namespace
45 45
46 class LockStateControllerTest : public AshTestBase { 46 class LockStateControllerTest : public AshTestBase {
47 public: 47 public:
48 LockStateControllerTest() : power_button_controller_(NULL), 48 LockStateControllerTest()
49 lock_state_controller_(NULL), 49 : power_button_controller_(NULL),
50 lock_state_controller_delegate_(NULL), 50 lock_state_controller_(NULL),
51 test_animator_(NULL) { 51 lock_state_controller_delegate_(NULL),
52 } 52 test_animator_(NULL) {}
53 ~LockStateControllerTest() override {} 53 ~LockStateControllerTest() override {}
54 54
55 void SetUp() override { 55 void SetUp() override {
56 AshTestBase::SetUp(); 56 AshTestBase::SetUp();
57 57
58 std::unique_ptr<LockStateControllerDelegate> lock_state_controller_delegate( 58 std::unique_ptr<LockStateControllerDelegate> lock_state_controller_delegate(
59 lock_state_controller_delegate_ = new TestLockStateControllerDelegate); 59 lock_state_controller_delegate_ = new TestLockStateControllerDelegate);
60 test_animator_ = new TestSessionStateAnimator; 60 test_animator_ = new TestSessionStateAnimator;
61 61
62 lock_state_controller_ = Shell::GetInstance()->lock_state_controller(); 62 lock_state_controller_ = Shell::GetInstance()->lock_state_controller();
(...skipping 11 matching lines...) Expand all
74 } 74 }
75 75
76 protected: 76 protected:
77 void GenerateMouseMoveEvent() { 77 void GenerateMouseMoveEvent() {
78 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); 78 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
79 generator.MoveMouseTo(10, 10); 79 generator.MoveMouseTo(10, 10);
80 } 80 }
81 81
82 int NumShutdownRequests() { 82 int NumShutdownRequests() {
83 return lock_state_controller_delegate_->num_shutdown_requests() + 83 return lock_state_controller_delegate_->num_shutdown_requests() +
84 shell_delegate_->num_exit_requests(); 84 shell_delegate_->num_exit_requests();
85 } 85 }
86 86
87 void Advance(SessionStateAnimator::AnimationSpeed speed) { 87 void Advance(SessionStateAnimator::AnimationSpeed speed) {
88 test_animator_->Advance(test_animator_->GetDuration(speed)); 88 test_animator_->Advance(test_animator_->GetDuration(speed));
89 } 89 }
90 90
91 void AdvancePartially(SessionStateAnimator::AnimationSpeed speed, 91 void AdvancePartially(SessionStateAnimator::AnimationSpeed speed,
92 float factor) { 92 float factor) {
93 base::TimeDelta duration = test_animator_->GetDuration(speed); 93 base::TimeDelta duration = test_animator_->GetDuration(speed);
94 base::TimeDelta partial_duration = 94 base::TimeDelta partial_duration =
95 base::TimeDelta::FromInternalValue(duration.ToInternalValue() * factor); 95 base::TimeDelta::FromInternalValue(duration.ToInternalValue() * factor);
96 test_animator_->Advance(partial_duration); 96 test_animator_->Advance(partial_duration);
97 } 97 }
98 98
99 void ExpectPreLockAnimationStarted() { 99 void ExpectPreLockAnimationStarted() {
100 SCOPED_TRACE("Failure in ExpectPreLockAnimationStarted"); 100 SCOPED_TRACE("Failure in ExpectPreLockAnimationStarted");
101 EXPECT_LT(0u, test_animator_->GetAnimationCount()); 101 EXPECT_LT(0u, test_animator_->GetAnimationCount());
102 EXPECT_TRUE( 102 EXPECT_TRUE(test_animator_->AreContainersAnimated(
103 test_animator_->AreContainersAnimated( 103 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
104 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 104 SessionStateAnimator::ANIMATION_LIFT));
105 SessionStateAnimator::ANIMATION_LIFT)); 105 EXPECT_TRUE(test_animator_->AreContainersAnimated(
106 EXPECT_TRUE( 106 SessionStateAnimator::LAUNCHER,
107 test_animator_->AreContainersAnimated( 107 SessionStateAnimator::ANIMATION_FADE_OUT));
108 SessionStateAnimator::LAUNCHER, 108 EXPECT_TRUE(test_animator_->AreContainersAnimated(
109 SessionStateAnimator::ANIMATION_FADE_OUT)); 109 SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
110 EXPECT_TRUE( 110 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
111 test_animator_->AreContainersAnimated(
112 SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
113 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
114 EXPECT_TRUE(test_api_->is_animating_lock()); 111 EXPECT_TRUE(test_api_->is_animating_lock());
115 } 112 }
116 113
117 void ExpectPreLockAnimationRunning() { 114 void ExpectPreLockAnimationRunning() {
118 SCOPED_TRACE("Failure in ExpectPreLockAnimationRunning"); 115 SCOPED_TRACE("Failure in ExpectPreLockAnimationRunning");
119 EXPECT_LT(0u, test_animator_->GetAnimationCount()); 116 EXPECT_LT(0u, test_animator_->GetAnimationCount());
120 EXPECT_TRUE( 117 EXPECT_TRUE(test_animator_->AreContainersAnimated(
121 test_animator_->AreContainersAnimated( 118 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
122 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 119 SessionStateAnimator::ANIMATION_LIFT));
123 SessionStateAnimator::ANIMATION_LIFT)); 120 EXPECT_TRUE(test_animator_->AreContainersAnimated(
124 EXPECT_TRUE( 121 SessionStateAnimator::LAUNCHER,
125 test_animator_->AreContainersAnimated( 122 SessionStateAnimator::ANIMATION_FADE_OUT));
126 SessionStateAnimator::LAUNCHER,
127 SessionStateAnimator::ANIMATION_FADE_OUT));
128 EXPECT_TRUE(test_api_->is_animating_lock()); 123 EXPECT_TRUE(test_api_->is_animating_lock());
129 } 124 }
130 125
131 void ExpectPreLockAnimationCancel() { 126 void ExpectPreLockAnimationCancel() {
132 SCOPED_TRACE("Failure in ExpectPreLockAnimationCancel"); 127 SCOPED_TRACE("Failure in ExpectPreLockAnimationCancel");
133 EXPECT_LT(0u, test_animator_->GetAnimationCount()); 128 EXPECT_LT(0u, test_animator_->GetAnimationCount());
134 EXPECT_TRUE( 129 EXPECT_TRUE(test_animator_->AreContainersAnimated(
135 test_animator_->AreContainersAnimated( 130 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
136 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 131 SessionStateAnimator::ANIMATION_UNDO_LIFT));
137 SessionStateAnimator::ANIMATION_UNDO_LIFT)); 132 EXPECT_TRUE(test_animator_->AreContainersAnimated(
138 EXPECT_TRUE( 133 SessionStateAnimator::LAUNCHER,
139 test_animator_->AreContainersAnimated( 134 SessionStateAnimator::ANIMATION_FADE_IN));
140 SessionStateAnimator::LAUNCHER,
141 SessionStateAnimator::ANIMATION_FADE_IN));
142 } 135 }
143 136
144 void ExpectPreLockAnimationFinished() { 137 void ExpectPreLockAnimationFinished() {
145 SCOPED_TRACE("Failure in ExpectPreLockAnimationFinished"); 138 SCOPED_TRACE("Failure in ExpectPreLockAnimationFinished");
146 EXPECT_FALSE( 139 EXPECT_FALSE(test_animator_->AreContainersAnimated(
147 test_animator_->AreContainersAnimated( 140 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
148 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 141 SessionStateAnimator::ANIMATION_LIFT));
149 SessionStateAnimator::ANIMATION_LIFT)); 142 EXPECT_FALSE(test_animator_->AreContainersAnimated(
150 EXPECT_FALSE( 143 SessionStateAnimator::LAUNCHER,
151 test_animator_->AreContainersAnimated( 144 SessionStateAnimator::ANIMATION_FADE_OUT));
152 SessionStateAnimator::LAUNCHER, 145 EXPECT_FALSE(test_animator_->AreContainersAnimated(
153 SessionStateAnimator::ANIMATION_FADE_OUT)); 146 SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
154 EXPECT_FALSE( 147 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
155 test_animator_->AreContainersAnimated(
156 SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
157 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
158 } 148 }
159 149
160 void ExpectPostLockAnimationStarted() { 150 void ExpectPostLockAnimationStarted() {
161 SCOPED_TRACE("Failure in ExpectPostLockAnimationStarted"); 151 SCOPED_TRACE("Failure in ExpectPostLockAnimationStarted");
162 EXPECT_LT(0u, test_animator_->GetAnimationCount()); 152 EXPECT_LT(0u, test_animator_->GetAnimationCount());
163 EXPECT_TRUE( 153 EXPECT_TRUE(test_animator_->AreContainersAnimated(
164 test_animator_->AreContainersAnimated( 154 SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
165 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, 155 SessionStateAnimator::ANIMATION_RAISE_TO_SCREEN));
166 SessionStateAnimator::ANIMATION_RAISE_TO_SCREEN));
167 } 156 }
168 157
169 void ExpectPostLockAnimationFinished() { 158 void ExpectPostLockAnimationFinished() {
170 SCOPED_TRACE("Failure in ExpectPostLockAnimationFinished"); 159 SCOPED_TRACE("Failure in ExpectPostLockAnimationFinished");
171 EXPECT_FALSE( 160 EXPECT_FALSE(test_animator_->AreContainersAnimated(
172 test_animator_->AreContainersAnimated( 161 SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
173 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, 162 SessionStateAnimator::ANIMATION_RAISE_TO_SCREEN));
174 SessionStateAnimator::ANIMATION_RAISE_TO_SCREEN));
175 } 163 }
176 164
177 void ExpectUnlockBeforeUIDestroyedAnimationStarted() { 165 void ExpectUnlockBeforeUIDestroyedAnimationStarted() {
178 SCOPED_TRACE("Failure in ExpectUnlockBeforeUIDestroyedAnimationStarted"); 166 SCOPED_TRACE("Failure in ExpectUnlockBeforeUIDestroyedAnimationStarted");
179 EXPECT_LT(0u, test_animator_->GetAnimationCount()); 167 EXPECT_LT(0u, test_animator_->GetAnimationCount());
180 EXPECT_TRUE( 168 EXPECT_TRUE(test_animator_->AreContainersAnimated(
181 test_animator_->AreContainersAnimated( 169 SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
182 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, 170 SessionStateAnimator::ANIMATION_LIFT));
183 SessionStateAnimator::ANIMATION_LIFT));
184 } 171 }
185 172
186 void ExpectUnlockBeforeUIDestroyedAnimationFinished() { 173 void ExpectUnlockBeforeUIDestroyedAnimationFinished() {
187 SCOPED_TRACE("Failure in ExpectUnlockBeforeUIDestroyedAnimationFinished"); 174 SCOPED_TRACE("Failure in ExpectUnlockBeforeUIDestroyedAnimationFinished");
188 EXPECT_FALSE( 175 EXPECT_FALSE(test_animator_->AreContainersAnimated(
189 test_animator_->AreContainersAnimated( 176 SessionStateAnimator::LOCK_SCREEN_CONTAINERS,
190 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, 177 SessionStateAnimator::ANIMATION_LIFT));
191 SessionStateAnimator::ANIMATION_LIFT));
192 } 178 }
193 179
194 void ExpectUnlockAfterUIDestroyedAnimationStarted() { 180 void ExpectUnlockAfterUIDestroyedAnimationStarted() {
195 SCOPED_TRACE("Failure in ExpectUnlockAfterUIDestroyedAnimationStarted"); 181 SCOPED_TRACE("Failure in ExpectUnlockAfterUIDestroyedAnimationStarted");
196 EXPECT_LT(0u, test_animator_->GetAnimationCount()); 182 EXPECT_LT(0u, test_animator_->GetAnimationCount());
197 EXPECT_TRUE( 183 EXPECT_TRUE(test_animator_->AreContainersAnimated(
198 test_animator_->AreContainersAnimated( 184 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
199 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 185 SessionStateAnimator::ANIMATION_DROP));
200 SessionStateAnimator::ANIMATION_DROP)); 186 EXPECT_TRUE(test_animator_->AreContainersAnimated(
201 EXPECT_TRUE( 187 SessionStateAnimator::LAUNCHER,
202 test_animator_->AreContainersAnimated( 188 SessionStateAnimator::ANIMATION_FADE_IN));
203 SessionStateAnimator::LAUNCHER,
204 SessionStateAnimator::ANIMATION_FADE_IN));
205 } 189 }
206 190
207 void ExpectUnlockAfterUIDestroyedAnimationFinished() { 191 void ExpectUnlockAfterUIDestroyedAnimationFinished() {
208 SCOPED_TRACE("Failure in ExpectUnlockAfterUIDestroyedAnimationFinished"); 192 SCOPED_TRACE("Failure in ExpectUnlockAfterUIDestroyedAnimationFinished");
209 EXPECT_EQ(0u, test_animator_->GetAnimationCount()); 193 EXPECT_EQ(0u, test_animator_->GetAnimationCount());
210 EXPECT_FALSE( 194 EXPECT_FALSE(test_animator_->AreContainersAnimated(
211 test_animator_->AreContainersAnimated( 195 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS,
212 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, 196 SessionStateAnimator::ANIMATION_DROP));
213 SessionStateAnimator::ANIMATION_DROP)); 197 EXPECT_FALSE(test_animator_->AreContainersAnimated(
214 EXPECT_FALSE( 198 SessionStateAnimator::LAUNCHER,
215 test_animator_->AreContainersAnimated( 199 SessionStateAnimator::ANIMATION_FADE_IN));
216 SessionStateAnimator::LAUNCHER,
217 SessionStateAnimator::ANIMATION_FADE_IN));
218 } 200 }
219 201
220 void ExpectShutdownAnimationStarted() { 202 void ExpectShutdownAnimationStarted() {
221 SCOPED_TRACE("Failure in ExpectShutdownAnimationStarted"); 203 SCOPED_TRACE("Failure in ExpectShutdownAnimationStarted");
222 EXPECT_LT(0u, test_animator_->GetAnimationCount()); 204 EXPECT_LT(0u, test_animator_->GetAnimationCount());
223 EXPECT_TRUE( 205 EXPECT_TRUE(test_animator_->AreContainersAnimated(
224 test_animator_->AreContainersAnimated( 206 SessionStateAnimator::ROOT_CONTAINER,
225 SessionStateAnimator::ROOT_CONTAINER, 207 SessionStateAnimator::ANIMATION_GRAYSCALE_BRIGHTNESS));
226 SessionStateAnimator::ANIMATION_GRAYSCALE_BRIGHTNESS));
227 } 208 }
228 209
229 void ExpectShutdownAnimationFinished() { 210 void ExpectShutdownAnimationFinished() {
230 SCOPED_TRACE("Failure in ExpectShutdownAnimationFinished"); 211 SCOPED_TRACE("Failure in ExpectShutdownAnimationFinished");
231 EXPECT_EQ(0u, test_animator_->GetAnimationCount()); 212 EXPECT_EQ(0u, test_animator_->GetAnimationCount());
232 EXPECT_FALSE( 213 EXPECT_FALSE(test_animator_->AreContainersAnimated(
233 test_animator_->AreContainersAnimated( 214 SessionStateAnimator::ROOT_CONTAINER,
234 SessionStateAnimator::ROOT_CONTAINER, 215 SessionStateAnimator::ANIMATION_GRAYSCALE_BRIGHTNESS));
235 SessionStateAnimator::ANIMATION_GRAYSCALE_BRIGHTNESS));
236 } 216 }
237 217
238 void ExpectShutdownAnimationCancel() { 218 void ExpectShutdownAnimationCancel() {
239 SCOPED_TRACE("Failure in ExpectShutdownAnimationCancel"); 219 SCOPED_TRACE("Failure in ExpectShutdownAnimationCancel");
240 EXPECT_LT(0u, test_animator_->GetAnimationCount()); 220 EXPECT_LT(0u, test_animator_->GetAnimationCount());
241 EXPECT_TRUE( 221 EXPECT_TRUE(test_animator_->AreContainersAnimated(
242 test_animator_->AreContainersAnimated( 222 SessionStateAnimator::ROOT_CONTAINER,
243 SessionStateAnimator::ROOT_CONTAINER, 223 SessionStateAnimator::ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS));
244 SessionStateAnimator::ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS));
245 } 224 }
246 225
247 void ExpectBackgroundIsShowing() { 226 void ExpectBackgroundIsShowing() {
248 SCOPED_TRACE("Failure in ExpectBackgroundIsShowing"); 227 SCOPED_TRACE("Failure in ExpectBackgroundIsShowing");
249 EXPECT_LT(0u, test_animator_->GetAnimationCount()); 228 EXPECT_LT(0u, test_animator_->GetAnimationCount());
250 EXPECT_TRUE( 229 EXPECT_TRUE(test_animator_->AreContainersAnimated(
251 test_animator_->AreContainersAnimated( 230 SessionStateAnimator::DESKTOP_BACKGROUND,
252 SessionStateAnimator::DESKTOP_BACKGROUND, 231 SessionStateAnimator::ANIMATION_FADE_IN));
253 SessionStateAnimator::ANIMATION_FADE_IN));
254 } 232 }
255 233
256 void ExpectBackgroundIsHiding() { 234 void ExpectBackgroundIsHiding() {
257 SCOPED_TRACE("Failure in ExpectBackgroundIsHiding"); 235 SCOPED_TRACE("Failure in ExpectBackgroundIsHiding");
258 EXPECT_LT(0u, test_animator_->GetAnimationCount()); 236 EXPECT_LT(0u, test_animator_->GetAnimationCount());
259 EXPECT_TRUE( 237 EXPECT_TRUE(test_animator_->AreContainersAnimated(
260 test_animator_->AreContainersAnimated( 238 SessionStateAnimator::DESKTOP_BACKGROUND,
261 SessionStateAnimator::DESKTOP_BACKGROUND, 239 SessionStateAnimator::ANIMATION_FADE_OUT));
262 SessionStateAnimator::ANIMATION_FADE_OUT));
263 } 240 }
264 241
265 void ExpectRestoringBackgroundVisibility() { 242 void ExpectRestoringBackgroundVisibility() {
266 SCOPED_TRACE("Failure in ExpectRestoringBackgroundVisibility"); 243 SCOPED_TRACE("Failure in ExpectRestoringBackgroundVisibility");
267 EXPECT_LT(0u, test_animator_->GetAnimationCount()); 244 EXPECT_LT(0u, test_animator_->GetAnimationCount());
268 EXPECT_TRUE( 245 EXPECT_TRUE(test_animator_->AreContainersAnimated(
269 test_animator_->AreContainersAnimated( 246 SessionStateAnimator::DESKTOP_BACKGROUND,
270 SessionStateAnimator::DESKTOP_BACKGROUND, 247 SessionStateAnimator::ANIMATION_FADE_IN));
271 SessionStateAnimator::ANIMATION_FADE_IN));
272 } 248 }
273 249
274 void ExpectUnlockedState() { 250 void ExpectUnlockedState() {
275 SCOPED_TRACE("Failure in ExpectUnlockedState"); 251 SCOPED_TRACE("Failure in ExpectUnlockedState");
276 EXPECT_EQ(0u, test_animator_->GetAnimationCount()); 252 EXPECT_EQ(0u, test_animator_->GetAnimationCount());
277 EXPECT_FALSE(session_state_delegate_->IsScreenLocked()); 253 EXPECT_FALSE(session_state_delegate_->IsScreenLocked());
278 } 254 }
279 255
280 void ExpectLockedState() { 256 void ExpectLockedState() {
281 SCOPED_TRACE("Failure in ExpectLockedState"); 257 SCOPED_TRACE("Failure in ExpectLockedState");
282 EXPECT_EQ(0u, test_animator_->GetAnimationCount()); 258 EXPECT_EQ(0u, test_animator_->GetAnimationCount());
283 EXPECT_TRUE(session_state_delegate_->IsScreenLocked()); 259 EXPECT_TRUE(session_state_delegate_->IsScreenLocked());
284 } 260 }
285 261
286 void HideBackground() { 262 void HideBackground() { test_animator_->HideBackground(); }
287 test_animator_->HideBackground();
288 }
289 263
290 void PressPowerButton() { 264 void PressPowerButton() {
291 power_button_controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 265 power_button_controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
292 } 266 }
293 267
294 void ReleasePowerButton() { 268 void ReleasePowerButton() {
295 power_button_controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); 269 power_button_controller_->OnPowerButtonEvent(false, base::TimeTicks::Now());
296 } 270 }
297 271
298 void PressLockButton() { 272 void PressLockButton() {
(...skipping 21 matching lines...) Expand all
320 base::Closure closure = base::Bind(&CheckCalledCallback, call_flag); 294 base::Closure closure = base::Bind(&CheckCalledCallback, call_flag);
321 lock_state_controller_->OnLockScreenHide(closure); 295 lock_state_controller_->OnLockScreenHide(closure);
322 } 296 }
323 297
324 void SystemUnlocks() { 298 void SystemUnlocks() {
325 lock_state_controller_->OnLockStateChanged(false); 299 lock_state_controller_->OnLockStateChanged(false);
326 session_state_delegate_->UnlockScreen(); 300 session_state_delegate_->UnlockScreen();
327 } 301 }
328 302
329 void EnableMaximizeMode(bool enable) { 303 void EnableMaximizeMode(bool enable) {
330 Shell::GetInstance()->maximize_mode_controller()-> 304 Shell::GetInstance()
331 EnableMaximizeModeWindowManager(enable); 305 ->maximize_mode_controller()
306 ->EnableMaximizeModeWindowManager(enable);
332 } 307 }
333 308
334 void Initialize(bool legacy_button, LoginStatus status) { 309 void Initialize(bool legacy_button, LoginStatus status) {
335 power_button_controller_->set_has_legacy_power_button_for_test( 310 power_button_controller_->set_has_legacy_power_button_for_test(
336 legacy_button); 311 legacy_button);
337 lock_state_controller_->OnLoginStateChanged(status); 312 lock_state_controller_->OnLoginStateChanged(status);
338 SetUserLoggedIn(status != LoginStatus::NOT_LOGGED_IN); 313 SetUserLoggedIn(status != LoginStatus::NOT_LOGGED_IN);
339 if (status == LoginStatus::GUEST) 314 if (status == LoginStatus::GUEST)
340 SetCanLockScreen(false); 315 SetCanLockScreen(false);
341 lock_state_controller_->OnLockStateChanged(false); 316 lock_state_controller_->OnLockStateChanged(false);
342 } 317 }
343 318
344 PowerButtonController* power_button_controller_; // not owned 319 PowerButtonController* power_button_controller_; // not owned
345 LockStateController* lock_state_controller_; // not owned 320 LockStateController* lock_state_controller_; // not owned
346 TestLockStateControllerDelegate* 321 TestLockStateControllerDelegate*
347 lock_state_controller_delegate_; // not owned 322 lock_state_controller_delegate_; // not owned
348 TestSessionStateAnimator* test_animator_; // not owned 323 TestSessionStateAnimator* test_animator_; // not owned
349 SessionStateDelegate* session_state_delegate_; // not owned 324 SessionStateDelegate* session_state_delegate_; // not owned
350 std::unique_ptr<LockStateController::TestApi> test_api_; 325 std::unique_ptr<LockStateController::TestApi> test_api_;
351 TestShellDelegate* shell_delegate_; // not owned 326 TestShellDelegate* shell_delegate_; // not owned
352 327
353 private: 328 private:
354 DISALLOW_COPY_AND_ASSIGN(LockStateControllerTest); 329 DISALLOW_COPY_AND_ASSIGN(LockStateControllerTest);
355 }; 330 };
356 331
357 // Test the lock-to-shutdown flow for non-Chrome-OS hardware that doesn't 332 // Test the lock-to-shutdown flow for non-Chrome-OS hardware that doesn't
358 // correctly report power button releases. We should lock immediately the first 333 // correctly report power button releases. We should lock immediately the first
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 test_animator_->CompleteAllAnimations(true); 776 test_animator_->CompleteAllAnimations(true);
802 EXPECT_EQ(0, lock_state_controller_delegate_->num_lock_requests()); 777 EXPECT_EQ(0, lock_state_controller_delegate_->num_lock_requests());
803 } 778 }
804 779
805 // When we hear that the process is exiting but we haven't had a chance to 780 // When we hear that the process is exiting but we haven't had a chance to
806 // display an animation, we should just blank the screen. 781 // display an animation, we should just blank the screen.
807 TEST_F(LockStateControllerTest, ShutdownWithoutButton) { 782 TEST_F(LockStateControllerTest, ShutdownWithoutButton) {
808 Initialize(false, LoginStatus::USER); 783 Initialize(false, LoginStatus::USER);
809 lock_state_controller_->OnAppTerminating(); 784 lock_state_controller_->OnAppTerminating();
810 785
811 EXPECT_TRUE( 786 EXPECT_TRUE(test_animator_->AreContainersAnimated(
812 test_animator_->AreContainersAnimated( 787 SessionStateAnimator::kAllNonRootContainersMask,
813 SessionStateAnimator::kAllNonRootContainersMask, 788 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
814 SessionStateAnimator::ANIMATION_HIDE_IMMEDIATELY));
815 GenerateMouseMoveEvent(); 789 GenerateMouseMoveEvent();
816 EXPECT_FALSE(cursor_visible()); 790 EXPECT_FALSE(cursor_visible());
817 } 791 }
818 792
819 // Test that we display the fast-close animation and shut down when we get an 793 // Test that we display the fast-close animation and shut down when we get an
820 // outside request to shut down (e.g. from the login or lock screen). 794 // outside request to shut down (e.g. from the login or lock screen).
821 TEST_F(LockStateControllerTest, RequestShutdownFromLoginScreen) { 795 TEST_F(LockStateControllerTest, RequestShutdownFromLoginScreen) {
822 Initialize(false, LoginStatus::NOT_LOGGED_IN); 796 Initialize(false, LoginStatus::NOT_LOGGED_IN);
823 797
824 lock_state_controller_->RequestShutdown(); 798 lock_state_controller_->RequestShutdown();
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 ReleasePowerButton(); 1081 ReleasePowerButton();
1108 1082
1109 ExpectPreLockAnimationStarted(); 1083 ExpectPreLockAnimationStarted();
1110 1084
1111 test_animator_->CompleteAllAnimations(true); 1085 test_animator_->CompleteAllAnimations(true);
1112 EXPECT_EQ(1, lock_state_controller_delegate_->num_lock_requests()); 1086 EXPECT_EQ(1, lock_state_controller_delegate_->num_lock_requests());
1113 } 1087 }
1114 1088
1115 } // namespace test 1089 } // namespace test
1116 } // namespace ash 1090 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/lock_state_controller.cc ('k') | ash/wm/lock_window_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698