Index: chromeos/audio/cras_audio_handler_unittest.cc |
diff --git a/chromeos/audio/cras_audio_handler_unittest.cc b/chromeos/audio/cras_audio_handler_unittest.cc |
index ea0b6a7467ba7bc712925314ed502c616d9549d5..1e9a2f725b503ba2e1c6a7abc5b84b13053cb1aa 100644 |
--- a/chromeos/audio/cras_audio_handler_unittest.cc |
+++ b/chromeos/audio/cras_audio_handler_unittest.cc |
@@ -218,7 +218,7 @@ class TestObserver : public chromeos::CrasAudioHandler::AudioObserver { |
} |
void reset_active_input_node_changed_count() { |
- active_output_node_changed_count_ = 0; |
+ active_input_node_changed_count_ = 0; |
} |
int audio_nodes_changed_count() const { |
@@ -2284,4 +2284,28 @@ TEST_F(CrasAudioHandlerTest, |
cras_audio_handler_->GetPrimaryActiveInputNode()); |
} |
+TEST_F(CrasAudioHandlerTest, NoMoreAudioInputDevices) { |
+ // Some device like chromebox does not have the internal input device. The |
+ // active devices should be reset when the user plugs a device and then |
+ // unplugs it to such device. |
+ |
+ AudioNodeList audio_nodes; |
+ audio_nodes.push_back(kInternalSpeaker); |
+ SetUpCrasAudioHandler(audio_nodes); |
+ |
+ EXPECT_EQ(0ULL, cras_audio_handler_->GetPrimaryActiveInputNode()); |
+ |
+ audio_nodes.push_back(kMicJack); |
+ ChangeAudioNodes(audio_nodes); |
+ |
+ EXPECT_EQ(kMicJack.id, cras_audio_handler_->GetPrimaryActiveInputNode()); |
+ EXPECT_EQ(1, test_observer_->active_input_node_changed_count()); |
+ test_observer_->reset_active_input_node_changed_count(); |
+ |
+ audio_nodes.pop_back(); |
+ ChangeAudioNodes(audio_nodes); |
+ EXPECT_EQ(0ULL, cras_audio_handler_->GetPrimaryActiveInputNode()); |
+ EXPECT_EQ(1, test_observer_->active_input_node_changed_count()); |
+} |
+ |
} // namespace chromeos |