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 <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
16 #include "chromeos/chromeos_switches.h" | 16 #include "chromeos/chromeos_switches.h" |
17 | 17 |
| 18 namespace { |
| 19 |
| 20 const char kCrOSTracingAgentName[] = "cros"; |
| 21 const char kCrOSTraceLabel[] = "systemTraceEvents"; |
| 22 |
| 23 } // namespace |
| 24 |
18 namespace chromeos { | 25 namespace chromeos { |
19 | 26 |
20 FakeDebugDaemonClient::FakeDebugDaemonClient() | 27 FakeDebugDaemonClient::FakeDebugDaemonClient() |
21 : featues_mask_(DebugDaemonClient::DEV_FEATURE_NONE), | 28 : featues_mask_(DebugDaemonClient::DEV_FEATURE_NONE), |
22 service_is_available_(true) { | 29 service_is_available_(true) { |
23 } | 30 } |
24 | 31 |
25 FakeDebugDaemonClient::~FakeDebugDaemonClient() {} | 32 FakeDebugDaemonClient::~FakeDebugDaemonClient() {} |
26 | 33 |
27 void FakeDebugDaemonClient::Init(dbus::Bus* bus) {} | 34 void FakeDebugDaemonClient::Init(dbus::Bus* bus) {} |
28 | 35 |
29 void FakeDebugDaemonClient::DumpDebugLogs( | 36 void FakeDebugDaemonClient::DumpDebugLogs( |
30 bool is_compressed, | 37 bool is_compressed, |
31 base::File file, | 38 base::File file, |
32 scoped_refptr<base::TaskRunner> task_runner, | 39 scoped_refptr<base::TaskRunner> task_runner, |
33 const GetDebugLogsCallback& callback) { | 40 const GetDebugLogsCallback& callback) { |
34 callback.Run(true); | 41 callback.Run(true); |
35 } | 42 } |
36 | 43 |
37 void FakeDebugDaemonClient::SetDebugMode(const std::string& subsystem, | 44 void FakeDebugDaemonClient::SetDebugMode(const std::string& subsystem, |
38 const SetDebugModeCallback& callback) { | 45 const SetDebugModeCallback& callback) { |
39 callback.Run(false); | 46 callback.Run(false); |
40 } | 47 } |
41 void FakeDebugDaemonClient::StartSystemTracing() {} | |
42 | 48 |
43 bool FakeDebugDaemonClient::RequestStopSystemTracing( | 49 std::string FakeDebugDaemonClient::GetTracingAgentName() { |
44 scoped_refptr<base::TaskRunner> task_runner, | 50 return kCrOSTracingAgentName; |
45 const StopSystemTracingCallback& callback) { | 51 } |
46 std::string no_data; | 52 |
47 callback.Run(base::RefCountedString::TakeString(&no_data)); | 53 std::string FakeDebugDaemonClient::GetTraceEventLabel() { |
| 54 return kCrOSTraceLabel; |
| 55 } |
| 56 |
| 57 bool FakeDebugDaemonClient::StartAgentTracing( |
| 58 const base::trace_event::TraceConfig& trace_config) { |
48 return true; | 59 return true; |
49 } | 60 } |
50 | 61 |
| 62 void FakeDebugDaemonClient::StopAgentTracing( |
| 63 const StopAgentTracingCallback& callback) { |
| 64 std::string no_data; |
| 65 callback.Run(GetTracingAgentName(), GetTraceEventLabel(), |
| 66 base::RefCountedString::TakeString(&no_data)); |
| 67 } |
| 68 |
| 69 void FakeDebugDaemonClient::SetStopAgentTracingTaskRunner( |
| 70 scoped_refptr<base::TaskRunner> task_runner) {} |
| 71 |
51 void FakeDebugDaemonClient::GetRoutes(bool numeric, | 72 void FakeDebugDaemonClient::GetRoutes(bool numeric, |
52 bool ipv6, | 73 bool ipv6, |
53 const GetRoutesCallback& callback) { | 74 const GetRoutesCallback& callback) { |
54 std::vector<std::string> empty; | 75 std::vector<std::string> empty; |
55 base::ThreadTaskRunnerHandle::Get()->PostTask( | 76 base::ThreadTaskRunnerHandle::Get()->PostTask( |
56 FROM_HERE, base::Bind(callback, false, empty)); | 77 FROM_HERE, base::Bind(callback, false, empty)); |
57 } | 78 } |
58 | 79 |
59 void FakeDebugDaemonClient::GetNetworkStatus( | 80 void FakeDebugDaemonClient::GetNetworkStatus( |
60 const GetNetworkStatusCallback& callback) { | 81 const GetNetworkStatusCallback& callback) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 if (!is_available) | 196 if (!is_available) |
176 return; | 197 return; |
177 | 198 |
178 std::vector<WaitForServiceToBeAvailableCallback> callbacks; | 199 std::vector<WaitForServiceToBeAvailableCallback> callbacks; |
179 callbacks.swap(pending_wait_for_service_to_be_available_callbacks_); | 200 callbacks.swap(pending_wait_for_service_to_be_available_callbacks_); |
180 for (size_t i = 0; i < callbacks.size(); ++i) | 201 for (size_t i = 0; i < callbacks.size(); ++i) |
181 callbacks[i].Run(is_available); | 202 callbacks[i].Run(is_available); |
182 } | 203 } |
183 | 204 |
184 } // namespace chromeos | 205 } // namespace chromeos |
OLD | NEW |