| 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 node_1; | 21 AudioNode output_1; |
| 22 node_1.is_input = false; | 22 output_1.is_input = false; |
| 23 node_1.id = 10001; | 23 output_1.id = 10001; |
| 24 node_1.device_name = "Fake Speaker"; | 24 output_1.device_name = "Fake Speaker"; |
| 25 node_1.type = "INTERNAL_SPEAKER"; | 25 output_1.type = "INTERNAL_SPEAKER"; |
| 26 node_1.name = "Speaker"; | 26 output_1.name = "Speaker"; |
| 27 node_list_.push_back(node_1); | 27 node_list_.push_back(output_1); |
| 28 | 28 |
| 29 AudioNode node_2; | 29 AudioNode output_2; |
| 30 node_2.is_input = false; | 30 output_2.is_input = false; |
| 31 node_2.id = 10002; | 31 output_2.id = 10002; |
| 32 node_2.device_name = "Fake Headphone"; | 32 output_2.device_name = "Fake Headphone"; |
| 33 node_2.type = "HEADPHONE"; | 33 output_2.type = "HEADPHONE"; |
| 34 node_2.name = "Headphone"; | 34 output_2.name = "Headphone"; |
| 35 node_list_.push_back(node_2); | 35 node_list_.push_back(output_2); |
| 36 | 36 |
| 37 AudioNode node_3; | 37 AudioNode output_3; |
| 38 node_3.is_input = false; | 38 output_3.is_input = false; |
| 39 node_3.id = 10003; | 39 output_3.id = 10003; |
| 40 node_3.device_name = "Fake Bluetooth Headphone"; | 40 output_3.device_name = "Fake Bluetooth Headphone"; |
| 41 node_3.type = "BLUETOOTH"; | 41 output_3.type = "BLUETOOTH"; |
| 42 node_3.name = "Headphone"; | 42 output_3.name = "Headphone"; |
| 43 node_list_.push_back(node_3); | 43 node_list_.push_back(output_3); |
| 44 | 44 |
| 45 // Fake audio input ndoes | 45 AudioNode output_4; |
| 46 AudioNode node_4; | 46 output_4.is_input = false; |
| 47 node_4.is_input = true; | 47 output_4.id = 10004; |
| 48 node_4.id = 10004; | 48 output_4.device_name = "Fake HDMI Speaker"; |
| 49 node_4.device_name = "Fake Internal Mic"; | 49 output_4.type = "HDMI"; |
| 50 node_4.type = "INTERNAL_MIC"; | 50 output_4.name = "HDMI Speaker"; |
| 51 node_4.name = "Internal Mic"; | 51 node_list_.push_back(output_4); |
| 52 node_list_.push_back(node_4); | |
| 53 | 52 |
| 54 AudioNode node_5; | 53 // Fake audio input nodes |
| 55 node_5.is_input = true; | 54 AudioNode input_1; |
| 56 node_5.id = 10005; | 55 input_1.is_input = true; |
| 57 node_5.device_name = "Fake USB Mic"; | 56 input_1.id = 20001; |
| 58 node_5.type = "USB"; | 57 input_1.device_name = "Fake Internal Mic"; |
| 59 node_5.name = "Mic"; | 58 input_1.type = "INTERNAL_MIC"; |
| 60 node_list_.push_back(node_5); | 59 input_1.name = "Internal Mic"; |
| 60 node_list_.push_back(input_1); |
| 61 |
| 62 AudioNode input_2; |
| 63 input_2.is_input = true; |
| 64 input_2.id = 20002; |
| 65 input_2.device_name = "Fake USB Mic"; |
| 66 input_2.type = "USB"; |
| 67 input_2.name = "Mic"; |
| 68 node_list_.push_back(input_2); |
| 61 } | 69 } |
| 62 | 70 |
| 63 void FakeCrasAudioClient::AddObserver(Observer* observer) { | 71 void FakeCrasAudioClient::AddObserver(Observer* observer) { |
| 64 observers_.AddObserver(observer); | 72 observers_.AddObserver(observer); |
| 65 } | 73 } |
| 66 | 74 |
| 67 void FakeCrasAudioClient::RemoveObserver(Observer* observer) { | 75 void FakeCrasAudioClient::RemoveObserver(Observer* observer) { |
| 68 observers_.RemoveObserver(observer); | 76 observers_.RemoveObserver(observer); |
| 69 } | 77 } |
| 70 | 78 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 node_list_ = audio_nodes; | 180 node_list_ = audio_nodes; |
| 173 } | 181 } |
| 174 | 182 |
| 175 void FakeCrasAudioClient::SetAudioNodesAndNotifyObserversForTesting( | 183 void FakeCrasAudioClient::SetAudioNodesAndNotifyObserversForTesting( |
| 176 const AudioNodeList& new_nodes) { | 184 const AudioNodeList& new_nodes) { |
| 177 SetAudioNodesForTesting(new_nodes); | 185 SetAudioNodesForTesting(new_nodes); |
| 178 FOR_EACH_OBSERVER(Observer, observers_, NodesChanged()); | 186 FOR_EACH_OBSERVER(Observer, observers_, NodesChanged()); |
| 179 } | 187 } |
| 180 | 188 |
| 181 } // namespace chromeos | 189 } // namespace chromeos |
| OLD | NEW |