PermissionRequestCreatorApiary: switch from deprecated "namespace" to "eventType"
[chromium-blink-merge.git] / chromeos / dbus / fake_audio_dsp_client.cc
blobec9fbf05bc9c9c107692e9133bc89b657eb7c65b
1 // Copyright 2015 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.
5 #include "chromeos/dbus/fake_audio_dsp_client.h"
7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h"
10 namespace chromeos {
12 namespace {
14 void OnVoidDBusMethod(const VoidDBusMethodCallback& callback) {
15 callback.Run(DBUS_METHOD_CALL_SUCCESS);
18 void OnBoolDBusMethod(const BoolDBusMethodCallback& callback) {
19 callback.Run(DBUS_METHOD_CALL_SUCCESS, true);
22 void OnDoubleDBusMethod(
23 const AudioDspClient::DoubleDBusMethodCallback& callback) {
24 callback.Run(DBUS_METHOD_CALL_SUCCESS, 0.0);
27 void OnTwoStringDBusMethod(
28 const AudioDspClient::TwoStringDBusMethodCallback& callback) {
29 callback.Run(DBUS_METHOD_CALL_SUCCESS, std::string(), std::string());
32 void OnThreeStringDBusMethod(
33 const AudioDspClient::ThreeStringDBusMethodCallback& callback) {
34 callback.Run(DBUS_METHOD_CALL_SUCCESS, std::string(), std::string(),
35 std::string());
38 } // anonymous namespace
40 FakeAudioDspClient::FakeAudioDspClient() {
43 FakeAudioDspClient::~FakeAudioDspClient() {
46 void FakeAudioDspClient::Init(dbus::Bus* bus) {
49 void FakeAudioDspClient::AddObserver(Observer* observer) {
52 void FakeAudioDspClient::RemoveObserver(Observer* observer) {
55 void FakeAudioDspClient::Initialize(const BoolDBusMethodCallback& callback) {
56 base::MessageLoop::current()->PostTask(
57 FROM_HERE, base::Bind(&OnBoolDBusMethod, callback));
60 void FakeAudioDspClient::SetStandbyMode(
61 bool standby,
62 const VoidDBusMethodCallback& callback) {
63 base::MessageLoop::current()->PostTask(
64 FROM_HERE, base::Bind(&OnVoidDBusMethod, callback));
67 void FakeAudioDspClient::SetNightMode(bool standby,
68 const VoidDBusMethodCallback& callback) {
69 base::MessageLoop::current()->PostTask(
70 FROM_HERE, base::Bind(&OnVoidDBusMethod, callback));
73 void FakeAudioDspClient::GetNightMode(const BoolDBusMethodCallback& callback) {
74 base::MessageLoop::current()->PostTask(
75 FROM_HERE, base::Bind(&OnBoolDBusMethod, callback));
78 void FakeAudioDspClient::SetTreble(double db_fs,
79 const VoidDBusMethodCallback& callback) {
80 base::MessageLoop::current()->PostTask(
81 FROM_HERE, base::Bind(&OnVoidDBusMethod, callback));
84 void FakeAudioDspClient::GetTreble(const DoubleDBusMethodCallback& callback) {
85 base::MessageLoop::current()->PostTask(
86 FROM_HERE, base::Bind(&OnDoubleDBusMethod, callback));
89 void FakeAudioDspClient::SetBass(double db_fs,
90 const VoidDBusMethodCallback& callback) {
91 base::MessageLoop::current()->PostTask(
92 FROM_HERE, base::Bind(&OnVoidDBusMethod, callback));
95 void FakeAudioDspClient::GetBass(const DoubleDBusMethodCallback& callback) {
96 base::MessageLoop::current()->PostTask(
97 FROM_HERE, base::Bind(&OnDoubleDBusMethod, callback));
100 void FakeAudioDspClient::GetCapabilitiesOEM(
101 const ThreeStringDBusMethodCallback& callback) {
102 base::MessageLoop::current()->PostTask(
103 FROM_HERE, base::Bind(&OnThreeStringDBusMethod, callback));
106 void FakeAudioDspClient::SetCapabilitiesOEM(
107 uint32 speaker_id,
108 const std::string& speaker_capabilities,
109 const std::string& driver_capabilities,
110 const VoidDBusMethodCallback& callback) {
111 base::MessageLoop::current()->PostTask(
112 FROM_HERE, base::Bind(&OnVoidDBusMethod, callback));
115 void FakeAudioDspClient::GetFilterConfigOEM(
116 uint32 speaker_id,
117 const TwoStringDBusMethodCallback& callback) {
118 base::MessageLoop::current()->PostTask(
119 FROM_HERE, base::Bind(&OnTwoStringDBusMethod, callback));
122 void FakeAudioDspClient::SetFilterConfigOEM(
123 const std::string& speaker_config,
124 const std::string& driver_config,
125 const VoidDBusMethodCallback& callback) {
126 base::MessageLoop::current()->PostTask(
127 FROM_HERE, base::Bind(&OnVoidDBusMethod, callback));
130 void FakeAudioDspClient::SetSourceType(uint16 source_type,
131 const VoidDBusMethodCallback& callback) {
132 base::MessageLoop::current()->PostTask(
133 FROM_HERE, base::Bind(&OnVoidDBusMethod, callback));
136 void FakeAudioDspClient::AmplifierVolumeChanged(
137 double db_spl,
138 const VoidDBusMethodCallback& callback) {
139 base::MessageLoop::current()->PostTask(
140 FROM_HERE, base::Bind(&OnVoidDBusMethod, callback));
143 } // namespace chromeos