1 // Copyright (c) 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.
5 #ifndef CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_
8 #include "chromeos/chromeos_export.h"
9 #include "chromeos/dbus/cras_audio_client.h"
13 class CrasAudioHandlerTest
;
15 // The CrasAudioClient implementation used on Linux desktop.
16 class CHROMEOS_EXPORT FakeCrasAudioClient
: public CrasAudioClient
{
18 FakeCrasAudioClient();
19 ~FakeCrasAudioClient() override
;
21 // CrasAudioClient overrides:
22 void Init(dbus::Bus
* bus
) override
;
23 void AddObserver(Observer
* observer
) override
;
24 void RemoveObserver(Observer
* observer
) override
;
25 bool HasObserver(const Observer
* observer
) const override
;
26 void GetVolumeState(const GetVolumeStateCallback
& callback
) override
;
27 void GetNodes(const GetNodesCallback
& callback
,
28 const ErrorCallback
& error_callback
) override
;
29 void SetOutputNodeVolume(uint64 node_id
, int32 volume
) override
;
30 void SetOutputUserMute(bool mute_on
) override
;
31 void SetInputNodeGain(uint64 node_id
, int32 gain
) override
;
32 void SetInputMute(bool mute_on
) override
;
33 void SetActiveOutputNode(uint64 node_id
) override
;
34 void SetActiveInputNode(uint64 node_id
) override
;
35 void AddActiveInputNode(uint64 node_id
) override
;
36 void RemoveActiveInputNode(uint64 node_id
) override
;
37 void AddActiveOutputNode(uint64 node_id
) override
;
38 void RemoveActiveOutputNode(uint64 node_id
) override
;
39 void SwapLeftRight(uint64 node_id
, bool swap
) override
;
41 // Updates |node_list_| to contain |audio_nodes|.
42 void SetAudioNodesForTesting(const AudioNodeList
& audio_nodes
);
44 // Calls SetAudioNodesForTesting() and additionally notifies |observers_|.
45 void SetAudioNodesAndNotifyObserversForTesting(
46 const AudioNodeList
& new_nodes
);
49 VolumeState volume_state_
;
50 AudioNodeList node_list_
;
51 uint64 active_input_node_id_
;
52 uint64 active_output_node_id_
;
53 base::ObserverList
<Observer
> observers_
;
55 DISALLOW_COPY_AND_ASSIGN(FakeCrasAudioClient
);
58 } // namespace chromeos
60 #endif // CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_