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
3// found in the LICENSE file.
4
5#include "chromeos/dbus/fake_debug_daemon_client.h"
6
7#include <map>
8#include <string>
9#include <vector>
10
11#include "base/bind.h"
12#include "base/callback.h"
13#include "base/location.h"
14#include "base/message_loop/message_loop.h"
15
16namespace chromeos {
17
18FakeDebugDaemonClient::FakeDebugDaemonClient() {}
19
20FakeDebugDaemonClient::~FakeDebugDaemonClient() {}
21
22void FakeDebugDaemonClient::Init(dbus::Bus* bus) {}
23
24void FakeDebugDaemonClient::DumpDebugLogs(
25    bool is_compressed,
26    base::File file,
27    scoped_refptr<base::TaskRunner> task_runner,
28    const GetDebugLogsCallback& callback) {
29  callback.Run(true);
30}
31
32void FakeDebugDaemonClient::SetDebugMode(const std::string& subsystem,
33                                         const SetDebugModeCallback& callback) {
34  callback.Run(false);
35}
36void FakeDebugDaemonClient::StartSystemTracing() {}
37
38bool FakeDebugDaemonClient::RequestStopSystemTracing(
39    scoped_refptr<base::TaskRunner> task_runner,
40    const StopSystemTracingCallback& callback) {
41  std::string no_data;
42  callback.Run(base::RefCountedString::TakeString(&no_data));
43  return true;
44}
45
46void FakeDebugDaemonClient::GetRoutes(bool numeric,
47                                      bool ipv6,
48                                      const GetRoutesCallback& callback) {
49  std::vector<std::string> empty;
50  base::MessageLoop::current()->PostTask(FROM_HERE,
51                                         base::Bind(callback, false, empty));
52}
53
54void FakeDebugDaemonClient::GetNetworkStatus(
55    const GetNetworkStatusCallback& callback) {
56  base::MessageLoop::current()->PostTask(FROM_HERE,
57                                         base::Bind(callback, false, ""));
58}
59
60void FakeDebugDaemonClient::GetModemStatus(
61    const GetModemStatusCallback& callback) {
62  base::MessageLoop::current()->PostTask(FROM_HERE,
63                                         base::Bind(callback, false, ""));
64}
65
66void FakeDebugDaemonClient::GetWiMaxStatus(
67    const GetWiMaxStatusCallback& callback) {
68  base::MessageLoop::current()->PostTask(FROM_HERE,
69                                         base::Bind(callback, false, ""));
70}
71
72void FakeDebugDaemonClient::GetNetworkInterfaces(
73    const GetNetworkInterfacesCallback& callback) {
74  base::MessageLoop::current()->PostTask(FROM_HERE,
75                                         base::Bind(callback, false, ""));
76}
77
78void FakeDebugDaemonClient::GetPerfData(uint32_t duration,
79                                        const GetPerfDataCallback& callback) {
80  std::vector<uint8> data;
81  base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, data));
82}
83
84void FakeDebugDaemonClient::GetScrubbedLogs(const GetLogsCallback& callback) {
85  std::map<std::string, std::string> sample;
86  sample["Sample Scrubbed Log"] = "Your email address is xxxxxxxx";
87  base::MessageLoop::current()->PostTask(FROM_HERE,
88                                         base::Bind(callback, false, sample));
89}
90
91void FakeDebugDaemonClient::GetAllLogs(const GetLogsCallback& callback) {
92  std::map<std::string, std::string> sample;
93  sample["Sample Log"] = "Your email address is abc@abc.com";
94  base::MessageLoop::current()->PostTask(FROM_HERE,
95                                         base::Bind(callback, false, sample));
96}
97
98void FakeDebugDaemonClient::GetUserLogFiles(const GetLogsCallback& callback) {
99  std::map<std::string, std::string> user_logs;
100  user_logs["preferences"] = "Preferences";
101  user_logs["invalid_file"] = "Invalid File";
102  base::MessageLoop::current()->PostTask(FROM_HERE,
103                                         base::Bind(callback, true, user_logs));
104}
105
106void FakeDebugDaemonClient::TestICMP(const std::string& ip_address,
107                                     const TestICMPCallback& callback) {
108  base::MessageLoop::current()->PostTask(FROM_HERE,
109                                         base::Bind(callback, false, ""));
110}
111
112void FakeDebugDaemonClient::TestICMPWithOptions(
113    const std::string& ip_address,
114    const std::map<std::string, std::string>& options,
115    const TestICMPCallback& callback) {
116  base::MessageLoop::current()->PostTask(FROM_HERE,
117                                         base::Bind(callback, false, ""));
118}
119
120void FakeDebugDaemonClient::UploadCrashes() {
121}
122
123}  // namespace chromeos
124