Chromium Code Reviews| 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/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
|
bartfab (slow)
2014/04/23 11:49:30
Nit: No longer used.
Daniel Erat
2014/04/23 14:35:34
Done.
| |
| 13 #include "chromeos/dbus/power_manager/policy.pb.h" | 13 #include "chromeos/dbus/power_manager/policy.pb.h" |
| 14 #include "chromeos/dbus/power_manager/suspend.pb.h" | 14 #include "chromeos/dbus/power_manager/suspend.pb.h" |
| 15 #include "chromeos/dbus/power_manager_client.h" | 15 #include "chromeos/dbus/power_manager_client.h" |
| 16 | 16 |
| 17 namespace chromeos { | 17 namespace chromeos { |
| 18 | 18 |
| 19 // A fake implementation of PowerManagerClient. This remembers the policy passed | 19 // A fake implementation of PowerManagerClient. This remembers the policy passed |
| 20 // 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 |
| 21 // get_policy(). | 21 // get_policy(). |
| 22 class FakePowerManagerClient : public PowerManagerClient { | 22 class FakePowerManagerClient : public PowerManagerClient { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 virtual void RequestShutdown() OVERRIDE; | 56 virtual void RequestShutdown() OVERRIDE; |
| 57 virtual void NotifyUserActivity( | 57 virtual void NotifyUserActivity( |
| 58 power_manager::UserActivityType type) OVERRIDE; | 58 power_manager::UserActivityType type) OVERRIDE; |
| 59 virtual void NotifyVideoActivity(bool is_fullscreen) OVERRIDE; | 59 virtual void NotifyVideoActivity(bool is_fullscreen) OVERRIDE; |
| 60 virtual void SetPolicy( | 60 virtual void SetPolicy( |
| 61 const power_manager::PowerManagementPolicy& policy) OVERRIDE; | 61 const power_manager::PowerManagementPolicy& policy) OVERRIDE; |
| 62 virtual void SetIsProjecting(bool is_projecting) OVERRIDE; | 62 virtual void SetIsProjecting(bool is_projecting) OVERRIDE; |
| 63 virtual base::Closure GetSuspendReadinessCallback() OVERRIDE; | 63 virtual base::Closure GetSuspendReadinessCallback() OVERRIDE; |
| 64 virtual int GetNumPendingSuspendReadinessCallbacks() OVERRIDE; | 64 virtual int GetNumPendingSuspendReadinessCallbacks() OVERRIDE; |
| 65 | 65 |
| 66 // Emulates that the dbus server sends a message "SuspendImminent" to the | 66 // Emulates the power manager announcing that the system is starting or |
| 67 // client. | 67 // completing a suspend attempt. |
| 68 void SendSuspendImminent(); | 68 void SendSuspendImminent(); |
| 69 | 69 void SendSuspendDone(); |
| 70 // Emulates that the dbus server sends a message "SuspendStateChanged" to the | |
| 71 // client. | |
| 72 void SendSuspendStateChanged( | |
| 73 const power_manager::SuspendState& suspend_state); | |
| 74 | 70 |
| 75 private: | 71 private: |
| 76 ObserverList<Observer> observers_; | 72 ObserverList<Observer> observers_; |
| 77 | 73 |
| 78 // Last policy passed to SetPolicy(). | 74 // Last policy passed to SetPolicy(). |
| 79 power_manager::PowerManagementPolicy policy_; | 75 power_manager::PowerManagementPolicy policy_; |
| 80 | 76 |
| 81 // Last time passed to a SUSPEND_TO_MEMORY call to SendSuspendStateChanged(). | |
| 82 base::Time last_suspend_wall_time_; | |
| 83 | |
| 84 // Number of times that RequestRestart() has been called. | 77 // Number of times that RequestRestart() has been called. |
| 85 int num_request_restart_calls_; | 78 int num_request_restart_calls_; |
| 86 | 79 |
| 87 // Number of times that SetPolicy() has been called. | 80 // Number of times that SetPolicy() has been called. |
| 88 int num_set_policy_calls_; | 81 int num_set_policy_calls_; |
| 89 | 82 |
| 90 // Count the number of times SetIsProjecting() has been called. | 83 // Count the number of times SetIsProjecting() has been called. |
| 91 int num_set_is_projecting_calls_; | 84 int num_set_is_projecting_calls_; |
| 92 | 85 |
| 93 // Last projecting state set in SetIsProjecting(). | 86 // Last projecting state set in SetIsProjecting(). |
| 94 bool is_projecting_; | 87 bool is_projecting_; |
| 95 | 88 |
| 96 DISALLOW_COPY_AND_ASSIGN(FakePowerManagerClient); | 89 DISALLOW_COPY_AND_ASSIGN(FakePowerManagerClient); |
| 97 }; | 90 }; |
| 98 | 91 |
| 99 } // namespace chromeos | 92 } // namespace chromeos |
| 100 | 93 |
| 101 #endif // CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ | 94 #endif // CHROMEOS_DBUS_FAKE_POWER_MANAGER_CLIENT_H_ |
| OLD | NEW |