OLD | NEW |
(Empty) | |
| 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_TEST_LOCK_STATE_CONTROLLER_TEST_API_H_ |
| 6 #define ASH_TEST_LOCK_STATE_CONTROLLER_TEST_API_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "ash/wm/lock_state_controller.h" |
| 11 #include "base/timer/elapsed_timer.h" |
| 12 #include "base/timer/timer.h" |
| 13 |
| 14 namespace ash { |
| 15 |
| 16 namespace mojom { |
| 17 class ShutdownClient; |
| 18 } |
| 19 |
| 20 namespace test { |
| 21 |
| 22 // Helper class used by tests to access internal state. |
| 23 class LockStateControllerTestApi { |
| 24 public: |
| 25 explicit LockStateControllerTestApi(LockStateController* controller); |
| 26 ~LockStateControllerTestApi(); |
| 27 |
| 28 void SetShutdownClient(std::unique_ptr<mojom::ShutdownClient> client); |
| 29 |
| 30 bool lock_fail_timer_is_running() const { |
| 31 return controller_->lock_fail_timer_.IsRunning(); |
| 32 } |
| 33 bool lock_to_shutdown_timer_is_running() const { |
| 34 return controller_->lock_to_shutdown_timer_.IsRunning(); |
| 35 } |
| 36 bool shutdown_timer_is_running() const { |
| 37 return controller_->pre_shutdown_timer_.IsRunning(); |
| 38 } |
| 39 bool real_shutdown_timer_is_running() const { |
| 40 return controller_->real_shutdown_timer_.IsRunning(); |
| 41 } |
| 42 bool is_animating_lock() const { return controller_->animating_lock_; } |
| 43 bool is_lock_cancellable() const { |
| 44 return controller_->CanCancelLockAnimation(); |
| 45 } |
| 46 |
| 47 void trigger_lock_fail_timeout() { |
| 48 controller_->OnLockFailTimeout(); |
| 49 controller_->lock_fail_timer_.Stop(); |
| 50 } |
| 51 void trigger_lock_to_shutdown_timeout() { |
| 52 controller_->OnLockToShutdownTimeout(); |
| 53 controller_->lock_to_shutdown_timer_.Stop(); |
| 54 } |
| 55 void trigger_shutdown_timeout() { |
| 56 controller_->OnPreShutdownAnimationTimeout(); |
| 57 controller_->pre_shutdown_timer_.Stop(); |
| 58 } |
| 59 void trigger_real_shutdown_timeout() { |
| 60 controller_->OnRealPowerTimeout(); |
| 61 controller_->real_shutdown_timer_.Stop(); |
| 62 } |
| 63 |
| 64 private: |
| 65 LockStateController* controller_; // not owned |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(LockStateControllerTestApi); |
| 68 }; |
| 69 |
| 70 } // namespace test |
| 71 } // namespace ash |
| 72 |
| 73 #endif // ASH_TEST_LOCK_STATE_CONTROLLER_TEST_API_H_ |
OLD | NEW |