shill: implement stub proxies for upstart and power_manager
The stub proxies will be used on platforms (Android) that doesn't support
upstart and power_manager.
BUG=b:23726070
TEST=Compile shill with the stub proxies.
Change-Id: I8de646197a5dfdf02dac734b80fe0c67ba95b3ce
Reviewed-on: https://chromium-review.googlesource.com/296802
Commit-Ready: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
diff --git a/power_manager_proxy_stub.cc b/power_manager_proxy_stub.cc
new file mode 100644
index 0000000..0bf6461
--- /dev/null
+++ b/power_manager_proxy_stub.cc
@@ -0,0 +1,55 @@
+// Copyright 2015 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "shill/power_manager_proxy_stub.h"
+
+namespace shill {
+
+PowerManagerProxyStub::PowerManagerProxyStub() {}
+
+bool PowerManagerProxyStub::RegisterSuspendDelay(
+ base::TimeDelta /*timeout*/,
+ const std::string& /*description*/,
+ int* /*delay_id_out*/) {
+ // STUB IMPLEMENTATION.
+ return false;
+}
+
+bool PowerManagerProxyStub::UnregisterSuspendDelay(int /*delay_id*/) {
+ // STUB IMPLEMENTATION.
+ return false;
+}
+
+bool PowerManagerProxyStub::ReportSuspendReadiness(int /*delay_id*/,
+ int /*suspend_id*/) {
+ // STUB IMPLEMENTATION.
+ return false;
+}
+
+bool PowerManagerProxyStub::RegisterDarkSuspendDelay(
+ base::TimeDelta /*timeout*/,
+ const std::string& /*description*/,
+ int* /*delay_id_out*/) {
+ // STUB IMPLEMENTATION.
+ return false;
+}
+
+bool PowerManagerProxyStub::UnregisterDarkSuspendDelay(int /*delay_id*/) {
+ // STUB IMPLEMENTATION.
+ return false;
+}
+
+bool PowerManagerProxyStub::ReportDarkSuspendReadiness(int /*delay_id*/,
+ int /*suspend_id*/) {
+ // STUB IMPLEMENTATION.
+ return false;
+}
+
+bool PowerManagerProxyStub::RecordDarkResumeWakeReason(
+ const std::string& /*wake_reason*/) {
+ // STUB IMPLEMENTATION.
+ return false;
+}
+
+} // namespace shill
diff --git a/power_manager_proxy_stub.h b/power_manager_proxy_stub.h
new file mode 100644
index 0000000..b1210dd
--- /dev/null
+++ b/power_manager_proxy_stub.h
@@ -0,0 +1,45 @@
+// Copyright 2015 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_POWER_MANAGER_PROXY_STUB_H_
+#define SHILL_POWER_MANAGER_PROXY_STUB_H_
+
+#include <string>
+
+#include "shill/power_manager_proxy_interface.h"
+
+namespace shill {
+
+// Stub implementation for PowerManagerProxyInterface.
+class PowerManagerProxyStub : public PowerManagerProxyInterface {
+ public:
+ PowerManagerProxyStub();
+ ~PowerManagerProxyStub() override = default;
+
+ // Inherited from PowerManagerProxyInterface.
+ bool RegisterSuspendDelay(base::TimeDelta timeout,
+ const std::string& description,
+ int* delay_id_out) override;
+
+ bool UnregisterSuspendDelay(int delay_id) override;
+
+ bool ReportSuspendReadiness(int delay_id, int suspend_id) override;
+
+ bool RegisterDarkSuspendDelay(base::TimeDelta timeout,
+ const std::string& description,
+ int* delay_id_out) override;
+
+ bool UnregisterDarkSuspendDelay(int delay_id) override;
+
+ bool ReportDarkSuspendReadiness(int delay_id, int suspend_id) override;
+
+ bool RecordDarkResumeWakeReason(const std::string& wake_reason) override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PowerManagerProxyStub);
+};
+
+} // namespace shill
+
+#endif // SHILL_POWER_MANAGER_PROXY_STUB_H_
diff --git a/upstart/upstart_proxy_stub.cc b/upstart/upstart_proxy_stub.cc
new file mode 100644
index 0000000..f468107
--- /dev/null
+++ b/upstart/upstart_proxy_stub.cc
@@ -0,0 +1,19 @@
+// Copyright 2015 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "shill/upstart/upstart_proxy_stub.h"
+
+using std::string;
+using std::vector;
+
+namespace shill {
+
+UpstartProxyStub::UpstartProxyStub() {}
+
+void UpstartProxyStub::EmitEvent(
+ const string& /*name*/, const vector<string>& /*env*/, bool /*wait*/) {
+ // STUB IMPLEMENTATION.
+}
+
+} // namespace shill
diff --git a/upstart/upstart_proxy_stub.h b/upstart/upstart_proxy_stub.h
new file mode 100644
index 0000000..982f359
--- /dev/null
+++ b/upstart/upstart_proxy_stub.h
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_UPSTART_UPSTART_PROXY_STUB_H_
+#define SHILL_UPSTART_UPSTART_PROXY_STUB_H_
+
+#include <string>
+#include <vector>
+
+#include <base/macros.h>
+
+#include "shill/upstart/upstart_proxy_interface.h"
+
+namespace shill {
+
+// Stub implementation of UpstartProxyInterface.
+class UpstartProxyStub : public UpstartProxyInterface {
+ public:
+ UpstartProxyStub();
+ ~UpstartProxyStub() override = default;
+
+ // Inherited from UpstartProxyInterface.
+ void EmitEvent(const std::string& name,
+ const std::vector<std::string>& env,
+ bool wait) override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UpstartProxyStub);
+};
+
+} // namespace shill
+
+#endif // SHILL_UPSTART_UPSTART_PROXY_STUB_H_