Home | History | Annotate | Download | only in dbus
      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 
     16 namespace chromeos {
     17 
     18 FakeDebugDaemonClient::FakeDebugDaemonClient() {}
     19 
     20 FakeDebugDaemonClient::~FakeDebugDaemonClient() {}
     21 
     22 void FakeDebugDaemonClient::Init(dbus::Bus* bus) {}
     23 
     24 void 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 
     32 void FakeDebugDaemonClient::SetDebugMode(const std::string& subsystem,
     33                                          const SetDebugModeCallback& callback) {
     34   callback.Run(false);
     35 }
     36 void FakeDebugDaemonClient::StartSystemTracing() {}
     37 
     38 bool 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 
     46 void 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 
     54 void FakeDebugDaemonClient::GetNetworkStatus(
     55     const GetNetworkStatusCallback& callback) {
     56   base::MessageLoop::current()->PostTask(FROM_HERE,
     57                                          base::Bind(callback, false, ""));
     58 }
     59 
     60 void FakeDebugDaemonClient::GetModemStatus(
     61     const GetModemStatusCallback& callback) {
     62   base::MessageLoop::current()->PostTask(FROM_HERE,
     63                                          base::Bind(callback, false, ""));
     64 }
     65 
     66 void FakeDebugDaemonClient::GetWiMaxStatus(
     67     const GetWiMaxStatusCallback& callback) {
     68   base::MessageLoop::current()->PostTask(FROM_HERE,
     69                                          base::Bind(callback, false, ""));
     70 }
     71 
     72 void FakeDebugDaemonClient::GetNetworkInterfaces(
     73     const GetNetworkInterfacesCallback& callback) {
     74   base::MessageLoop::current()->PostTask(FROM_HERE,
     75                                          base::Bind(callback, false, ""));
     76 }
     77 
     78 void 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 
     84 void 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 
     91 void FakeDebugDaemonClient::GetAllLogs(const GetLogsCallback& callback) {
     92   std::map<std::string, std::string> sample;
     93   sample["Sample Log"] = "Your email address is abc (at) abc.com";
     94   base::MessageLoop::current()->PostTask(FROM_HERE,
     95                                          base::Bind(callback, false, sample));
     96 }
     97 
     98 void 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 
    106 void 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 
    112 void 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 
    120 void FakeDebugDaemonClient::UploadCrashes() {
    121 }
    122 
    123 }  // namespace chromeos
    124