[go: nahoru, domu]

blob: 7bdf0ff089e9b7f8e60f87d5899534d16d175acb [file] [log] [blame]
erg8f7f2a62016-11-03 00:20:201// 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
James Cook346c8c62017-07-18 19:38:375#ifndef ASH_WM_LOCK_STATE_CONTROLLER_TEST_API_H_
6#define ASH_WM_LOCK_STATE_CONTROLLER_TEST_API_H_
erg8f7f2a62016-11-03 00:20:207
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
14namespace ash {
15
erg8f7f2a62016-11-03 00:20:2016// Helper class used by tests to access internal state.
17class LockStateControllerTestApi {
18 public:
19 explicit LockStateControllerTestApi(LockStateController* controller);
20 ~LockStateControllerTestApi();
21
jamescookd9f152f2016-11-15 00:53:0822 void set_shutdown_controller(ShutdownController* shutdown_controller) {
23 controller_->shutdown_controller_ = shutdown_controller;
24 }
erg8f7f2a62016-11-03 00:20:2025
26 bool lock_fail_timer_is_running() const {
27 return controller_->lock_fail_timer_.IsRunning();
28 }
29 bool lock_to_shutdown_timer_is_running() const {
30 return controller_->lock_to_shutdown_timer_.IsRunning();
31 }
32 bool shutdown_timer_is_running() const {
33 return controller_->pre_shutdown_timer_.IsRunning();
34 }
35 bool real_shutdown_timer_is_running() const {
36 return controller_->real_shutdown_timer_.IsRunning();
37 }
38 bool is_animating_lock() const { return controller_->animating_lock_; }
39 bool is_lock_cancellable() const {
40 return controller_->CanCancelLockAnimation();
41 }
42
43 void trigger_lock_fail_timeout() {
44 controller_->OnLockFailTimeout();
45 controller_->lock_fail_timer_.Stop();
46 }
47 void trigger_lock_to_shutdown_timeout() {
48 controller_->OnLockToShutdownTimeout();
49 controller_->lock_to_shutdown_timer_.Stop();
50 }
51 void trigger_shutdown_timeout() {
52 controller_->OnPreShutdownAnimationTimeout();
53 controller_->pre_shutdown_timer_.Stop();
54 }
55 void trigger_real_shutdown_timeout() {
56 controller_->OnRealPowerTimeout();
57 controller_->real_shutdown_timer_.Stop();
58 }
59
60 private:
61 LockStateController* controller_; // not owned
62
63 DISALLOW_COPY_AND_ASSIGN(LockStateControllerTestApi);
64};
65
erg8f7f2a62016-11-03 00:20:2066} // namespace ash
67
James Cook346c8c62017-07-18 19:38:3768#endif // ASH_WM_LOCK_STATE_CONTROLLER_TEST_API_H_