1 // Copyright 2016 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef ASH_WM_LOCK_STATE_CONTROLLER_TEST_API_H_ 6 #define ASH_WM_LOCK_STATE_CONTROLLER_TEST_API_H_ 7 8 #include "ash/wm/lock_state_controller.h" 9 10 namespace ash { 11 12 // Helper class used by tests to access LockStateController's internal state. 13 class LockStateControllerTestApi { 14 public: 15 explicit LockStateControllerTestApi(LockStateController* controller); 16 ~LockStateControllerTestApi(); 17 set_shutdown_controller(ShutdownController * shutdown_controller)18 void set_shutdown_controller(ShutdownController* shutdown_controller) { 19 controller_->shutdown_controller_ = shutdown_controller; 20 } 21 lock_fail_timer_is_running()22 bool lock_fail_timer_is_running() const { 23 return controller_->lock_fail_timer_.IsRunning(); 24 } shutdown_timer_is_running()25 bool shutdown_timer_is_running() const { 26 return controller_->pre_shutdown_timer_.IsRunning(); 27 } real_shutdown_timer_is_running()28 bool real_shutdown_timer_is_running() const { 29 return controller_->real_shutdown_timer_.IsRunning(); 30 } is_animating_lock()31 bool is_animating_lock() const { return controller_->animating_lock_; } 32 trigger_lock_fail_timeout()33 void trigger_lock_fail_timeout() { 34 controller_->OnLockFailTimeout(); 35 controller_->lock_fail_timer_.Stop(); 36 } trigger_shutdown_timeout()37 void trigger_shutdown_timeout() { 38 controller_->OnPreShutdownAnimationTimeout(); 39 controller_->pre_shutdown_timer_.Stop(); 40 } trigger_real_shutdown_timeout()41 void trigger_real_shutdown_timeout() { 42 controller_->OnRealPowerTimeout(); 43 controller_->real_shutdown_timer_.Stop(); 44 } 45 46 private: 47 LockStateController* controller_; // not owned 48 49 DISALLOW_COPY_AND_ASSIGN(LockStateControllerTestApi); 50 }; 51 52 } // namespace ash 53 54 #endif // ASH_WM_LOCK_STATE_CONTROLLER_TEST_API_H_ 55