| 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 #include "chromeos/dbus/fake_cras_audio_client.h" | 5 #include "chromeos/dbus/fake_cras_audio_client.h" |
| 6 | 6 |
| 7 namespace chromeos { | 7 namespace chromeos { |
| 8 | 8 |
| 9 FakeCrasAudioClient::FakeCrasAudioClient() | 9 FakeCrasAudioClient::FakeCrasAudioClient() |
| 10 : active_input_node_id_(0), | 10 : active_input_node_id_(0), |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 const GetVolumeStateCallback& callback) { | 99 const GetVolumeStateCallback& callback) { |
| 100 callback.Run(volume_state_, true); | 100 callback.Run(volume_state_, true); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void FakeCrasAudioClient::GetNodes(const GetNodesCallback& callback, | 103 void FakeCrasAudioClient::GetNodes(const GetNodesCallback& callback, |
| 104 const ErrorCallback& error_callback) { | 104 const ErrorCallback& error_callback) { |
| 105 callback.Run(node_list_, true); | 105 callback.Run(node_list_, true); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void FakeCrasAudioClient::SetOutputNodeVolume(uint64_t node_id, | 108 void FakeCrasAudioClient::SetOutputNodeVolume(uint64_t node_id, |
| 109 int32_t volume) {} | 109 int32_t volume) { |
| 110 if (!notify_volume_change_with_delay_) |
| 111 NotifyOutputNodeVolumeChangedForTesting(node_id, volume); |
| 112 } |
| 110 | 113 |
| 111 void FakeCrasAudioClient::SetOutputUserMute(bool mute_on) { | 114 void FakeCrasAudioClient::SetOutputUserMute(bool mute_on) { |
| 112 volume_state_.output_user_mute = mute_on; | 115 volume_state_.output_user_mute = mute_on; |
| 113 FOR_EACH_OBSERVER(Observer, observers_, | 116 FOR_EACH_OBSERVER(Observer, observers_, |
| 114 OutputMuteChanged(volume_state_.output_user_mute)); | 117 OutputMuteChanged(volume_state_.output_user_mute)); |
| 115 } | 118 } |
| 116 | 119 |
| 117 void FakeCrasAudioClient::SetInputNodeGain(uint64_t node_id, | 120 void FakeCrasAudioClient::SetInputNodeGain(uint64_t node_id, |
| 118 int32_t input_gain) {} | 121 int32_t input_gain) {} |
| 119 | 122 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 const AudioNodeList& audio_nodes) { | 213 const AudioNodeList& audio_nodes) { |
| 211 node_list_ = audio_nodes; | 214 node_list_ = audio_nodes; |
| 212 } | 215 } |
| 213 | 216 |
| 214 void FakeCrasAudioClient::SetAudioNodesAndNotifyObserversForTesting( | 217 void FakeCrasAudioClient::SetAudioNodesAndNotifyObserversForTesting( |
| 215 const AudioNodeList& new_nodes) { | 218 const AudioNodeList& new_nodes) { |
| 216 SetAudioNodesForTesting(new_nodes); | 219 SetAudioNodesForTesting(new_nodes); |
| 217 FOR_EACH_OBSERVER(Observer, observers_, NodesChanged()); | 220 FOR_EACH_OBSERVER(Observer, observers_, NodesChanged()); |
| 218 } | 221 } |
| 219 | 222 |
| 223 void FakeCrasAudioClient::NotifyOutputNodeVolumeChangedForTesting( |
| 224 uint64_t node_id, |
| 225 int volume) { |
| 226 FOR_EACH_OBSERVER(Observer, observers_, |
| 227 OutputNodeVolumeChanged(node_id, volume)); |
| 228 } |
| 229 |
| 220 AudioNodeList::iterator FakeCrasAudioClient::FindNode(uint64_t node_id) { | 230 AudioNodeList::iterator FakeCrasAudioClient::FindNode(uint64_t node_id) { |
| 221 return std::find_if( | 231 return std::find_if( |
| 222 node_list_.begin(), node_list_.end(), | 232 node_list_.begin(), node_list_.end(), |
| 223 [node_id](const AudioNode& node) { return node_id == node.id; }); | 233 [node_id](const AudioNode& node) { return node_id == node.id; }); |
| 224 } | 234 } |
| 225 | 235 |
| 226 } // namespace chromeos | 236 } // namespace chromeos |
| OLD | NEW |