Home | History | Annotate | Download | only in dbus
      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/chromeos_export.h"
      9 #include "chromeos/dbus/cras_audio_client.h"
     10 
     11 namespace chromeos {
     12 
     13 class CrasAudioHandlerTest;
     14 
     15 // The CrasAudioClient implementation used on Linux desktop.
     16 class CHROMEOS_EXPORT CrasAudioClientStubImpl : public CrasAudioClient {
     17  public:
     18   CrasAudioClientStubImpl();
     19   virtual ~CrasAudioClientStubImpl();
     20 
     21   // CrasAudioClient overrides:
     22   virtual void Init(dbus::Bus* bus) OVERRIDE;
     23   virtual void AddObserver(Observer* observer) OVERRIDE;
     24   virtual void RemoveObserver(Observer* observer) OVERRIDE;
     25   virtual bool HasObserver(Observer* observer) OVERRIDE;
     26   virtual void GetVolumeState(const GetVolumeStateCallback& callback) OVERRIDE;
     27   virtual void GetNodes(const GetNodesCallback& callback,
     28                         const ErrorCallback& error_callback) OVERRIDE;
     29   virtual void SetOutputNodeVolume(uint64 node_id, int32 volume) OVERRIDE;
     30   virtual void SetOutputUserMute(bool mute_on) OVERRIDE;
     31   virtual void SetInputNodeGain(uint64 node_id, int32 gain) OVERRIDE;
     32   virtual void SetInputMute(bool mute_on) OVERRIDE;
     33   virtual void SetActiveOutputNode(uint64 node_id) OVERRIDE;
     34   virtual void SetActiveInputNode(uint64 node_id) OVERRIDE;
     35   virtual void AddActiveInputNode(uint64 node_id) OVERRIDE;
     36   virtual void RemoveActiveInputNode(uint64 node_id) OVERRIDE;
     37   virtual void AddActiveOutputNode(uint64 node_id) OVERRIDE;
     38   virtual void RemoveActiveOutputNode(uint64 node_id) OVERRIDE;
     39 
     40   // Updates |node_list_| to contain |audio_nodes|.
     41   void SetAudioNodesForTesting(const AudioNodeList& audio_nodes);
     42 
     43   // Calls SetAudioNodesForTesting() and additionally notifies |observers_|.
     44   void SetAudioNodesAndNotifyObserversForTesting(
     45       const AudioNodeList& new_nodes);
     46 
     47  private:
     48   VolumeState volume_state_;
     49   AudioNodeList node_list_;
     50   uint64 active_input_node_id_;
     51   uint64 active_output_node_id_;
     52   ObserverList<Observer> observers_;
     53 
     54   DISALLOW_COPY_AND_ASSIGN(CrasAudioClientStubImpl);
     55 };
     56 
     57 }  // namespace chromeos
     58 
     59 #endif  // CHROMEOS_DBUS_CRAS_AUDIO_CLIENT_STUB_IMPL_H_
     60