| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // Updates |node_list_| to contain |audio_nodes|. | 56 // Updates |node_list_| to contain |audio_nodes|. |
| 57 void SetAudioNodesForTesting(const AudioNodeList& audio_nodes); | 57 void SetAudioNodesForTesting(const AudioNodeList& audio_nodes); |
| 58 | 58 |
| 59 // Calls SetAudioNodesForTesting() and additionally notifies |observers_|. | 59 // Calls SetAudioNodesForTesting() and additionally notifies |observers_|. |
| 60 void SetAudioNodesAndNotifyObserversForTesting( | 60 void SetAudioNodesAndNotifyObserversForTesting( |
| 61 const AudioNodeList& new_nodes); | 61 const AudioNodeList& new_nodes); |
| 62 | 62 |
| 63 // Generates fake signal for OutputNodeVolumeChanged. | 63 // Generates fake signal for OutputNodeVolumeChanged. |
| 64 void NotifyOutputNodeVolumeChangedForTesting(uint64_t node_id, int volume); | 64 void NotifyOutputNodeVolumeChangedForTesting(uint64_t node_id, int volume); |
| 65 | 65 |
| 66 // Generates fake signal for AudioClientRestarted. |
| 67 void NotifyAudioClientRestartedForTesting(); |
| 68 |
| 66 const AudioNodeList& node_list() const { return node_list_; } | 69 const AudioNodeList& node_list() const { return node_list_; } |
| 67 const uint64_t& active_input_node_id() const { return active_input_node_id_; } | 70 const uint64_t& active_input_node_id() const { return active_input_node_id_; } |
| 68 const uint64_t& active_output_node_id() const { | 71 const uint64_t& active_output_node_id() const { |
| 69 return active_output_node_id_; | 72 return active_output_node_id_; |
| 70 } | 73 } |
| 71 void set_notify_volume_change_with_delay(bool notify_with_delay) { | 74 void set_notify_volume_change_with_delay(bool notify_with_delay) { |
| 72 notify_volume_change_with_delay_ = notify_with_delay; | 75 notify_volume_change_with_delay_ = notify_with_delay; |
| 73 } | 76 } |
| 74 | 77 |
| 75 private: | 78 private: |
| 76 // Finds a node in the list based on the id. | 79 // Finds a node in the list based on the id. |
| 77 AudioNodeList::iterator FindNode(uint64_t node_id); | 80 AudioNodeList::iterator FindNode(uint64_t node_id); |
| 78 | 81 |
| 79 VolumeState volume_state_; | 82 VolumeState volume_state_; |
| 80 AudioNodeList node_list_; | 83 AudioNodeList node_list_; |
| 81 uint64_t active_input_node_id_; | 84 uint64_t active_input_node_id_; |
| 82 uint64_t active_output_node_id_; | 85 uint64_t active_output_node_id_; |
| 83 // By default, immediately sends OutputNodeVolumeChange signal following the | 86 // By default, immediately sends OutputNodeVolumeChange signal following the |
| 84 // SetOutputNodeVolume fake dbus call. | 87 // SetOutputNodeVolume fake dbus call. |
| 85 bool notify_volume_change_with_delay_ = false; | 88 bool notify_volume_change_with_delay_ = false; |
| 86 base::ObserverList<Observer> observers_; | 89 base::ObserverList<Observer> observers_; |
| 87 | 90 |
| 88 DISALLOW_COPY_AND_ASSIGN(FakeCrasAudioClient); | 91 DISALLOW_COPY_AND_ASSIGN(FakeCrasAudioClient); |
| 89 }; | 92 }; |
| 90 | 93 |
| 91 } // namespace chromeos | 94 } // namespace chromeos |
| 92 | 95 |
| 93 #endif // CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ | 96 #endif // CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ |
| OLD | NEW |