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

Unified Diff: chromeos/audio/audio_devices_pref_handler_impl_unittest.cc

Issue 1746843002: Persist the user's active audio device choice across chromeos session and reboots. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits. Created 4 years, 10 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 c0ffe80e1f473634c7b91853faed2b3ef1c3d643..c4f5d5161009ba1eab24e7209a792c7fd329992c 100644
--- a/chromeos/audio/audio_devices_pref_handler_impl_unittest.cc
+++ b/chromeos/audio/audio_devices_pref_handler_impl_unittest.cc
@@ -97,12 +97,13 @@ 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));
+ bool active, activate_by_user;
+ EXPECT_FALSE(audio_pref_handler_->GetDeviceActive(kInternalMic, &active,
+ &activate_by_user));
+ EXPECT_FALSE(audio_pref_handler_->GetDeviceActive(kHeadphone, &active,
+ &activate_by_user));
+ EXPECT_FALSE(audio_pref_handler_->GetDeviceActive(kHDMIOutput, &active,
+ &activate_by_user));
}
TEST_F(AudioDevicesPrefHandlerTest, PrefsRegistered) {
@@ -135,15 +136,24 @@ TEST_F(AudioDevicesPrefHandlerTest, TestSpecialCharactersInDeviceNames) {
}
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));
+ audio_pref_handler_->SetDeviceActive(kInternalMic, true, true);
+ bool active = false;
+ bool activate_by_user = false;
+ EXPECT_TRUE(audio_pref_handler_->GetDeviceActive(kInternalMic, &active,
+ &activate_by_user));
+ EXPECT_TRUE(active);
+ EXPECT_TRUE(activate_by_user);
+
+ audio_pref_handler_->SetDeviceActive(kHeadphone, true, false);
+ EXPECT_TRUE(audio_pref_handler_->GetDeviceActive(kHeadphone, &active,
+ &activate_by_user));
+ EXPECT_TRUE(active);
+ EXPECT_FALSE(activate_by_user);
+
+ audio_pref_handler_->SetDeviceActive(kHDMIOutput, false, false);
+ EXPECT_TRUE(audio_pref_handler_->GetDeviceActive(kHDMIOutput, &active,
+ &activate_by_user));
+ EXPECT_FALSE(active);
}
} // 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