| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "chromeos/dbus/fake_debug_daemon_client.h" | 5 #include "chromeos/dbus/fake_debug_daemon_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/location.h" | 16 #include "base/location.h" |
| 17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 18 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
| 19 #include "chromeos/chromeos_switches.h" | 19 #include "chromeos/chromeos_switches.h" |
| 20 #include "dbus/file_descriptor.h" | |
| 21 | 20 |
| 22 namespace { | 21 namespace { |
| 23 | 22 |
| 24 const char kCrOSTracingAgentName[] = "cros"; | 23 const char kCrOSTracingAgentName[] = "cros"; |
| 25 const char kCrOSTraceLabel[] = "systemTraceEvents"; | 24 const char kCrOSTraceLabel[] = "systemTraceEvents"; |
| 26 | 25 |
| 27 } // namespace | 26 } // namespace |
| 28 | 27 |
| 29 namespace chromeos { | 28 namespace chromeos { |
| 30 | 29 |
| 31 FakeDebugDaemonClient::FakeDebugDaemonClient() | 30 FakeDebugDaemonClient::FakeDebugDaemonClient() |
| 32 : featues_mask_(DebugDaemonClient::DEV_FEATURE_NONE), | 31 : featues_mask_(DebugDaemonClient::DEV_FEATURE_NONE), |
| 33 service_is_available_(true) { | 32 service_is_available_(true) { |
| 34 } | 33 } |
| 35 | 34 |
| 36 FakeDebugDaemonClient::~FakeDebugDaemonClient() {} | 35 FakeDebugDaemonClient::~FakeDebugDaemonClient() {} |
| 37 | 36 |
| 38 void FakeDebugDaemonClient::Init(dbus::Bus* bus) {} | 37 void FakeDebugDaemonClient::Init(dbus::Bus* bus) {} |
| 39 | 38 |
| 40 void FakeDebugDaemonClient::DumpDebugLogs( | 39 void FakeDebugDaemonClient::DumpDebugLogs( |
| 41 bool is_compressed, | 40 bool is_compressed, |
| 42 base::File file, | 41 int file_descriptor, |
| 43 scoped_refptr<base::TaskRunner> task_runner, | |
| 44 const GetDebugLogsCallback& callback) { | 42 const GetDebugLogsCallback& callback) { |
| 45 callback.Run(true); | 43 callback.Run(true); |
| 46 } | 44 } |
| 47 | 45 |
| 48 void FakeDebugDaemonClient::SetDebugMode(const std::string& subsystem, | 46 void FakeDebugDaemonClient::SetDebugMode(const std::string& subsystem, |
| 49 const SetDebugModeCallback& callback) { | 47 const SetDebugModeCallback& callback) { |
| 50 callback.Run(false); | 48 callback.Run(false); |
| 51 } | 49 } |
| 52 | 50 |
| 53 std::string FakeDebugDaemonClient::GetTracingAgentName() { | 51 std::string FakeDebugDaemonClient::GetTracingAgentName() { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 102 |
| 105 void FakeDebugDaemonClient::GetNetworkInterfaces( | 103 void FakeDebugDaemonClient::GetNetworkInterfaces( |
| 106 const GetNetworkInterfacesCallback& callback) { | 104 const GetNetworkInterfacesCallback& callback) { |
| 107 base::ThreadTaskRunnerHandle::Get()->PostTask( | 105 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 108 FROM_HERE, base::Bind(callback, false, "")); | 106 FROM_HERE, base::Bind(callback, false, "")); |
| 109 } | 107 } |
| 110 | 108 |
| 111 void FakeDebugDaemonClient::GetPerfOutput( | 109 void FakeDebugDaemonClient::GetPerfOutput( |
| 112 base::TimeDelta duration, | 110 base::TimeDelta duration, |
| 113 const std::vector<std::string>& perf_args, | 111 const std::vector<std::string>& perf_args, |
| 114 dbus::ScopedFileDescriptor file_descriptor, | 112 int file_descriptor, |
| 115 const DBusMethodErrorCallback& error_callback) { | 113 const DBusMethodErrorCallback& error_callback) {} |
| 116 // Nothing to do but close the file descriptor, which its dtor will do. | |
| 117 } | |
| 118 | 114 |
| 119 void FakeDebugDaemonClient::GetScrubbedLogs(const GetLogsCallback& callback) { | 115 void FakeDebugDaemonClient::GetScrubbedLogs(const GetLogsCallback& callback) { |
| 120 std::map<std::string, std::string> sample; | 116 std::map<std::string, std::string> sample; |
| 121 sample["Sample Scrubbed Log"] = "Your email address is xxxxxxxx"; | 117 sample["Sample Scrubbed Log"] = "Your email address is xxxxxxxx"; |
| 122 base::ThreadTaskRunnerHandle::Get()->PostTask( | 118 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 123 FROM_HERE, base::Bind(callback, false, sample)); | 119 FROM_HERE, base::Bind(callback, false, sample)); |
| 124 } | 120 } |
| 125 | 121 |
| 126 void FakeDebugDaemonClient::GetScrubbedBigLogs( | 122 void FakeDebugDaemonClient::GetScrubbedBigLogs( |
| 127 const GetLogsCallback& callback) { | 123 const GetLogsCallback& callback) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 if (!is_available) | 204 if (!is_available) |
| 209 return; | 205 return; |
| 210 | 206 |
| 211 std::vector<WaitForServiceToBeAvailableCallback> callbacks; | 207 std::vector<WaitForServiceToBeAvailableCallback> callbacks; |
| 212 callbacks.swap(pending_wait_for_service_to_be_available_callbacks_); | 208 callbacks.swap(pending_wait_for_service_to_be_available_callbacks_); |
| 213 for (size_t i = 0; i < callbacks.size(); ++i) | 209 for (size_t i = 0; i < callbacks.size(); ++i) |
| 214 callbacks[i].Run(is_available); | 210 callbacks[i].Run(is_available); |
| 215 } | 211 } |
| 216 | 212 |
| 217 } // namespace chromeos | 213 } // namespace chromeos |
| OLD | NEW |