Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: chromeos/dbus/fake_power_manager_client.cc

Issue 543303002: chromeos: power: Refactor RendererFreezer and add tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include base/macros.h Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/dbus/fake_power_manager_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/fake_power_manager_client.cc
diff --git a/chromeos/dbus/fake_power_manager_client.cc b/chromeos/dbus/fake_power_manager_client.cc
index 5231cf8e59bb0501e6fdd1d3ea81f4616640dfaa..66b9576db8abedcc51cd22ee618da523e63fcff2 100644
--- a/chromeos/dbus/fake_power_manager_client.cc
+++ b/chromeos/dbus/fake_power_manager_client.cc
@@ -4,6 +4,8 @@
#include "chromeos/dbus/fake_power_manager_client.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/time/time.h"
#include "chromeos/dbus/power_manager/policy.pb.h"
@@ -14,6 +16,7 @@ FakePowerManagerClient::FakePowerManagerClient()
num_request_shutdown_calls_(0),
num_set_policy_calls_(0),
num_set_is_projecting_calls_(0),
+ num_pending_suspend_readiness_callbacks_(0),
is_projecting_(false) {
}
@@ -85,11 +88,14 @@ void FakePowerManagerClient::SetIsProjecting(bool is_projecting) {
}
base::Closure FakePowerManagerClient::GetSuspendReadinessCallback() {
- return base::Closure();
+ ++num_pending_suspend_readiness_callbacks_;
+
+ return base::Bind(&FakePowerManagerClient::HandleSuspendReadiness,
+ base::Unretained(this));
}
int FakePowerManagerClient::GetNumPendingSuspendReadinessCallbacks() {
- return 0;
+ return num_pending_suspend_readiness_callbacks_;
}
void FakePowerManagerClient::SendSuspendImminent() {
@@ -111,4 +117,10 @@ void FakePowerManagerClient::SendPowerButtonEvent(
PowerButtonEventReceived(down, timestamp));
}
+void FakePowerManagerClient::HandleSuspendReadiness() {
+ CHECK(num_pending_suspend_readiness_callbacks_ > 0);
+
+ --num_pending_suspend_readiness_callbacks_;
+}
+
} // namespace chromeos
« no previous file with comments | « chromeos/dbus/fake_power_manager_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698