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

Unified Diff: chromeos/audio/audio_devices_pref_handler_impl_unittest.cc

Issue 1380103003: Store audio device's active state in preference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix string format Created 4 years, 11 months 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/audio_devices_pref_handler_impl.cc ('k') | chromeos/audio/audio_devices_pref_handler_stub.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/audio/audio_devices_pref_handler_impl_unittest.cc
diff --git a/chromeos/audio/audio_devices_pref_handler_impl_unittest.cc b/chromeos/audio/audio_devices_pref_handler_impl_unittest.cc
index a4a97da8550f3ee1fa2b1ffee3c39d9fb9e5a2d2..dea358f507d141001329178f86f545b5bfd1e604 100644
--- a/chromeos/audio/audio_devices_pref_handler_impl_unittest.cc
+++ b/chromeos/audio/audio_devices_pref_handler_impl_unittest.cc
@@ -25,6 +25,7 @@ const uint64_t kOtherTypeInputId = 90002;
const AudioDevice kInternalMic(AudioNode(true,
kInternalMicId,
+ kInternalMicId,
"Fake Mic",
"INTERNAL_MIC",
"Internal Mic",
@@ -33,6 +34,7 @@ const AudioDevice kInternalMic(AudioNode(true,
const AudioDevice kHeadphone(AudioNode(false,
kHeadphoneId,
+ kHeadphoneId,
"Fake Headphone",
"HEADPHONE",
"Headphone",
@@ -41,6 +43,7 @@ const AudioDevice kHeadphone(AudioNode(false,
const AudioDevice kHDMIOutput(AudioNode(false,
kHDMIOutputId,
+ kHDMIOutputId,
"HDMI output",
"HDMI",
"HDMI output",
@@ -50,6 +53,7 @@ const AudioDevice kHDMIOutput(AudioNode(false,
const AudioDevice kInputDeviceWithSpecialCharacters(
AudioNode(true,
kOtherTypeInputId,
+ kOtherTypeInputId,
"Fake ~!@#$%^&*()_+`-=<>?,./{}|[]\\\\Mic",
"SOME_OTHER_TYPE",
"Other Type Input Device",
@@ -59,6 +63,7 @@ const AudioDevice kInputDeviceWithSpecialCharacters(
const AudioDevice kOutputDeviceWithSpecialCharacters(
AudioNode(false,
kOtherTypeOutputId,
+ kOtherTypeOutputId,
"Fake ~!@#$%^&*()_+`-=<>?,./{}|[]\\\\Headphone",
"SOME_OTHER_TYPE",
"Other Type Output Device",
@@ -92,6 +97,12 @@ TEST_F(AudioDevicesPrefHandlerTest, TestDefaultValues) {
EXPECT_EQ(75.0, audio_pref_handler_->GetInputGainValue(&kInternalMic));
EXPECT_EQ(75.0, audio_pref_handler_->GetOutputVolumeValue(&kHeadphone));
EXPECT_EQ(75.0, audio_pref_handler_->GetOutputVolumeValue(&kHDMIOutput));
+ EXPECT_EQ(AUDIO_STATE_NOT_AVAILABLE,
+ audio_pref_handler_->GetDeviceState(kInternalMic));
+ EXPECT_EQ(AUDIO_STATE_NOT_AVAILABLE,
+ audio_pref_handler_->GetDeviceState(kHeadphone));
+ EXPECT_EQ(AUDIO_STATE_NOT_AVAILABLE,
+ audio_pref_handler_->GetDeviceState(kHDMIOutput));
}
TEST_F(AudioDevicesPrefHandlerTest, PrefsRegistered) {
@@ -101,6 +112,7 @@ TEST_F(AudioDevicesPrefHandlerTest, PrefsRegistered) {
EXPECT_TRUE(pref_service_->FindPreference(prefs::kAudioOutputAllowed));
EXPECT_TRUE(pref_service_->FindPreference(prefs::kAudioVolumePercent));
EXPECT_TRUE(pref_service_->FindPreference(prefs::kAudioMute));
+ EXPECT_TRUE(pref_service_->FindPreference(prefs::kAudioDevicesState));
}
TEST_F(AudioDevicesPrefHandlerTest, TestBasicInputOutputDevices) {
@@ -122,4 +134,16 @@ TEST_F(AudioDevicesPrefHandlerTest, TestSpecialCharactersInDeviceNames) {
&kOutputDeviceWithSpecialCharacters));
}
+TEST_F(AudioDevicesPrefHandlerTest, TestDeviceStates) {
+ audio_pref_handler_->SetDeviceState(kInternalMic, AUDIO_STATE_NOT_AVAILABLE);
+ EXPECT_EQ(AUDIO_STATE_NOT_AVAILABLE,
+ audio_pref_handler_->GetDeviceState(kInternalMic));
+ audio_pref_handler_->SetDeviceState(kHeadphone, AUDIO_STATE_ACTIVE);
+ EXPECT_EQ(AUDIO_STATE_ACTIVE,
+ audio_pref_handler_->GetDeviceState(kHeadphone));
+ audio_pref_handler_->SetDeviceState(kHDMIOutput, AUDIO_STATE_INACTIVE);
+ EXPECT_EQ(AUDIO_STATE_INACTIVE,
+ audio_pref_handler_->GetDeviceState(kHDMIOutput));
+}
+
} // namespace chromeos
« no previous file with comments | « chromeos/audio/audio_devices_pref_handler_impl.cc ('k') | chromeos/audio/audio_devices_pref_handler_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698