Index: chromeos/dbus/fake_power_manager_client.h |
diff --git a/chromeos/dbus/fake_power_manager_client.h b/chromeos/dbus/fake_power_manager_client.h |
index d6cd0429f975b899ec2a64fc8f8158dce391a83d..d7b9a4ec0951831bcb8ab9396182456419bc7e33 100644 |
--- a/chromeos/dbus/fake_power_manager_client.h |
+++ b/chromeos/dbus/fake_power_manager_client.h |
@@ -7,10 +7,9 @@ |
#include <string> |
-#include "base/basictypes.h" |
-#include "base/macros.h" |
#include "base/observer_list.h" |
#include "chromeos/dbus/power_manager/policy.pb.h" |
+#include "chromeos/dbus/power_manager/power_supply_properties.pb.h" |
#include "chromeos/dbus/power_manager/suspend.pb.h" |
#include "chromeos/dbus/power_manager_client.h" |
@@ -25,6 +24,7 @@ class FakePowerManagerClient : public PowerManagerClient { |
~FakePowerManagerClient() override; |
power_manager::PowerManagementPolicy& policy() { return policy_; } |
+ const power_manager::PowerSupplyProperties& props() { return props_; } |
int num_request_restart_calls() const { return num_request_restart_calls_; } |
int num_request_shutdown_calls() const { return num_request_shutdown_calls_; } |
int num_set_policy_calls() const { return num_set_policy_calls_; } |
@@ -67,16 +67,29 @@ class FakePowerManagerClient : public PowerManagerClient { |
// Notifies observers that the power button has been pressed or released. |
void SendPowerButtonEvent(bool down, const base::TimeTicks& timestamp); |
+ // Updates the PowerSupplyProperties and notifies observers of its changes. |
+ void UpdatePowerProperties( |
+ int battery_percent, |
+ bool is_calculating_battery_time, |
+ power_manager::PowerSupplyProperties::BatteryState battery_state, |
+ power_manager::PowerSupplyProperties::ExternalPower external_power); |
+ |
private: |
// Callback that will be run by asynchronous suspend delays to report |
// readiness. |
void HandleSuspendReadiness(); |
+ // Notifies |observers_| that |props_| has been updated. |
+ void NotifyObservers(); |
+ |
base::ObserverList<Observer> observers_; |
// Last policy passed to SetPolicy(). |
power_manager::PowerManagementPolicy policy_; |
+ // Power status received from the power manager. |
+ power_manager::PowerSupplyProperties props_; |
+ |
// Number of times that various methods have been called. |
int num_request_restart_calls_; |
int num_request_shutdown_calls_; |