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_CRAS_AUDIO_CLIENT_STUB_IMPL_H_
6 #define CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_STUB_IMPL_H_
8 #include "chromeos/dbus/cras_audio_client.h"
12 class CrasAudioHandlerTest
;
14 // The CrasAudioClient implementation used on Linux desktop.
15 class CrasAudioClientStubImpl
: public CrasAudioClient
{
17 CrasAudioClientStubImpl();
18 virtual ~CrasAudioClientStubImpl();
20 // CrasAudioClient overrides
21 virtual void Init(dbus::Bus
* bus
) OVERRIDE
;
22 virtual void AddObserver(Observer
* observer
) OVERRIDE
;
23 virtual void RemoveObserver(Observer
* observer
) OVERRIDE
;
24 virtual bool HasObserver(Observer
* observer
) OVERRIDE
;
25 virtual void GetVolumeState(const GetVolumeStateCallback
& callback
) OVERRIDE
;
26 virtual void GetNodes(const GetNodesCallback
& callback
,
27 const ErrorCallback
& error_callback
) OVERRIDE
;
28 virtual void SetOutputNodeVolume(uint64 node_id
, int32 volume
) OVERRIDE
;
29 virtual void SetOutputUserMute(bool mute_on
) OVERRIDE
;
30 virtual void SetInputNodeGain(uint64 node_id
, int32 gain
) OVERRIDE
;
31 virtual void SetInputMute(bool mute_on
) OVERRIDE
;
32 virtual void SetActiveOutputNode(uint64 node_id
) OVERRIDE
;
33 virtual void SetActiveInputNode(uint64 node_id
) OVERRIDE
;
34 virtual void AddActiveInputNode(uint64 node_id
) OVERRIDE
;
35 virtual void RemoveActiveInputNode(uint64 node_id
) OVERRIDE
;
36 virtual void AddActiveOutputNode(uint64 node_id
) OVERRIDE
;
37 virtual void RemoveActiveOutputNode(uint64 node_id
) OVERRIDE
;
40 // Helper functions for testing
41 virtual void SetAudioDevices(const AudioNodeList
& audio_nodes
);
42 virtual void ChangeAudioNodes(const AudioNodeList
& new_nodes
);
45 friend class CrasAudioHandlerTest
;
47 VolumeState volume_state_
;
48 AudioNodeList node_list_
;
49 uint64 active_input_node_id_
;
50 uint64 active_output_node_id_
;
51 ObserverList
<Observer
> observers_
;
53 DISALLOW_COPY_AND_ASSIGN(CrasAudioClientStubImpl
);
56 } // namespace chromeos
58 #endif // CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_STUB_IMPL_H_