Merge tests calling onStart and onStop
This is a cherrypick of commit 0851843bed.
Allows MediaOutputBaseDialog to manage resources properly
during test runs.
Bug: 232812007
Test: atest MediaOutputBaseDialogTest
Change-Id: I4d6aa4d7afd87c10a226800185695b6b3f8cf3e2
Merged-In: I4d6aa4d7afd87c10a226800185695b6b3f8cf3e2
This commit is contained in:
@@ -241,46 +241,29 @@ public class MediaOutputBaseDialogTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onStart_isBroadcasting_verifyRegisterLeBroadcastServiceCallBack() {
|
public void whenBroadcasting_verifyLeBroadcastServiceCallBackIsRegisteredAndUnregistered() {
|
||||||
when(mLocalBluetoothProfileManager.getLeAudioBroadcastProfile()).thenReturn(
|
when(mLocalBluetoothProfileManager.getLeAudioBroadcastProfile()).thenReturn(
|
||||||
mLocalBluetoothLeBroadcast);
|
mLocalBluetoothLeBroadcast);
|
||||||
mIsBroadcasting = true;
|
mIsBroadcasting = true;
|
||||||
|
|
||||||
mMediaOutputBaseDialogImpl.onStart();
|
mMediaOutputBaseDialogImpl.onStart();
|
||||||
|
|
||||||
verify(mLocalBluetoothLeBroadcast).registerServiceCallBack(any(), any());
|
verify(mLocalBluetoothLeBroadcast).registerServiceCallBack(any(), any());
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void onStart_notBroadcasting_noRegisterLeBroadcastServiceCallBack() {
|
|
||||||
when(mLocalBluetoothProfileManager.getLeAudioBroadcastProfile()).thenReturn(
|
|
||||||
mLocalBluetoothLeBroadcast);
|
|
||||||
mIsBroadcasting = false;
|
|
||||||
|
|
||||||
mMediaOutputBaseDialogImpl.onStart();
|
|
||||||
|
|
||||||
verify(mLocalBluetoothLeBroadcast, never()).registerServiceCallBack(any(), any());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void onStart_isBroadcasting_verifyUnregisterLeBroadcastServiceCallBack() {
|
|
||||||
when(mLocalBluetoothProfileManager.getLeAudioBroadcastProfile()).thenReturn(
|
|
||||||
mLocalBluetoothLeBroadcast);
|
|
||||||
mIsBroadcasting = true;
|
|
||||||
|
|
||||||
mMediaOutputBaseDialogImpl.onStop();
|
mMediaOutputBaseDialogImpl.onStop();
|
||||||
|
|
||||||
verify(mLocalBluetoothLeBroadcast).unregisterServiceCallBack(any());
|
verify(mLocalBluetoothLeBroadcast).unregisterServiceCallBack(any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onStop_notBroadcasting_noUnregisterLeBroadcastServiceCallBack() {
|
public void
|
||||||
|
whenNotBroadcasting_verifyLeBroadcastServiceCallBackIsNotRegisteredOrUnregistered() {
|
||||||
when(mLocalBluetoothProfileManager.getLeAudioBroadcastProfile()).thenReturn(
|
when(mLocalBluetoothProfileManager.getLeAudioBroadcastProfile()).thenReturn(
|
||||||
mLocalBluetoothLeBroadcast);
|
mLocalBluetoothLeBroadcast);
|
||||||
mIsBroadcasting = false;
|
mIsBroadcasting = false;
|
||||||
|
|
||||||
|
mMediaOutputBaseDialogImpl.onStart();
|
||||||
mMediaOutputBaseDialogImpl.onStop();
|
mMediaOutputBaseDialogImpl.onStop();
|
||||||
|
|
||||||
|
verify(mLocalBluetoothLeBroadcast, never()).registerServiceCallBack(any(), any());
|
||||||
verify(mLocalBluetoothLeBroadcast, never()).unregisterServiceCallBack(any());
|
verify(mLocalBluetoothLeBroadcast, never()).unregisterServiceCallBack(any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user