File: fake_debug_daemon_client.h

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (167 lines) | stat: -rw-r--r-- 7,550 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMEOS_ASH_COMPONENTS_DBUS_DEBUG_DAEMON_FAKE_DEBUG_DAEMON_CLIENT_H_
#define CHROMEOS_ASH_COMPONENTS_DBUS_DEBUG_DAEMON_FAKE_DEBUG_DAEMON_CLIENT_H_

#include <stdint.h>
#include <sys/types.h>

#include <map>
#include <set>
#include <string>
#include <vector>

#include "base/compiler_specific.h"
#include "base/observer_list.h"
#include "chromeos/ash/components/dbus/debug_daemon/debug_daemon_client.h"
#include "chromeos/dbus/common/dbus_callback.h"

namespace ash {

// The DebugDaemonClient implementation used on Linux desktop,
// which does nothing.
class COMPONENT_EXPORT(DEBUG_DAEMON) FakeDebugDaemonClient
    : public DebugDaemonClient {
 public:
  FakeDebugDaemonClient();

  FakeDebugDaemonClient(const FakeDebugDaemonClient&) = delete;
  FakeDebugDaemonClient& operator=(const FakeDebugDaemonClient&) = delete;

  ~FakeDebugDaemonClient() override;

  void Init(dbus::Bus* bus) override;
  void DumpDebugLogs(bool is_compressed,
                     int file_descriptor,
                     chromeos::VoidDBusMethodCallback callback) override;
  void SetDebugMode(const std::string& subsystem,
                    chromeos::VoidDBusMethodCallback callback) override;
  std::string GetTracingAgentName() override;
  std::string GetTraceEventLabel() override;
  void StartAgentTracing(const base::trace_event::TraceConfig& trace_config,
                         StartAgentTracingCallback callback) override;
  void StopAgentTracing(StopAgentTracingCallback callback) override;
  void SetStopAgentTracingTaskRunner(
      scoped_refptr<base::TaskRunner> task_runner) override;
  void GetRoutes(
      bool numeric,
      bool ipv6,
      bool all_tables,
      chromeos::DBusMethodCallback<std::vector<std::string>> callback) override;
  void SetKstaledRatio(uint8_t val, KstaledRatioCallback callback) override;
  void GetNetworkStatus(
      chromeos::DBusMethodCallback<std::string> callback) override;
  void GetNetworkInterfaces(
      chromeos::DBusMethodCallback<std::string> callback) override;
  void GetPerfOutput(const std::vector<std::string>& quipper_args,
                     bool disable_cpu_idle,
                     int file_descriptor,
                     chromeos::DBusMethodCallback<uint64_t> callback) override;
  void StopPerf(uint64_t session_id,
                chromeos::VoidDBusMethodCallback callback) override;
  void GetFeedbackLogs(
      const cryptohome::AccountIdentifier& id,
      const std::vector<debugd::FeedbackLogType>& requested_logs,
      GetLogsCallback callback) override;
  void GetFeedbackBinaryLogs(
      const cryptohome::AccountIdentifier& id,
      const std::map<debugd::FeedbackBinaryLogType, base::ScopedFD>&
          log_type_fds,
      chromeos::VoidDBusMethodCallback callback) override;
  void BackupArcBugReport(const cryptohome::AccountIdentifier& id,
                          chromeos::VoidDBusMethodCallback callback) override;
  void GetAllLogs(GetLogsCallback callback) override;
  void GetLog(const std::string& log_name,
              chromeos::DBusMethodCallback<std::string> callback) override;
  void TestICMP(const std::string& ip_address,
                TestICMPCallback callback) override;
  void TestICMPWithOptions(const std::string& ip_address,
                           const std::map<std::string, std::string>& options,
                           TestICMPCallback callback) override;
  void UploadCrashes(UploadCrashesCallback callback) override;
  void EnableDebuggingFeatures(const std::string& password,
                               EnableDebuggingCallback callback) override;
  void QueryDebuggingFeatures(QueryDevFeaturesCallback callback) override;
  void RemoveRootfsVerification(EnableDebuggingCallback callback) override;
  void WaitForServiceToBeAvailable(
      chromeos::WaitForServiceToBeAvailableCallback callback) override;
  void SetOomScoreAdj(const std::map<pid_t, int32_t>& pid_to_oom_score_adj,
                      SetOomScoreAdjCallback callback) override;
  void CupsAddManuallyConfiguredPrinter(
      const std::string& name,
      const std::string& uri,
      const std::string& language,
      const std::string& ppd_contents,
      CupsAddPrinterCallback callback) override;
  void CupsAddAutoConfiguredPrinter(const std::string& name,
                                    const std::string& uri,
                                    const std::string& language,
                                    CupsAddPrinterCallback callback) override;
  void CupsRemovePrinter(const std::string& name,
                         CupsRemovePrinterCallback callback,
                         base::OnceClosure error_callback) override;
  // Returns PPD set in CupsAddManuallyConfiguredPrinter or an empty string if
  // the printer was added with CupsAddAutoConfiguredPrinter. If the printer
  // does not exists then `error_callback` is called.
  void CupsRetrievePrinterPpd(const std::string& name,
                              CupsRetrievePrinterPpdCallback callback,
                              base::OnceClosure error_callback) override;
  void StartPluginVmDispatcher(const std::string& owner_id,
                               const std::string& lang,
                               PluginVmDispatcherCallback callback) override;
  void StopPluginVmDispatcher(PluginVmDispatcherCallback callback) override;
  void SetRlzPingSent(SetRlzPingSentCallback callback) override;
  void SetSchedulerConfigurationV2(
      const std::string& config_name,
      bool lock_policy,
      SetSchedulerConfigurationV2Callback callback) override;
  void SetU2fFlags(const std::set<std::string>& flags,
                   chromeos::VoidDBusMethodCallback callback) override;
  void GetU2fFlags(
      chromeos::DBusMethodCallback<std::set<std::string>> callback) override;

  void AddObserver(Observer* observer) override;
  void RemoveObserver(Observer* observer) override;

  void PacketCaptureStartSignalReceived(dbus::Signal* signal) override;
  void PacketCaptureStopSignalReceived(dbus::Signal* signal) override;
  void StopPacketCapture(const std::string& handle) override;

  void BluetoothStartBtsnoop(BluetoothBtsnoopCallback callback) override;
  void BluetoothStopBtsnoop(int fd, BluetoothBtsnoopCallback callback) override;

  // Sets debugging features mask for testing.
  virtual void SetDebuggingFeaturesStatus(int features_mask);

  // Changes the behavior of WaitForServiceToBeAvailable(). This method runs
  // pending callbacks if is_available is true.
  void SetServiceIsAvailable(bool is_available);

  // Sets routes that will be returned by GetRoutes() for testing.
  void SetRoutesForTesting(std::vector<std::string> routes);

  const std::string& scheduler_configuration_name() const {
    return scheduler_configuration_name_;
  }

  const std::set<std::string>& u2f_flags() const { return u2f_flags_; }

 private:
  int features_mask_;

  bool service_is_available_;
  std::vector<chromeos::WaitForServiceToBeAvailableCallback>
      pending_wait_for_service_to_be_available_callbacks_;
  // Stores printer's name as a key and PPD content as a value.
  std::map<std::string, std::string> printers_;
  std::vector<std::string> routes_;
  std::string scheduler_configuration_name_;
  std::set<std::string> u2f_flags_;
  base::ObserverList<Observer> observers_;
};

}  // namespace ash

#endif  // CHROMEOS_ASH_COMPONENTS_DBUS_DEBUG_DAEMON_FAKE_DEBUG_DAEMON_CLIENT_H_