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. 4 5 #ifndef CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_STUB_IMPL_H_ 6 #define CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_STUB_IMPL_H_ 7 8 #include "chromeos/dbus/cras_audio_client.h" 9 10 namespace chromeos { 11 12 class CrasAudioHandlerTest; 13 14 // The CrasAudioClient implementation used on Linux desktop. 15 class CrasAudioClientStubImpl : public CrasAudioClient { 16 public: 17 CrasAudioClientStubImpl(); 18 virtual ~CrasAudioClientStubImpl(); 19 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 35 protected: 36 // Helper functions for testing 37 virtual void SetAudioDevices(const AudioNodeList& audio_nodes); 38 virtual void ChangeAudioNodes(const AudioNodeList& new_nodes); 39 40 private: 41 friend class CrasAudioHandlerTest; 42 43 VolumeState volume_state_; 44 AudioNodeList node_list_; 45 uint64 active_input_node_id_; 46 uint64 active_output_node_id_; 47 ObserverList<Observer> observers_; 48 49 DISALLOW_COPY_AND_ASSIGN(CrasAudioClientStubImpl); 50 }; 51 52 } // namespace chromeos 53 54 #endif // CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_STUB_IMPL_H_ 55