Merge "audio: make sure to set back to AudioMode::NORMAL after the test case" into sc-dev am: 183f6190a8

Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/15310729

Change-Id: Iae9d1f8aabf6d4dcc05e6a7992a638a3eb7297ad
This commit is contained in:
David Li 2021-07-20 08:31:21 +00:00 committed by Automerger Merge Worker
commit 081fe6adce

View file

@ -343,18 +343,21 @@ TEST_P(AudioPrimaryHidlTest, setMode) {
#endif
for (int mode : {-2, -1, maxMode + 1}) {
ASSERT_RESULT(Result::INVALID_ARGUMENTS, getDevice()->setMode(AudioMode(mode)))
EXPECT_RESULT(Result::INVALID_ARGUMENTS, getDevice()->setMode(AudioMode(mode)))
<< "mode=" << mode;
}
// Test valid values
for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE,
AudioMode::NORMAL /* Make sure to leave the test in normal mode */}) {
ASSERT_OK(getDevice()->setMode(mode)) << "mode=" << toString(mode);
}
// AudioMode::CALL_SCREEN as support is optional
#if MAJOR_VERSION >= 6
ASSERT_RESULT(okOrNotSupportedOrInvalidArgs, getDevice()->setMode(AudioMode::CALL_SCREEN));
EXPECT_RESULT(okOrNotSupportedOrInvalidArgs, getDevice()->setMode(AudioMode::CALL_SCREEN));
#endif
// Test valid values
for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE,
AudioMode::NORMAL}) {
EXPECT_OK(getDevice()->setMode(mode)) << "mode=" << toString(mode);
}
// Make sure to leave the test in normal mode
getDevice()->setMode(AudioMode::NORMAL);
}
TEST_P(AudioPrimaryHidlTest, setBtHfpSampleRate) {