OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ |
6 #define CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/macros.h" |
11 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
12 #include "chromeos/dbus/power_manager/policy.pb.h" | 13 #include "chromeos/dbus/power_manager/policy.pb.h" |
13 #include "chromeos/dbus/power_manager/suspend.pb.h" | 14 #include "chromeos/dbus/power_manager/suspend.pb.h" |
14 #include "chromeos/dbus/power_manager_client.h" | 15 #include "chromeos/dbus/power_manager_client.h" |
15 | 16 |
16 namespace chromeos { | 17 namespace chromeos { |
17 | 18 |
18 // A fake implementation of PowerManagerClient. This remembers the policy passed | 19 // A fake implementation of PowerManagerClient. This remembers the policy passed |
19 // to SetPolicy() and the user of this class can inspect the last set policy by | 20 // to SetPolicy() and the user of this class can inspect the last set policy by |
20 // get_policy(). | 21 // get_policy(). |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Emulates the power manager announcing that the system is starting or | 61 // Emulates the power manager announcing that the system is starting or |
61 // completing a suspend attempt. | 62 // completing a suspend attempt. |
62 void SendSuspendImminent(); | 63 void SendSuspendImminent(); |
63 void SendSuspendDone(); | 64 void SendSuspendDone(); |
64 void SendDarkSuspendImminent(); | 65 void SendDarkSuspendImminent(); |
65 | 66 |
66 // Notifies observers that the power button has been pressed or released. | 67 // Notifies observers that the power button has been pressed or released. |
67 void SendPowerButtonEvent(bool down, const base::TimeTicks& timestamp); | 68 void SendPowerButtonEvent(bool down, const base::TimeTicks& timestamp); |
68 | 69 |
69 private: | 70 private: |
| 71 // Callback that will be run by asynchronous suspend delays to report |
| 72 // readiness. |
| 73 void HandleSuspendReadiness(); |
| 74 |
70 ObserverList<Observer> observers_; | 75 ObserverList<Observer> observers_; |
71 | 76 |
72 // Last policy passed to SetPolicy(). | 77 // Last policy passed to SetPolicy(). |
73 power_manager::PowerManagementPolicy policy_; | 78 power_manager::PowerManagementPolicy policy_; |
74 | 79 |
75 // Number of times that various methods have been called. | 80 // Number of times that various methods have been called. |
76 int num_request_restart_calls_; | 81 int num_request_restart_calls_; |
77 int num_request_shutdown_calls_; | 82 int num_request_shutdown_calls_; |
78 int num_set_policy_calls_; | 83 int num_set_policy_calls_; |
79 int num_set_is_projecting_calls_; | 84 int num_set_is_projecting_calls_; |
80 | 85 |
| 86 // Number of pending suspend readiness callbacks. |
| 87 int num_pending_suspend_readiness_callbacks_; |
| 88 |
81 // Last projecting state set in SetIsProjecting(). | 89 // Last projecting state set in SetIsProjecting(). |
82 bool is_projecting_; | 90 bool is_projecting_; |
83 | 91 |
84 DISALLOW_COPY_AND_ASSIGN(FakePowerManagerClient); | 92 DISALLOW_COPY_AND_ASSIGN(FakePowerManagerClient); |
85 }; | 93 }; |
86 | 94 |
87 } // namespace chromeos | 95 } // namespace chromeos |
88 | 96 |
89 #endif // CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ | 97 #endif // CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ |
OLD | NEW |