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 "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::GetDebugLogs(base::PlatformFile file,
     25                                          const GetDebugLogsCallback& callback) {
     26   callback.Run(false);
     27 }
     28 
     29 void FakeDebugDaemonClient::SetDebugMode(const std::string& subsystem,
     30                                          const SetDebugModeCallback& callback) {
     31   callback.Run(false);
     32 }
     33 void FakeDebugDaemonClient::StartSystemTracing() {}
     34 
     35 bool FakeDebugDaemonClient::RequestStopSystemTracing(
     36     const StopSystemTracingCallback& callback) {
     37   std::string no_data;
     38   callback.Run(base::RefCountedString::TakeString(&no_data));
     39   return true;
     40 }
     41 
     42 void FakeDebugDaemonClient::GetRoutes(bool numeric,
     43                                       bool ipv6,
     44                                       const GetRoutesCallback& callback) {
     45   std::vector<std::string> empty;
     46   base::MessageLoop::current()->PostTask(FROM_HERE,
     47                                          base::Bind(callback, false, empty));
     48 }
     49 
     50 void FakeDebugDaemonClient::GetNetworkStatus(
     51     const GetNetworkStatusCallback& callback) {
     52   base::MessageLoop::current()->PostTask(FROM_HERE,
     53                                          base::Bind(callback, false, ""));
     54 }
     55 
     56 void FakeDebugDaemonClient::GetModemStatus(
     57     const GetModemStatusCallback& callback) {
     58   base::MessageLoop::current()->PostTask(FROM_HERE,
     59                                          base::Bind(callback, false, ""));
     60 }
     61 
     62 void FakeDebugDaemonClient::GetWiMaxStatus(
     63     const GetWiMaxStatusCallback& callback) {
     64   base::MessageLoop::current()->PostTask(FROM_HERE,
     65                                          base::Bind(callback, false, ""));
     66 }
     67 
     68 void FakeDebugDaemonClient::GetNetworkInterfaces(
     69     const GetNetworkInterfacesCallback& callback) {
     70   base::MessageLoop::current()->PostTask(FROM_HERE,
     71                                          base::Bind(callback, false, ""));
     72 }
     73 
     74 void FakeDebugDaemonClient::GetPerfData(uint32_t duration,
     75                                         const GetPerfDataCallback& callback) {
     76   std::vector<uint8> data;
     77   base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, data));
     78 }
     79 
     80 void FakeDebugDaemonClient::GetScrubbedLogs(const GetLogsCallback& callback) {
     81   std::map<std::string, std::string> sample;
     82   sample["Sample Scrubbed Log"] = "Your email address is xxxxxxxx";
     83   base::MessageLoop::current()->PostTask(FROM_HERE,
     84                                          base::Bind(callback, false, sample));
     85 }
     86 
     87 void FakeDebugDaemonClient::GetAllLogs(const GetLogsCallback& callback) {
     88   std::map<std::string, std::string> sample;
     89   sample["Sample Log"] = "Your email address is abc (at) abc.com";
     90   base::MessageLoop::current()->PostTask(FROM_HERE,
     91                                          base::Bind(callback, false, sample));
     92 }
     93 
     94 void FakeDebugDaemonClient::GetUserLogFiles(const GetLogsCallback& callback) {
     95   std::map<std::string, std::string> user_logs;
     96   user_logs["preferences"] = "Preferences";
     97   user_logs["invalid_file"] = "Invalid File";
     98   base::MessageLoop::current()->PostTask(FROM_HERE,
     99                                          base::Bind(callback, true, user_logs));
    100 }
    101 
    102 void FakeDebugDaemonClient::TestICMP(const std::string& ip_address,
    103                                      const TestICMPCallback& callback) {
    104   base::MessageLoop::current()->PostTask(FROM_HERE,
    105                                          base::Bind(callback, false, ""));
    106 }
    107 
    108 void FakeDebugDaemonClient::TestICMPWithOptions(
    109     const std::string& ip_address,
    110     const std::map<std::string, std::string>& options,
    111     const TestICMPCallback& callback) {
    112   base::MessageLoop::current()->PostTask(FROM_HERE,
    113                                          base::Bind(callback, false, ""));
    114 }
    115 
    116 }  // namespace chromeos
    117