| 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), |
| 11 active_output_node_id_(0) { | 11 active_output_node_id_(0) { |
| 12 } | 12 } |
| 13 | 13 |
| 14 FakeCrasAudioClient::~FakeCrasAudioClient() { | 14 FakeCrasAudioClient::~FakeCrasAudioClient() { |
| 15 } | 15 } |
| 16 | 16 |
| 17 void FakeCrasAudioClient::Init(dbus::Bus* bus) { | 17 void FakeCrasAudioClient::Init(dbus::Bus* bus) { |
| 18 VLOG(1) << "FakeCrasAudioClient is created"; | 18 VLOG(1) << "FakeCrasAudioClient is created"; |
| 19 | 19 |
| 20 // Fake audio output nodes. | 20 // Fake audio output nodes. |
| 21 AudioNode output_1; | 21 AudioNode output_1; |
| 22 output_1.is_input = false; | 22 output_1.is_input = false; |
| 23 output_1.id = 10001; | 23 output_1.id = 10001; |
| 24 output_1.stable_device_id = 10001; | 24 output_1.stable_device_id_v1 = 10001; |
| 25 output_1.device_name = "Fake Speaker"; | 25 output_1.device_name = "Fake Speaker"; |
| 26 output_1.type = "INTERNAL_SPEAKER"; | 26 output_1.type = "INTERNAL_SPEAKER"; |
| 27 output_1.name = "Speaker"; | 27 output_1.name = "Speaker"; |
| 28 node_list_.push_back(output_1); | 28 node_list_.push_back(output_1); |
| 29 | 29 |
| 30 AudioNode output_2; | 30 AudioNode output_2; |
| 31 output_2.is_input = false; | 31 output_2.is_input = false; |
| 32 output_2.id = 10002; | 32 output_2.id = 10002; |
| 33 output_2.stable_device_id = 10002; | 33 output_2.stable_device_id_v1 = 10002; |
| 34 output_2.device_name = "Fake Headphone"; | 34 output_2.device_name = "Fake Headphone"; |
| 35 output_2.type = "HEADPHONE"; | 35 output_2.type = "HEADPHONE"; |
| 36 output_2.name = "Headphone"; | 36 output_2.name = "Headphone"; |
| 37 node_list_.push_back(output_2); | 37 node_list_.push_back(output_2); |
| 38 | 38 |
| 39 AudioNode output_3; | 39 AudioNode output_3; |
| 40 output_3.is_input = false; | 40 output_3.is_input = false; |
| 41 output_3.id = 10003; | 41 output_3.id = 10003; |
| 42 output_3.stable_device_id = 10003; | 42 output_3.stable_device_id_v1 = 10003; |
| 43 output_3.device_name = "Fake Bluetooth Headphone"; | 43 output_3.device_name = "Fake Bluetooth Headphone"; |
| 44 output_3.type = "BLUETOOTH"; | 44 output_3.type = "BLUETOOTH"; |
| 45 output_3.name = "Headphone"; | 45 output_3.name = "Headphone"; |
| 46 node_list_.push_back(output_3); | 46 node_list_.push_back(output_3); |
| 47 | 47 |
| 48 AudioNode output_4; | 48 AudioNode output_4; |
| 49 output_4.is_input = false; | 49 output_4.is_input = false; |
| 50 output_4.id = 10004; | 50 output_4.id = 10004; |
| 51 output_4.stable_device_id = 10004; | 51 output_4.stable_device_id_v1 = 10004; |
| 52 output_4.device_name = "Fake HDMI Speaker"; | 52 output_4.device_name = "Fake HDMI Speaker"; |
| 53 output_4.type = "HDMI"; | 53 output_4.type = "HDMI"; |
| 54 output_4.name = "HDMI Speaker"; | 54 output_4.name = "HDMI Speaker"; |
| 55 node_list_.push_back(output_4); | 55 node_list_.push_back(output_4); |
| 56 | 56 |
| 57 // Fake audio input nodes | 57 // Fake audio input nodes |
| 58 AudioNode input_1; | 58 AudioNode input_1; |
| 59 input_1.is_input = true; | 59 input_1.is_input = true; |
| 60 input_1.id = 20001; | 60 input_1.id = 20001; |
| 61 input_1.stable_device_id = 20001; | 61 input_1.stable_device_id_v1 = 20001; |
| 62 input_1.device_name = "Fake Internal Mic"; | 62 input_1.device_name = "Fake Internal Mic"; |
| 63 input_1.type = "INTERNAL_MIC"; | 63 input_1.type = "INTERNAL_MIC"; |
| 64 input_1.name = "Internal Mic"; | 64 input_1.name = "Internal Mic"; |
| 65 node_list_.push_back(input_1); | 65 node_list_.push_back(input_1); |
| 66 | 66 |
| 67 AudioNode input_2; | 67 AudioNode input_2; |
| 68 input_2.is_input = true; | 68 input_2.is_input = true; |
| 69 input_2.id = 20002; | 69 input_2.id = 20002; |
| 70 input_2.stable_device_id = 20002; | 70 input_2.stable_device_id_v1 = 20002; |
| 71 input_2.device_name = "Fake USB Mic"; | 71 input_2.device_name = "Fake USB Mic"; |
| 72 input_2.type = "USB"; | 72 input_2.type = "USB"; |
| 73 input_2.name = "Mic"; | 73 input_2.name = "Mic"; |
| 74 node_list_.push_back(input_2); | 74 node_list_.push_back(input_2); |
| 75 | 75 |
| 76 AudioNode input_3; | 76 AudioNode input_3; |
| 77 input_3.is_input = true; | 77 input_3.is_input = true; |
| 78 input_3.id = 20003; | 78 input_3.id = 20003; |
| 79 input_3.stable_device_id = 20003; | 79 input_3.stable_device_id_v1 = 20003; |
| 80 input_3.device_name = "Fake Mic Jack"; | 80 input_3.device_name = "Fake Mic Jack"; |
| 81 input_3.type = "MIC"; | 81 input_3.type = "MIC"; |
| 82 input_3.name = "Some type of Mic"; | 82 input_3.name = "Some type of Mic"; |
| 83 node_list_.push_back(input_3); | 83 node_list_.push_back(input_3); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void FakeCrasAudioClient::AddObserver(Observer* observer) { | 86 void FakeCrasAudioClient::AddObserver(Observer* observer) { |
| 87 observers_.AddObserver(observer); | 87 observers_.AddObserver(observer); |
| 88 } | 88 } |
| 89 | 89 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 observer.OutputNodeVolumeChanged(node_id, volume); | 232 observer.OutputNodeVolumeChanged(node_id, volume); |
| 233 } | 233 } |
| 234 | 234 |
| 235 AudioNodeList::iterator FakeCrasAudioClient::FindNode(uint64_t node_id) { | 235 AudioNodeList::iterator FakeCrasAudioClient::FindNode(uint64_t node_id) { |
| 236 return std::find_if( | 236 return std::find_if( |
| 237 node_list_.begin(), node_list_.end(), | 237 node_list_.begin(), node_list_.end(), |
| 238 [node_id](const AudioNode& node) { return node_id == node.id; }); | 238 [node_id](const AudioNode& node) { return node_id == node.id; }); |
| 239 } | 239 } |
| 240 | 240 |
| 241 } // namespace chromeos | 241 } // namespace chromeos |
| OLD | NEW |