summaryrefslogtreecommitdiffstats
path: root/chromeos
diff options
context:
space:
mode:
authorygorshenin@chromium.org <ygorshenin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-13 09:19:52 +0000
committerygorshenin@chromium.org <ygorshenin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-13 09:19:52 +0000
commit37ce3b0ef4e43d21abeaa2c12c9b8044fab51681 (patch)
tree2f40e1d030a1d3f01bf539b04700ba3e8aac911c /chromeos
parentdf0211a7dd85ada61c4bfa60228e100d6535e37b (diff)
downloadchromium_src-37ce3b0ef4e43d21abeaa2c12c9b8044fab51681.zip
chromium_src-37ce3b0ef4e43d21abeaa2c12c9b8044fab51681.tar.gz
chromium_src-37ce3b0ef4e43d21abeaa2c12c9b8044fab51681.tar.bz2
Added functionality to chrome://net-internals/#chromeos page that user
is able to change network debugging mode without going to crosh. BUG=chromium-os:25701 TEST=Manual testing on Alex device. Review URL: http://codereview.chromium.org/10024056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132163 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r--chromeos/dbus/debug_daemon_client.cc30
-rw-r--r--chromeos/dbus/debug_daemon_client.h10
-rw-r--r--chromeos/dbus/mock_debug_daemon_client.h2
3 files changed, 42 insertions, 0 deletions
diff --git a/chromeos/dbus/debug_daemon_client.cc b/chromeos/dbus/debug_daemon_client.cc
index ea0a0fa..311ad58 100644
--- a/chromeos/dbus/debug_daemon_client.cc
+++ b/chromeos/dbus/debug_daemon_client.cc
@@ -167,6 +167,20 @@ class DebugDaemonClientImpl : public DebugDaemonClient {
callback));
}
+ virtual void SetDebugMode(const std::string& subsystem,
+ const SetDebugModeCallback& callback) OVERRIDE {
+ dbus::MethodCall method_call(debugd::kDebugdInterface,
+ debugd::kSetDebugMode);
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendString(subsystem);
+ debugdaemon_proxy_->CallMethod(
+ &method_call,
+ dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(&DebugDaemonClientImpl::OnSetDebugMode,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback));
+ }
+
virtual void StartSystemTracing() OVERRIDE {
dbus::MethodCall method_call(
debugd::kDebugdInterface,
@@ -226,6 +240,7 @@ class DebugDaemonClientImpl : public DebugDaemonClient {
}
private:
+ // Called when a response for GetDebugLogs() is received.
void OnGetDebugLogs(const GetDebugLogsCallback& callback,
dbus::Response* response) {
if (!response) {
@@ -236,6 +251,17 @@ class DebugDaemonClientImpl : public DebugDaemonClient {
callback.Run(true);
}
+ // Called when a response for SetDebugMode() is received.
+ void OnSetDebugMode(const SetDebugModeCallback& callback,
+ dbus::Response* response) {
+ if (!response) {
+ LOG(ERROR) << "Failed to change debug mode";
+ callback.Run(false);
+ } else {
+ callback.Run(true);
+ }
+ }
+
// Called when a response for StartSystemTracing() is received.
void OnStartSystemTracing(dbus::Response* response) {
if (!response) {
@@ -275,6 +301,10 @@ class DebugDaemonClientStubImpl : public DebugDaemonClient {
const GetDebugLogsCallback& callback) OVERRIDE {
callback.Run(false);
}
+ virtual void SetDebugMode(const std::string& subsystem,
+ const SetDebugModeCallback& callback) OVERRIDE {
+ callback.Run(false);
+ }
virtual void StartSystemTracing() OVERRIDE {}
virtual bool RequestStopSystemTracing(const StopSystemTracingCallback&
callback) OVERRIDE {
diff --git a/chromeos/dbus/debug_daemon_client.h b/chromeos/dbus/debug_daemon_client.h
index cc91a94..637e2a3 100644
--- a/chromeos/dbus/debug_daemon_client.h
+++ b/chromeos/dbus/debug_daemon_client.h
@@ -31,6 +31,16 @@ class CHROMEOS_EXPORT DebugDaemonClient {
virtual void GetDebugLogs(base::PlatformFile file,
const GetDebugLogsCallback& callback) = 0;
+ // Called once SetDebugMode() is complete. Takes one parameter:
+ // - succeeded: debug mode was changed successfully.
+ typedef base::Callback<void(bool succeeded)> SetDebugModeCallback;
+
+ // Requests to change debug mode to given |subsystem| and calls
+ // |callback| when completed. |subsystem| should be one of the
+ // following: "wifi", "ethernet", "cellular" or "none".
+ virtual void SetDebugMode(const std::string& subsystem,
+ const SetDebugModeCallback& callback) = 0;
+
// Requests to start system/kernel tracing.
virtual void StartSystemTracing() = 0;
diff --git a/chromeos/dbus/mock_debug_daemon_client.h b/chromeos/dbus/mock_debug_daemon_client.h
index f55b98f6..c24e1c2 100644
--- a/chromeos/dbus/mock_debug_daemon_client.h
+++ b/chromeos/dbus/mock_debug_daemon_client.h
@@ -17,6 +17,8 @@ class MockDebugDaemonClient : public DebugDaemonClient {
MOCK_METHOD2(GetDebugLogs, void(base::PlatformFile,
const GetDebugLogsCallback&));
+ MOCK_METHOD2(SetDebugMode, void(const std::string&,
+ const SetDebugModeCallback&));
MOCK_METHOD1(RequestStopSystemTracing,
bool(const StopSystemTracingCallback&));
MOCK_METHOD0(StartSystemTracing, void());