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

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

Issue 10909008: Improve existing lock transition - remove black splash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/power_button_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/power_button_controller.h" 5 #include "ash/wm/power_button_controller.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "ash/wm/cursor_manager.h" 9 #include "ash/wm/cursor_manager.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // state. 76 // state.
77 TEST_F(PowerButtonControllerTest, LegacyLockAndShutDown) { 77 TEST_F(PowerButtonControllerTest, LegacyLockAndShutDown) {
78 controller_->set_has_legacy_power_button_for_test(true); 78 controller_->set_has_legacy_power_button_for_test(true);
79 controller_->OnLoginStateChanged(user::LOGGED_IN_USER); 79 controller_->OnLoginStateChanged(user::LOGGED_IN_USER);
80 controller_->OnLockStateChanged(false); 80 controller_->OnLockStateChanged(false);
81 81
82 // We should request that the screen be locked immediately after seeing the 82 // We should request that the screen be locked immediately after seeing the
83 // power button get pressed. 83 // power button get pressed.
84 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 84 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
85 EXPECT_TRUE( 85 EXPECT_TRUE(
86 test_api_->ContainerGroupIsAnimated( 86 test_api_->ContainersAreAnimated(
87 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 87 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
88 PowerButtonController::ANIMATION_SLOW_CLOSE)); 88 PowerButtonController::ANIMATION_SLOW_CLOSE));
89 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 89 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
90 EXPECT_FALSE(test_api_->hide_background_layer_timer_is_running()); 90 EXPECT_FALSE(test_api_->hide_black_layer_timer_is_running());
91 EXPECT_FALSE(test_api_->lock_timer_is_running()); 91 EXPECT_FALSE(test_api_->lock_timer_is_running());
92 EXPECT_EQ(1, delegate_->num_lock_requests()); 92 EXPECT_EQ(1, delegate_->num_lock_requests());
93 93
94 // Notify that we locked successfully. 94 // Notify that we locked successfully.
95 controller_->OnStartingLock(); 95 controller_->OnStartingLock();
96 EXPECT_TRUE( 96 EXPECT_TRUE(
97 test_api_->ContainerGroupIsAnimated( 97 test_api_->ContainersAreAnimated(
98 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 98 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
99 PowerButtonController::ANIMATION_FAST_CLOSE)); 99 PowerButtonController::ANIMATION_FAST_CLOSE));
100 EXPECT_TRUE( 100 EXPECT_TRUE(
101 test_api_->ContainerGroupIsAnimated( 101 test_api_->ContainersAreAnimated(
102 PowerButtonController::SCREEN_LOCKER_CONTAINERS, 102 PowerButtonController::LOCK_SCREEN_CONTAINERS,
103 PowerButtonController::ANIMATION_HIDE)); 103 PowerButtonController::ANIMATION_HIDE));
104 104
105 // Notify that the lock window is visible. We should make it fade in. 105 // Notify that the lock window is visible. We should make it fade in.
106 controller_->OnLockStateChanged(true); 106 controller_->OnLockStateChanged(true);
107 EXPECT_TRUE( 107 EXPECT_TRUE(
108 test_api_->ContainerGroupIsAnimated( 108 test_api_->ContainersAreAnimated(
109 PowerButtonController::SCREEN_LOCKER_AND_RELATED_CONTAINERS, 109 PowerButtonController::GetAllLockScreenContainersMask(),
110 PowerButtonController::ANIMATION_FADE_IN)); 110 PowerButtonController::ANIMATION_FADE_IN));
111 111
112 // We shouldn't progress towards the shutdown state, however. 112 // We shouldn't progress towards the shutdown state, however.
113 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); 113 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running());
114 EXPECT_FALSE(test_api_->shutdown_timer_is_running()); 114 EXPECT_FALSE(test_api_->shutdown_timer_is_running());
115 controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); 115 controller_->OnPowerButtonEvent(false, base::TimeTicks::Now());
116 116
117 // Hold the button again and check that we start shutting down. 117 // Hold the button again and check that we start shutting down.
118 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 118 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
119 EXPECT_EQ(0, delegate_->num_shutdown_requests()); 119 EXPECT_EQ(0, delegate_->num_shutdown_requests());
120
121 // Previously we're checking that the all containers group was animated which
122 // was in fact checking that
123 // 1. All user session containers have transform (including wallpaper).
124 // They're in this state after lock.
125 // 2. Screen locker and related containers are in fact animating
126 // (as shutdown is in progress).
127 // With http://crbug.com/144737 we no longer animate user session wallpaper
128 // during lock so it makes sense only to check that screen lock and related
129 // containers are animated during shutdown.
120 EXPECT_TRUE( 130 EXPECT_TRUE(
121 test_api_->ContainerGroupIsAnimated( 131 test_api_->ContainersAreAnimated(
122 PowerButtonController::ALL_CONTAINERS, 132 PowerButtonController::GetAllLockScreenContainersMask(),
123 PowerButtonController::ANIMATION_FAST_CLOSE)); 133 PowerButtonController::ANIMATION_FAST_CLOSE));
124 EXPECT_FALSE(cursor_visible()); 134 EXPECT_FALSE(cursor_visible());
125 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); 135 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running());
126 test_api_->trigger_real_shutdown_timeout(); 136 test_api_->trigger_real_shutdown_timeout();
127 EXPECT_EQ(1, delegate_->num_shutdown_requests()); 137 EXPECT_EQ(1, delegate_->num_shutdown_requests());
128 } 138 }
129 139
130 // Test that we start shutting down immediately if the power button is pressed 140 // Test that we start shutting down immediately if the power button is pressed
131 // while we're not logged in on an unofficial system. 141 // while we're not logged in on an unofficial system.
132 TEST_F(PowerButtonControllerTest, LegacyNotLoggedIn) { 142 TEST_F(PowerButtonControllerTest, LegacyNotLoggedIn) {
(...skipping 13 matching lines...) Expand all
146 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 156 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
147 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); 157 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running());
148 } 158 }
149 159
150 // When we hold the power button while the user isn't logged in, we should shut 160 // When we hold the power button while the user isn't logged in, we should shut
151 // down the machine directly. 161 // down the machine directly.
152 TEST_F(PowerButtonControllerTest, ShutdownWhenNotLoggedIn) { 162 TEST_F(PowerButtonControllerTest, ShutdownWhenNotLoggedIn) {
153 controller_->set_has_legacy_power_button_for_test(false); 163 controller_->set_has_legacy_power_button_for_test(false);
154 controller_->OnLoginStateChanged(user::LOGGED_IN_NONE); 164 controller_->OnLoginStateChanged(user::LOGGED_IN_NONE);
155 controller_->OnLockStateChanged(false); 165 controller_->OnLockStateChanged(false);
156 EXPECT_FALSE(test_api_->BackgroundLayerIsVisible()); 166 EXPECT_FALSE(test_api_->BlackLayerIsVisible());
157 167
158 // Press the power button and check that we start the shutdown timer. 168 // Press the power button and check that we start the shutdown timer.
159 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 169 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
160 EXPECT_FALSE(test_api_->lock_timer_is_running()); 170 EXPECT_FALSE(test_api_->lock_timer_is_running());
161 EXPECT_TRUE(test_api_->shutdown_timer_is_running()); 171 EXPECT_TRUE(test_api_->shutdown_timer_is_running());
162 EXPECT_TRUE( 172 EXPECT_TRUE(
163 test_api_->ContainerGroupIsAnimated( 173 test_api_->ContainersAreAnimated(
164 PowerButtonController::ALL_CONTAINERS, 174 PowerButtonController::GetAllContainersMask(),
165 PowerButtonController::ANIMATION_SLOW_CLOSE)); 175 PowerButtonController::ANIMATION_SLOW_CLOSE));
166 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 176 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
167 177
168 // Release the power button before the shutdown timer fires. 178 // Release the power button before the shutdown timer fires.
169 controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); 179 controller_->OnPowerButtonEvent(false, base::TimeTicks::Now());
170 EXPECT_FALSE(test_api_->shutdown_timer_is_running()); 180 EXPECT_FALSE(test_api_->shutdown_timer_is_running());
171 EXPECT_TRUE( 181 EXPECT_TRUE(
172 test_api_->ContainerGroupIsAnimated( 182 test_api_->ContainersAreAnimated(
173 PowerButtonController::ALL_CONTAINERS, 183 PowerButtonController::GetAllContainersMask(),
174 PowerButtonController::ANIMATION_UNDO_SLOW_CLOSE)); 184 PowerButtonController::ANIMATION_UNDO_SLOW_CLOSE));
175 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 185 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
176 186
177 // We should re-hide the black background layer after waiting long enough for 187 // We should re-hide the black black layer after waiting long enough for
Daniel Erat 2012/09/04 17:42:23 nit: s/black black/black/
Nikita (slow) 2012/09/04 17:53:09 Done.
178 // the animation to finish. 188 // the animation to finish.
179 EXPECT_TRUE(test_api_->hide_background_layer_timer_is_running()); 189 EXPECT_TRUE(test_api_->hide_black_layer_timer_is_running());
180 test_api_->trigger_hide_background_layer_timeout(); 190 test_api_->trigger_hide_black_layer_timeout();
181 EXPECT_FALSE(test_api_->BackgroundLayerIsVisible()); 191 EXPECT_FALSE(test_api_->BlackLayerIsVisible());
182 192
183 // Press the button again and make the shutdown timeout fire this time. 193 // Press the button again and make the shutdown timeout fire this time.
184 // Check that we start the timer for actually requesting the shutdown. 194 // Check that we start the timer for actually requesting the shutdown.
185 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 195 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
186 EXPECT_TRUE(test_api_->shutdown_timer_is_running()); 196 EXPECT_TRUE(test_api_->shutdown_timer_is_running());
187 test_api_->trigger_shutdown_timeout(); 197 test_api_->trigger_shutdown_timeout();
188 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); 198 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running());
189 EXPECT_EQ(0, delegate_->num_shutdown_requests()); 199 EXPECT_EQ(0, delegate_->num_shutdown_requests());
190 EXPECT_TRUE( 200 EXPECT_TRUE(
191 test_api_->ContainerGroupIsAnimated( 201 test_api_->ContainersAreAnimated(
192 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 202 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
193 PowerButtonController::ANIMATION_HIDE)); 203 PowerButtonController::ANIMATION_HIDE));
194 EXPECT_TRUE( 204 EXPECT_TRUE(
195 test_api_->ContainerGroupIsAnimated( 205 test_api_->ContainersAreAnimated(
196 PowerButtonController::SCREEN_LOCKER_AND_RELATED_CONTAINERS, 206 PowerButtonController::GetAllLockScreenContainersMask(),
197 PowerButtonController::ANIMATION_FAST_CLOSE)); 207 PowerButtonController::ANIMATION_FAST_CLOSE));
198 208
199 // When the timout fires, we should request a shutdown. 209 // When the timout fires, we should request a shutdown.
200 test_api_->trigger_real_shutdown_timeout(); 210 test_api_->trigger_real_shutdown_timeout();
201 EXPECT_EQ(1, delegate_->num_shutdown_requests()); 211 EXPECT_EQ(1, delegate_->num_shutdown_requests());
202 } 212 }
203 213
204 // Test that we lock the screen and deal with unlocking correctly. 214 // Test that we lock the screen and deal with unlocking correctly.
205 TEST_F(PowerButtonControllerTest, LockAndUnlock) { 215 TEST_F(PowerButtonControllerTest, LockAndUnlock) {
206 controller_->set_has_legacy_power_button_for_test(false); 216 controller_->set_has_legacy_power_button_for_test(false);
207 controller_->OnLoginStateChanged(user::LOGGED_IN_USER); 217 controller_->OnLoginStateChanged(user::LOGGED_IN_USER);
208 controller_->OnLockStateChanged(false); 218 controller_->OnLockStateChanged(false);
209 EXPECT_FALSE(test_api_->BackgroundLayerIsVisible()); 219 EXPECT_FALSE(test_api_->BlackLayerIsVisible());
210 220
211 // We should initially be showing the screen locker containers, since they 221 // We should initially be showing the screen locker containers, since they
212 // also contain login-related windows that we want to show during the 222 // also contain login-related windows that we want to show during the
213 // logging-in animation. 223 // logging-in animation.
214 EXPECT_TRUE( 224 EXPECT_TRUE(
215 test_api_->ContainerGroupIsAnimated( 225 test_api_->ContainersAreAnimated(
216 PowerButtonController::SCREEN_LOCKER_CONTAINERS, 226 PowerButtonController::LOCK_SCREEN_CONTAINERS,
217 PowerButtonController::ANIMATION_RESTORE)); 227 PowerButtonController::ANIMATION_RESTORE));
218 228
219 // Press the power button and check that the lock timer is started and that we 229 // Press the power button and check that the lock timer is started and that we
220 // start scaling the non-screen-locker containers. 230 // start scaling the non-screen-locker containers.
221 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 231 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
222 EXPECT_TRUE(test_api_->lock_timer_is_running()); 232 EXPECT_TRUE(test_api_->lock_timer_is_running());
223 EXPECT_FALSE(test_api_->shutdown_timer_is_running()); 233 EXPECT_FALSE(test_api_->shutdown_timer_is_running());
224 EXPECT_TRUE( 234 EXPECT_TRUE(
225 test_api_->ContainerGroupIsAnimated( 235 test_api_->ContainersAreAnimated(
226 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 236 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
227 PowerButtonController::ANIMATION_SLOW_CLOSE)); 237 PowerButtonController::ANIMATION_SLOW_CLOSE));
228 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 238 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
229 239
230 // Release the button before the lock timer fires. 240 // Release the button before the lock timer fires.
231 controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); 241 controller_->OnPowerButtonEvent(false, base::TimeTicks::Now());
232 EXPECT_FALSE(test_api_->lock_timer_is_running()); 242 EXPECT_FALSE(test_api_->lock_timer_is_running());
233 EXPECT_TRUE( 243 EXPECT_TRUE(
234 test_api_->ContainerGroupIsAnimated( 244 test_api_->ContainersAreAnimated(
235 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 245 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
236 PowerButtonController::ANIMATION_UNDO_SLOW_CLOSE)); 246 PowerButtonController::ANIMATION_UNDO_SLOW_CLOSE));
237 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 247 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
238 EXPECT_TRUE(test_api_->hide_background_layer_timer_is_running()); 248 EXPECT_TRUE(test_api_->hide_black_layer_timer_is_running());
239 test_api_->trigger_hide_background_layer_timeout(); 249 test_api_->trigger_hide_black_layer_timeout();
240 EXPECT_FALSE(test_api_->BackgroundLayerIsVisible()); 250 EXPECT_FALSE(test_api_->BlackLayerIsVisible());
241 251
242 // Press the button and fire the lock timer. We should request that the 252 // Press the button and fire the lock timer. We should request that the
243 // screen be locked, but we should still be in the slow-close animation. 253 // screen be locked, but we should still be in the slow-close animation.
244 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 254 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
245 EXPECT_TRUE(test_api_->lock_timer_is_running()); 255 EXPECT_TRUE(test_api_->lock_timer_is_running());
246 EXPECT_EQ(0, delegate_->num_lock_requests()); 256 EXPECT_EQ(0, delegate_->num_lock_requests());
247 test_api_->trigger_lock_timeout(); 257 test_api_->trigger_lock_timeout();
248 EXPECT_EQ(1, delegate_->num_lock_requests()); 258 EXPECT_EQ(1, delegate_->num_lock_requests());
249 EXPECT_TRUE( 259 EXPECT_TRUE(
250 test_api_->ContainerGroupIsAnimated( 260 test_api_->ContainersAreAnimated(
251 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 261 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
252 PowerButtonController::ANIMATION_SLOW_CLOSE)); 262 PowerButtonController::ANIMATION_SLOW_CLOSE));
253 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 263 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
254 264
255 // Notify that we locked successfully. 265 // Notify that we locked successfully.
256 controller_->OnStartingLock(); 266 controller_->OnStartingLock();
257 EXPECT_TRUE( 267 EXPECT_TRUE(
258 test_api_->ContainerGroupIsAnimated( 268 test_api_->ContainersAreAnimated(
259 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 269 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
260 PowerButtonController::ANIMATION_FAST_CLOSE)); 270 PowerButtonController::ANIMATION_FAST_CLOSE));
261 EXPECT_TRUE( 271 EXPECT_TRUE(
262 test_api_->ContainerGroupIsAnimated( 272 test_api_->ContainersAreAnimated(
263 PowerButtonController::SCREEN_LOCKER_CONTAINERS, 273 PowerButtonController::LOCK_SCREEN_CONTAINERS,
264 PowerButtonController::ANIMATION_HIDE)); 274 PowerButtonController::ANIMATION_HIDE));
265 275
266 // Notify that the lock window is visible. We should make it fade in. 276 // Notify that the lock window is visible. We should make it fade in.
267 controller_->OnLockStateChanged(true); 277 controller_->OnLockStateChanged(true);
268 EXPECT_TRUE( 278 EXPECT_TRUE(
269 test_api_->ContainerGroupIsAnimated( 279 test_api_->ContainersAreAnimated(
270 PowerButtonController::SCREEN_LOCKER_AND_RELATED_CONTAINERS, 280 PowerButtonController::GetAllLockScreenContainersMask(),
271 PowerButtonController::ANIMATION_FADE_IN)); 281 PowerButtonController::ANIMATION_FADE_IN));
272 282
273 // When we release the power button, the lock-to-shutdown timer should be 283 // When we release the power button, the lock-to-shutdown timer should be
274 // stopped. 284 // stopped.
275 EXPECT_TRUE(test_api_->lock_to_shutdown_timer_is_running()); 285 EXPECT_TRUE(test_api_->lock_to_shutdown_timer_is_running());
276 controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); 286 controller_->OnPowerButtonEvent(false, base::TimeTicks::Now());
277 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); 287 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running());
278 288
279 // Notify that the screen has been unlocked. We should show the 289 // Notify that the screen has been unlocked. We should show the
280 // non-screen-locker windows and hide the background layer. 290 // non-screen-locker windows and hide the black layer.
281 controller_->OnLockStateChanged(false); 291 controller_->OnLockStateChanged(false);
282 EXPECT_TRUE( 292 EXPECT_TRUE(
283 test_api_->ContainerGroupIsAnimated( 293 test_api_->ContainersAreAnimated(
284 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 294 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
285 PowerButtonController::ANIMATION_RESTORE)); 295 PowerButtonController::ANIMATION_RESTORE));
286 EXPECT_FALSE(test_api_->BackgroundLayerIsVisible()); 296 EXPECT_FALSE(test_api_->BlackLayerIsVisible());
287 } 297 }
288 298
289 // Hold the power button down from the unlocked state to eventual shutdown. 299 // Hold the power button down from the unlocked state to eventual shutdown.
290 TEST_F(PowerButtonControllerTest, LockToShutdown) { 300 TEST_F(PowerButtonControllerTest, LockToShutdown) {
291 controller_->set_has_legacy_power_button_for_test(false); 301 controller_->set_has_legacy_power_button_for_test(false);
292 controller_->OnLoginStateChanged(user::LOGGED_IN_USER); 302 controller_->OnLoginStateChanged(user::LOGGED_IN_USER);
293 controller_->OnLockStateChanged(false); 303 controller_->OnLockStateChanged(false);
294 304
295 // Hold the power button and lock the screen. 305 // Hold the power button and lock the screen.
296 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 306 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
297 EXPECT_TRUE(test_api_->lock_timer_is_running()); 307 EXPECT_TRUE(test_api_->lock_timer_is_running());
298 test_api_->trigger_lock_timeout(); 308 test_api_->trigger_lock_timeout();
299 controller_->OnStartingLock(); 309 controller_->OnStartingLock();
300 controller_->OnLockStateChanged(true); 310 controller_->OnLockStateChanged(true);
301 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 311 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
302 312
303 // When the lock-to-shutdown timeout fires, we should start the shutdown 313 // When the lock-to-shutdown timeout fires, we should start the shutdown
304 // timer. 314 // timer.
305 EXPECT_TRUE(test_api_->lock_to_shutdown_timer_is_running()); 315 EXPECT_TRUE(test_api_->lock_to_shutdown_timer_is_running());
306 test_api_->trigger_lock_to_shutdown_timeout(); 316 test_api_->trigger_lock_to_shutdown_timeout();
307 EXPECT_TRUE(test_api_->shutdown_timer_is_running()); 317 EXPECT_TRUE(test_api_->shutdown_timer_is_running());
308 EXPECT_TRUE( 318 EXPECT_TRUE(
309 test_api_->ContainerGroupIsAnimated( 319 test_api_->ContainersAreAnimated(
310 PowerButtonController::ALL_CONTAINERS, 320 PowerButtonController::GetAllContainersMask(),
311 PowerButtonController::ANIMATION_SLOW_CLOSE)); 321 PowerButtonController::ANIMATION_SLOW_CLOSE));
312 322
313 // Fire the shutdown timeout and check that we request shutdown. 323 // Fire the shutdown timeout and check that we request shutdown.
314 test_api_->trigger_shutdown_timeout(); 324 test_api_->trigger_shutdown_timeout();
315 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); 325 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running());
316 EXPECT_EQ(0, delegate_->num_shutdown_requests()); 326 EXPECT_EQ(0, delegate_->num_shutdown_requests());
317 test_api_->trigger_real_shutdown_timeout(); 327 test_api_->trigger_real_shutdown_timeout();
318 EXPECT_EQ(1, delegate_->num_shutdown_requests()); 328 EXPECT_EQ(1, delegate_->num_shutdown_requests());
319 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 329 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
320 } 330 }
321 331
322 // Test that we handle the case where lock requests are ignored. 332 // Test that we handle the case where lock requests are ignored.
323 TEST_F(PowerButtonControllerTest, LockFail) { 333 TEST_F(PowerButtonControllerTest, LockFail) {
324 // We require animations to have a duration for this test. 334 // We require animations to have a duration for this test.
325 ui::LayerAnimator::set_disable_animations_for_test(false); 335 ui::LayerAnimator::set_disable_animations_for_test(false);
326 336
327 controller_->set_has_legacy_power_button_for_test(false); 337 controller_->set_has_legacy_power_button_for_test(false);
328 controller_->OnLoginStateChanged(user::LOGGED_IN_USER); 338 controller_->OnLoginStateChanged(user::LOGGED_IN_USER);
329 controller_->OnLockStateChanged(false); 339 controller_->OnLockStateChanged(false);
330 340
331 // Hold the power button and lock the screen. 341 // Hold the power button and lock the screen.
332 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 342 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
333 EXPECT_TRUE(test_api_->lock_timer_is_running()); 343 EXPECT_TRUE(test_api_->lock_timer_is_running());
334 EXPECT_TRUE( 344 EXPECT_TRUE(
335 test_api_->ContainerGroupIsAnimated( 345 test_api_->ContainersAreAnimated(
336 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 346 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
337 PowerButtonController::ANIMATION_RESTORE)); 347 PowerButtonController::ANIMATION_RESTORE));
338 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 348 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
339 test_api_->trigger_lock_timeout(); 349 test_api_->trigger_lock_timeout();
340 EXPECT_EQ(1, delegate_->num_lock_requests()); 350 EXPECT_EQ(1, delegate_->num_lock_requests());
341 EXPECT_TRUE(test_api_->lock_fail_timer_is_running()); 351 EXPECT_TRUE(test_api_->lock_fail_timer_is_running());
342 352
343 // We shouldn't start the lock-to-shutdown timer until the screen has actually 353 // We shouldn't start the lock-to-shutdown timer until the screen has actually
344 // been locked. 354 // been locked.
345 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running()); 355 EXPECT_FALSE(test_api_->lock_to_shutdown_timer_is_running());
346 356
347 // Act as if the request timed out. We should restore the windows. 357 // Act as if the request timed out. We should restore the windows.
348 test_api_->trigger_lock_fail_timeout(); 358 test_api_->trigger_lock_fail_timeout();
349 EXPECT_TRUE( 359 EXPECT_TRUE(
350 test_api_->ContainerGroupIsAnimated( 360 test_api_->ContainersAreAnimated(
351 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 361 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
352 PowerButtonController::ANIMATION_RESTORE)); 362 PowerButtonController::ANIMATION_RESTORE));
353 EXPECT_FALSE(test_api_->BackgroundLayerIsVisible()); 363 EXPECT_FALSE(test_api_->BlackLayerIsVisible());
354 } 364 }
355 365
356 // Test that we start the timer to hide the background layer when the power 366 // Test that we start the timer to hide the black layer when the power
357 // button is released, but that we cancel the timer if the button is pressed 367 // button is released, but that we cancel the timer if the button is pressed
358 // again before the timer has fired. 368 // again before the timer has fired.
359 TEST_F(PowerButtonControllerTest, CancelHideBackground) { 369 TEST_F(PowerButtonControllerTest, CancelHideBackground) {
360 controller_->set_has_legacy_power_button_for_test(false); 370 controller_->set_has_legacy_power_button_for_test(false);
361 controller_->OnLoginStateChanged(user::LOGGED_IN_NONE); 371 controller_->OnLoginStateChanged(user::LOGGED_IN_NONE);
362 controller_->OnLockStateChanged(false); 372 controller_->OnLockStateChanged(false);
363 373
364 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 374 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
365 controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); 375 controller_->OnPowerButtonEvent(false, base::TimeTicks::Now());
366 EXPECT_TRUE(test_api_->hide_background_layer_timer_is_running()); 376 EXPECT_TRUE(test_api_->hide_black_layer_timer_is_running());
367 377
368 // We should cancel the timer if we get another button-down event. 378 // We should cancel the timer if we get another button-down event.
369 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 379 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
370 EXPECT_FALSE(test_api_->hide_background_layer_timer_is_running()); 380 EXPECT_FALSE(test_api_->hide_black_layer_timer_is_running());
371 } 381 }
372 382
373 // Test the basic operation of the lock button. 383 // Test the basic operation of the lock button.
374 TEST_F(PowerButtonControllerTest, LockButtonBasic) { 384 TEST_F(PowerButtonControllerTest, LockButtonBasic) {
375 controller_->set_has_legacy_power_button_for_test(false); 385 controller_->set_has_legacy_power_button_for_test(false);
376 // The lock button shouldn't do anything if we aren't logged in. 386 // The lock button shouldn't do anything if we aren't logged in.
377 controller_->OnLoginStateChanged(user::LOGGED_IN_NONE); 387 controller_->OnLoginStateChanged(user::LOGGED_IN_NONE);
378 controller_->OnLockStateChanged(false); 388 controller_->OnLockStateChanged(false);
379 controller_->OnLockButtonEvent(true, base::TimeTicks::Now()); 389 controller_->OnLockButtonEvent(true, base::TimeTicks::Now());
380 EXPECT_FALSE(test_api_->lock_timer_is_running()); 390 EXPECT_FALSE(test_api_->lock_timer_is_running());
381 controller_->OnLockButtonEvent(false, base::TimeTicks::Now()); 391 controller_->OnLockButtonEvent(false, base::TimeTicks::Now());
382 EXPECT_EQ(0, delegate_->num_lock_requests()); 392 EXPECT_EQ(0, delegate_->num_lock_requests());
383 393
384 // Ditto for when we're logged in as a guest. 394 // Ditto for when we're logged in as a guest.
385 controller_->OnLoginStateChanged(user::LOGGED_IN_GUEST); 395 controller_->OnLoginStateChanged(user::LOGGED_IN_GUEST);
386 controller_->OnLockButtonEvent(true, base::TimeTicks::Now()); 396 controller_->OnLockButtonEvent(true, base::TimeTicks::Now());
387 EXPECT_FALSE(test_api_->lock_timer_is_running()); 397 EXPECT_FALSE(test_api_->lock_timer_is_running());
388 controller_->OnLockButtonEvent(false, base::TimeTicks::Now()); 398 controller_->OnLockButtonEvent(false, base::TimeTicks::Now());
389 EXPECT_EQ(0, delegate_->num_lock_requests()); 399 EXPECT_EQ(0, delegate_->num_lock_requests());
390 400
391 // If we're logged in as a regular user, we should start the lock timer and 401 // If we're logged in as a regular user, we should start the lock timer and
392 // the pre-lock animation. 402 // the pre-lock animation.
393 controller_->OnLoginStateChanged(user::LOGGED_IN_USER); 403 controller_->OnLoginStateChanged(user::LOGGED_IN_USER);
394 controller_->OnLockButtonEvent(true, base::TimeTicks::Now()); 404 controller_->OnLockButtonEvent(true, base::TimeTicks::Now());
395 EXPECT_TRUE(test_api_->lock_timer_is_running()); 405 EXPECT_TRUE(test_api_->lock_timer_is_running());
396 EXPECT_TRUE( 406 EXPECT_TRUE(
397 test_api_->ContainerGroupIsAnimated( 407 test_api_->ContainersAreAnimated(
398 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 408 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
399 PowerButtonController::ANIMATION_SLOW_CLOSE)); 409 PowerButtonController::ANIMATION_SLOW_CLOSE));
400 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 410 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
401 411
402 // If the button is released immediately, we shouldn't lock the screen. 412 // If the button is released immediately, we shouldn't lock the screen.
403 controller_->OnLockButtonEvent(false, base::TimeTicks::Now()); 413 controller_->OnLockButtonEvent(false, base::TimeTicks::Now());
404 EXPECT_FALSE(test_api_->lock_timer_is_running()); 414 EXPECT_FALSE(test_api_->lock_timer_is_running());
405 EXPECT_TRUE( 415 EXPECT_TRUE(
406 test_api_->ContainerGroupIsAnimated( 416 test_api_->ContainersAreAnimated(
407 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 417 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
408 PowerButtonController::ANIMATION_UNDO_SLOW_CLOSE)); 418 PowerButtonController::ANIMATION_UNDO_SLOW_CLOSE));
409 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 419 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
410 EXPECT_TRUE(test_api_->hide_background_layer_timer_is_running()); 420 EXPECT_TRUE(test_api_->hide_black_layer_timer_is_running());
411 test_api_->trigger_hide_background_layer_timeout(); 421 test_api_->trigger_hide_black_layer_timeout();
412 EXPECT_FALSE(test_api_->BackgroundLayerIsVisible()); 422 EXPECT_FALSE(test_api_->BlackLayerIsVisible());
413 EXPECT_EQ(0, delegate_->num_lock_requests()); 423 EXPECT_EQ(0, delegate_->num_lock_requests());
414 424
415 // Press the button again and let the lock timeout fire. We should request 425 // Press the button again and let the lock timeout fire. We should request
416 // that the screen be locked. 426 // that the screen be locked.
417 controller_->OnLockButtonEvent(true, base::TimeTicks::Now()); 427 controller_->OnLockButtonEvent(true, base::TimeTicks::Now());
418 EXPECT_TRUE(test_api_->lock_timer_is_running()); 428 EXPECT_TRUE(test_api_->lock_timer_is_running());
419 test_api_->trigger_lock_timeout(); 429 test_api_->trigger_lock_timeout();
420 EXPECT_EQ(1, delegate_->num_lock_requests()); 430 EXPECT_EQ(1, delegate_->num_lock_requests());
421 431
422 // Pressing the lock button while we have a pending lock request shouldn't do 432 // Pressing the lock button while we have a pending lock request shouldn't do
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 470
461 // Releasing the power button should stop the lock timer. 471 // Releasing the power button should stop the lock timer.
462 controller_->OnPowerButtonEvent(false, base::TimeTicks::Now()); 472 controller_->OnPowerButtonEvent(false, base::TimeTicks::Now());
463 EXPECT_FALSE(test_api_->lock_timer_is_running()); 473 EXPECT_FALSE(test_api_->lock_timer_is_running());
464 controller_->OnLockButtonEvent(false, base::TimeTicks::Now()); 474 controller_->OnLockButtonEvent(false, base::TimeTicks::Now());
465 EXPECT_FALSE(test_api_->lock_timer_is_running()); 475 EXPECT_FALSE(test_api_->lock_timer_is_running());
466 } 476 }
467 477
468 // When the screen is locked without going through the usual power-button 478 // When the screen is locked without going through the usual power-button
469 // slow-close path (e.g. via the wrench menu), test that we still show the 479 // slow-close path (e.g. via the wrench menu), test that we still show the
470 // fast-close animation and display the background layer. 480 // fast-close animation and display the black layer.
471 TEST_F(PowerButtonControllerTest, LockWithoutButton) { 481 TEST_F(PowerButtonControllerTest, LockWithoutButton) {
472 controller_->OnLoginStateChanged(user::LOGGED_IN_USER); 482 controller_->OnLoginStateChanged(user::LOGGED_IN_USER);
473 controller_->OnStartingLock(); 483 controller_->OnStartingLock();
474 EXPECT_TRUE( 484 EXPECT_TRUE(
475 test_api_->ContainerGroupIsAnimated( 485 test_api_->ContainersAreAnimated(
476 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 486 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
477 PowerButtonController::ANIMATION_FAST_CLOSE)); 487 PowerButtonController::ANIMATION_FAST_CLOSE));
478 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 488 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
479 } 489 }
480 490
481 // When we hear that the process is exiting but we haven't had a chance to 491 // When we hear that the process is exiting but we haven't had a chance to
482 // display an animation, we should just blank the screen. 492 // display an animation, we should just blank the screen.
483 TEST_F(PowerButtonControllerTest, ShutdownWithoutButton) { 493 TEST_F(PowerButtonControllerTest, ShutdownWithoutButton) {
484 controller_->OnLoginStateChanged(user::LOGGED_IN_USER); 494 controller_->OnLoginStateChanged(user::LOGGED_IN_USER);
485 controller_->OnAppTerminating(); 495 controller_->OnAppTerminating();
486 EXPECT_TRUE( 496 EXPECT_TRUE(
487 test_api_->ContainerGroupIsAnimated( 497 test_api_->ContainersAreAnimated(
488 PowerButtonController::ALL_CONTAINERS, 498 PowerButtonController::GetAllContainersMask(),
489 PowerButtonController::ANIMATION_HIDE)); 499 PowerButtonController::ANIMATION_HIDE));
490 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 500 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
491 EXPECT_FALSE(cursor_visible()); 501 EXPECT_FALSE(cursor_visible());
492 } 502 }
493 503
494 // Test that we display the fast-close animation and shut down when we get an 504 // Test that we display the fast-close animation and shut down when we get an
495 // outside request to shut down (e.g. from the login or lock screen). 505 // outside request to shut down (e.g. from the login or lock screen).
496 TEST_F(PowerButtonControllerTest, RequestShutdownFromLoginScreen) { 506 TEST_F(PowerButtonControllerTest, RequestShutdownFromLoginScreen) {
497 controller_->OnLoginStateChanged(user::LOGGED_IN_NONE); 507 controller_->OnLoginStateChanged(user::LOGGED_IN_NONE);
498 controller_->RequestShutdown(); 508 controller_->RequestShutdown();
499 EXPECT_TRUE( 509 EXPECT_TRUE(
500 test_api_->ContainerGroupIsAnimated( 510 test_api_->ContainersAreAnimated(
501 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 511 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
502 PowerButtonController::ANIMATION_HIDE)); 512 PowerButtonController::ANIMATION_HIDE));
503 EXPECT_TRUE( 513 EXPECT_TRUE(
504 test_api_->ContainerGroupIsAnimated( 514 test_api_->ContainersAreAnimated(
505 PowerButtonController::SCREEN_LOCKER_AND_RELATED_CONTAINERS, 515 PowerButtonController::GetAllLockScreenContainersMask(),
506 PowerButtonController::ANIMATION_FAST_CLOSE)); 516 PowerButtonController::ANIMATION_FAST_CLOSE));
507 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 517 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
508 EXPECT_FALSE(cursor_visible()); 518 EXPECT_FALSE(cursor_visible());
509 519
510 EXPECT_EQ(0, delegate_->num_shutdown_requests()); 520 EXPECT_EQ(0, delegate_->num_shutdown_requests());
511 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); 521 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running());
512 test_api_->trigger_real_shutdown_timeout(); 522 test_api_->trigger_real_shutdown_timeout();
513 EXPECT_EQ(1, delegate_->num_shutdown_requests()); 523 EXPECT_EQ(1, delegate_->num_shutdown_requests());
514 } 524 }
515 525
516 TEST_F(PowerButtonControllerTest, RequestShutdownFromLockScreen) { 526 TEST_F(PowerButtonControllerTest, RequestShutdownFromLockScreen) {
517 controller_->OnLoginStateChanged(user::LOGGED_IN_USER); 527 controller_->OnLoginStateChanged(user::LOGGED_IN_USER);
518 controller_->OnLockStateChanged(true); 528 controller_->OnLockStateChanged(true);
519 controller_->RequestShutdown(); 529 controller_->RequestShutdown();
520 EXPECT_TRUE( 530 EXPECT_TRUE(
521 test_api_->ContainerGroupIsAnimated( 531 test_api_->ContainersAreAnimated(
522 PowerButtonController::ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS, 532 PowerButtonController::NON_LOCK_SCREEN_CONTAINERS,
523 PowerButtonController::ANIMATION_HIDE)); 533 PowerButtonController::ANIMATION_HIDE));
524 EXPECT_TRUE( 534 EXPECT_TRUE(
525 test_api_->ContainerGroupIsAnimated( 535 test_api_->ContainersAreAnimated(
526 PowerButtonController::SCREEN_LOCKER_AND_RELATED_CONTAINERS, 536 PowerButtonController::GetAllLockScreenContainersMask(),
527 PowerButtonController::ANIMATION_FAST_CLOSE)); 537 PowerButtonController::ANIMATION_FAST_CLOSE));
528 EXPECT_TRUE(test_api_->BackgroundLayerIsVisible()); 538 EXPECT_TRUE(test_api_->BlackLayerIsVisible());
529 EXPECT_FALSE(cursor_visible()); 539 EXPECT_FALSE(cursor_visible());
530 540
531 EXPECT_EQ(0, delegate_->num_shutdown_requests()); 541 EXPECT_EQ(0, delegate_->num_shutdown_requests());
532 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running()); 542 EXPECT_TRUE(test_api_->real_shutdown_timer_is_running());
533 test_api_->trigger_real_shutdown_timeout(); 543 test_api_->trigger_real_shutdown_timeout();
534 EXPECT_EQ(1, delegate_->num_shutdown_requests()); 544 EXPECT_EQ(1, delegate_->num_shutdown_requests());
535 } 545 }
536 546
537 // Test that the background layer is resized in response to root window resizes. 547 // Test that the black layer is resized in response to root window resizes.
538 TEST_F(PowerButtonControllerTest, ResizeBackgroundLayer) { 548 TEST_F(PowerButtonControllerTest, ResizeBlackLayer) {
539 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 549 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
540 EXPECT_EQ(Shell::GetPrimaryRootWindow()->bounds().ToString(), 550 EXPECT_EQ(Shell::GetPrimaryRootWindow()->bounds().ToString(),
541 test_api_->GetBackgroundLayerBounds().ToString()); 551 test_api_->GetBlackLayerBounds().ToString());
542 552
543 const gfx::Size kNewSize(400, 300); 553 const gfx::Size kNewSize(400, 300);
544 Shell::GetPrimaryRootWindow()->SetHostSize(kNewSize); 554 Shell::GetPrimaryRootWindow()->SetHostSize(kNewSize);
545 EXPECT_EQ(gfx::Rect(kNewSize).ToString(), 555 EXPECT_EQ(gfx::Rect(kNewSize).ToString(),
546 test_api_->GetBackgroundLayerBounds().ToString()); 556 test_api_->GetBlackLayerBounds().ToString());
547 } 557 }
548 558
549 // Test that we ignore power button presses when the screen is turned off. 559 // Test that we ignore power button presses when the screen is turned off.
550 TEST_F(PowerButtonControllerTest, IgnorePowerButtonIfScreenIsOff) { 560 TEST_F(PowerButtonControllerTest, IgnorePowerButtonIfScreenIsOff) {
551 controller_->OnLoginStateChanged(user::LOGGED_IN_USER); 561 controller_->OnLoginStateChanged(user::LOGGED_IN_USER);
552 562
553 // When the screen brightness is at 0%, we shouldn't do anything in response 563 // When the screen brightness is at 0%, we shouldn't do anything in response
554 // to power button presses. 564 // to power button presses.
555 controller_->OnScreenBrightnessChanged(0.0); 565 controller_->OnScreenBrightnessChanged(0.0);
556 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 566 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
557 EXPECT_FALSE(test_api_->lock_timer_is_running()); 567 EXPECT_FALSE(test_api_->lock_timer_is_running());
558 568
559 // After increasing the brightness to 10%, we should start the timer like 569 // After increasing the brightness to 10%, we should start the timer like
560 // usual. 570 // usual.
561 controller_->OnScreenBrightnessChanged(10.0); 571 controller_->OnScreenBrightnessChanged(10.0);
562 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now()); 572 controller_->OnPowerButtonEvent(true, base::TimeTicks::Now());
563 EXPECT_TRUE(test_api_->lock_timer_is_running()); 573 EXPECT_TRUE(test_api_->lock_timer_is_running());
564 } 574 }
565 575
566 } // namespace test 576 } // namespace test
567 } // namespace ash 577 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/power_button_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698