Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1386)

Unified Diff: chromeos/audio/cras_audio_handler_unittest.cc

Issue 751773002: Reset the active audio node id once all of the devices are gone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/audio/cras_audio_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chromeos/audio/cras_audio_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698