[Audiosharing] Finish handler activity if no dialog to show
Test: atest Flag: com.android.settingslib.flags.promote_audio_sharing_for_second_auto_connected_lea_device Bug: 395786392 Change-Id: Ibd93f30574bb89cf4fd5e3c9590eb441c74b0cc8
This commit is contained in:
@@ -45,6 +45,8 @@ import android.content.Intent;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.platform.test.annotations.DisableFlags;
|
||||
import android.platform.test.annotations.EnableFlags;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
import android.provider.Settings;
|
||||
import android.util.Pair;
|
||||
@@ -196,9 +198,9 @@ public class AudioSharingDialogHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags(Flags.FLAG_ADOPT_PRIMARY_GROUP_MANAGEMENT_API)
|
||||
@DisableFlags(Flags.FLAG_AUDIO_SHARING_HYSTERESIS_MODE_FIX)
|
||||
public void handleUserTriggeredDeviceConnected_inCall_setActive() {
|
||||
mSetFlagsRule.disableFlags(Flags.FLAG_AUDIO_SHARING_HYSTERESIS_MODE_FIX);
|
||||
mSetFlagsRule.enableFlags(Flags.FLAG_ADOPT_PRIMARY_GROUP_MANAGEMENT_API);
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
BLUETOOTH_LE_BROADCAST_PRIMARY_DEVICE_GROUP_ID,
|
||||
BluetoothCsipSetCoordinator.GROUP_ID_INVALID);
|
||||
@@ -207,19 +209,21 @@ public class AudioSharingDialogHandlerTest {
|
||||
ImmutableList<BluetoothDevice> deviceList = ImmutableList.of(mDevice1);
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(deviceList);
|
||||
when(mAssistant.getAllSources(any())).thenReturn(ImmutableList.of());
|
||||
mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */ true);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */
|
||||
true);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
verify(mCachedDevice1).setActive();
|
||||
assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
BLUETOOTH_LE_BROADCAST_PRIMARY_DEVICE_GROUP_ID,
|
||||
BluetoothCsipSetCoordinator.GROUP_ID_INVALID)).isEqualTo(
|
||||
BluetoothCsipSetCoordinator.GROUP_ID_INVALID);
|
||||
assertThat(showDialog).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags({Flags.FLAG_AUDIO_SHARING_HYSTERESIS_MODE_FIX,
|
||||
Flags.FLAG_ADOPT_PRIMARY_GROUP_MANAGEMENT_API})
|
||||
public void handleUserTriggeredDeviceConnected_inCall_enableHysteresisFix_setAndSaveActive() {
|
||||
mSetFlagsRule.enableFlags(Flags.FLAG_AUDIO_SHARING_HYSTERESIS_MODE_FIX);
|
||||
mSetFlagsRule.enableFlags(Flags.FLAG_ADOPT_PRIMARY_GROUP_MANAGEMENT_API);
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
BLUETOOTH_LE_BROADCAST_PRIMARY_DEVICE_GROUP_ID,
|
||||
BluetoothCsipSetCoordinator.GROUP_ID_INVALID);
|
||||
@@ -228,12 +232,14 @@ public class AudioSharingDialogHandlerTest {
|
||||
ImmutableList<BluetoothDevice> deviceList = ImmutableList.of(mDevice1);
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(deviceList);
|
||||
when(mAssistant.getAllSources(any())).thenReturn(ImmutableList.of());
|
||||
mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */ true);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */
|
||||
true);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
verify(mCachedDevice1).setActive();
|
||||
assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
BLUETOOTH_LE_BROADCAST_PRIMARY_DEVICE_GROUP_ID,
|
||||
BluetoothCsipSetCoordinator.GROUP_ID_INVALID)).isEqualTo(1);
|
||||
assertThat(showDialog).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -242,9 +248,11 @@ public class AudioSharingDialogHandlerTest {
|
||||
ImmutableList<BluetoothDevice> deviceList = ImmutableList.of(mDevice2);
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(deviceList);
|
||||
when(mAssistant.getAllSources(any())).thenReturn(ImmutableList.of());
|
||||
mHandler.handleDeviceConnected(mCachedDevice2, /* userTriggered= */ true);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice2, /* userTriggered= */
|
||||
true);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
verify(mCachedDevice2).setActive();
|
||||
assertThat(showDialog).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -253,7 +261,8 @@ public class AudioSharingDialogHandlerTest {
|
||||
ImmutableList<BluetoothDevice> deviceList = ImmutableList.of(mDevice2);
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(deviceList);
|
||||
when(mAssistant.getAllSources(any())).thenReturn(ImmutableList.of(mState));
|
||||
mHandler.handleDeviceConnected(mCachedDevice2, /* userTriggered= */ true);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice2, /* userTriggered= */
|
||||
true);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
List<Fragment> childFragments = mParentFragment.getChildFragmentManager().getFragments();
|
||||
assertThat(childFragments)
|
||||
@@ -282,6 +291,7 @@ public class AudioSharingDialogHandlerTest {
|
||||
AudioSharingUtils.MetricKey.METRIC_KEY_CANDIDATE_DEVICE_COUNT
|
||||
.ordinal(),
|
||||
0));
|
||||
assertThat(showDialog).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -290,9 +300,11 @@ public class AudioSharingDialogHandlerTest {
|
||||
ImmutableList<BluetoothDevice> deviceList = ImmutableList.of(mDevice1);
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(deviceList);
|
||||
when(mAssistant.getAllSources(any())).thenReturn(ImmutableList.of());
|
||||
mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */ true);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */
|
||||
true);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
verify(mCachedDevice1).setActive();
|
||||
assertThat(showDialog).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -303,11 +315,13 @@ public class AudioSharingDialogHandlerTest {
|
||||
ImmutableList<BluetoothDevice> deviceList = ImmutableList.of(mDevice1, mDevice3);
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(deviceList);
|
||||
when(mAssistant.getAllSources(any())).thenReturn(ImmutableList.of());
|
||||
mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */ true);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */
|
||||
true);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
List<Fragment> childFragments = mParentFragment.getChildFragmentManager().getFragments();
|
||||
assertThat(childFragments).isEmpty();
|
||||
verify(mCachedDevice1).setActive();
|
||||
assertThat(showDialog).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -316,7 +330,8 @@ public class AudioSharingDialogHandlerTest {
|
||||
ImmutableList<BluetoothDevice> deviceList = ImmutableList.of(mDevice1, mDevice3);
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(deviceList);
|
||||
when(mAssistant.getAllSources(any())).thenReturn(ImmutableList.of());
|
||||
mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */ true);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */
|
||||
true);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
List<Fragment> childFragments = mParentFragment.getChildFragmentManager().getFragments();
|
||||
assertThat(childFragments)
|
||||
@@ -345,6 +360,8 @@ public class AudioSharingDialogHandlerTest {
|
||||
AudioSharingUtils.MetricKey.METRIC_KEY_CANDIDATE_DEVICE_COUNT
|
||||
.ordinal(),
|
||||
2));
|
||||
assertThat(showDialog).isTrue();
|
||||
|
||||
AudioSharingJoinDialogFragment.DialogEventListener listener = fragment.getListener();
|
||||
assertThat(listener).isNotNull();
|
||||
listener.onShareClick();
|
||||
@@ -370,7 +387,8 @@ public class AudioSharingDialogHandlerTest {
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(deviceList);
|
||||
when(mAssistant.getAllSources(mDevice1)).thenReturn(ImmutableList.of());
|
||||
when(mAssistant.getAllSources(mDevice3)).thenReturn(ImmutableList.of(mState));
|
||||
mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */ true);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */
|
||||
true);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
List<Fragment> childFragments = mParentFragment.getChildFragmentManager().getFragments();
|
||||
assertThat(childFragments)
|
||||
@@ -399,6 +417,8 @@ public class AudioSharingDialogHandlerTest {
|
||||
AudioSharingUtils.MetricKey.METRIC_KEY_CANDIDATE_DEVICE_COUNT
|
||||
.ordinal(),
|
||||
1));
|
||||
assertThat(showDialog).isTrue();
|
||||
|
||||
AudioSharingJoinDialogFragment.DialogEventListener listener = fragment.getListener();
|
||||
assertThat(listener).isNotNull();
|
||||
listener.onCancelClick();
|
||||
@@ -416,7 +436,8 @@ public class AudioSharingDialogHandlerTest {
|
||||
when(mAssistant.getAllSources(mDevice1)).thenReturn(ImmutableList.of());
|
||||
when(mAssistant.getAllSources(mDevice3)).thenReturn(ImmutableList.of(mState));
|
||||
when(mAssistant.getAllSources(mDevice4)).thenReturn(ImmutableList.of(mState));
|
||||
mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */ true);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */
|
||||
true);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
List<Fragment> childFragments = mParentFragment.getChildFragmentManager().getFragments();
|
||||
assertThat(childFragments)
|
||||
@@ -445,6 +466,8 @@ public class AudioSharingDialogHandlerTest {
|
||||
AudioSharingUtils.MetricKey.METRIC_KEY_CANDIDATE_DEVICE_COUNT
|
||||
.ordinal(),
|
||||
1));
|
||||
assertThat(showDialog).isTrue();
|
||||
|
||||
AudioSharingDisconnectDialogFragment.DialogEventListener listener = fragment.getListener();
|
||||
assertThat(listener).isNotNull();
|
||||
listener.onItemClick(AudioSharingUtils.buildAudioSharingDeviceItem(mCachedDevice3));
|
||||
@@ -453,16 +476,18 @@ public class AudioSharingDialogHandlerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags(Flags.FLAG_ADOPT_PRIMARY_GROUP_MANAGEMENT_API)
|
||||
public void handleDeviceConnected_inCall_doNothing() {
|
||||
mSetFlagsRule.enableFlags(Flags.FLAG_ADOPT_PRIMARY_GROUP_MANAGEMENT_API);
|
||||
when(mAudioManager.getMode()).thenReturn(AudioManager.MODE_IN_CALL);
|
||||
setUpBroadcast(true);
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(ImmutableList.of());
|
||||
mHandler.handleDeviceConnected(mCachedDevice2, /* userTriggered= */ false);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice2, /* userTriggered= */
|
||||
false);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
verify(mCachedDevice2, never()).setActive();
|
||||
List<Fragment> childFragments = mParentFragment.getChildFragmentManager().getFragments();
|
||||
assertThat(childFragments).isEmpty();
|
||||
assertThat(showDialog).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -471,9 +496,11 @@ public class AudioSharingDialogHandlerTest {
|
||||
ImmutableList<BluetoothDevice> deviceList = ImmutableList.of(mDevice2);
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(deviceList);
|
||||
when(mAssistant.getAllSources(any())).thenReturn(ImmutableList.of());
|
||||
mHandler.handleDeviceConnected(mCachedDevice2, /* userTriggered= */ false);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice2, /* userTriggered= */
|
||||
false);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
verify(mCachedDevice2, never()).setActive();
|
||||
assertThat(showDialog).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -482,7 +509,8 @@ public class AudioSharingDialogHandlerTest {
|
||||
ImmutableList<BluetoothDevice> deviceList = ImmutableList.of(mDevice1);
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(deviceList);
|
||||
when(mAssistant.getAllSources(any())).thenReturn(ImmutableList.of(mState));
|
||||
mHandler.handleDeviceConnected(mCachedDevice2, /* userTriggered= */ false);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice2, /* userTriggered= */
|
||||
false);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
List<Fragment> childFragments = mParentFragment.getChildFragmentManager().getFragments();
|
||||
assertThat(childFragments)
|
||||
@@ -511,6 +539,7 @@ public class AudioSharingDialogHandlerTest {
|
||||
AudioSharingUtils.MetricKey.METRIC_KEY_CANDIDATE_DEVICE_COUNT
|
||||
.ordinal(),
|
||||
0));
|
||||
assertThat(showDialog).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -519,9 +548,11 @@ public class AudioSharingDialogHandlerTest {
|
||||
ImmutableList<BluetoothDevice> deviceList = ImmutableList.of(mDevice1);
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(deviceList);
|
||||
when(mAssistant.getAllSources(any())).thenReturn(ImmutableList.of());
|
||||
mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */ false);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */
|
||||
false);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
verify(mCachedDevice1, never()).setActive();
|
||||
assertThat(showDialog).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -532,11 +563,13 @@ public class AudioSharingDialogHandlerTest {
|
||||
ImmutableList<BluetoothDevice> deviceList = ImmutableList.of(mDevice1, mDevice3);
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(deviceList);
|
||||
when(mAssistant.getAllSources(any())).thenReturn(ImmutableList.of());
|
||||
mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */ false);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */
|
||||
false);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
List<Fragment> childFragments = mParentFragment.getChildFragmentManager().getFragments();
|
||||
assertThat(childFragments).isEmpty();
|
||||
verify(mCachedDevice1, never()).setActive();
|
||||
assertThat(showDialog).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -545,7 +578,8 @@ public class AudioSharingDialogHandlerTest {
|
||||
ImmutableList<BluetoothDevice> deviceList = ImmutableList.of(mDevice1, mDevice3);
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(deviceList);
|
||||
when(mAssistant.getAllSources(any())).thenReturn(ImmutableList.of());
|
||||
mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */ false);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */
|
||||
false);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
List<Fragment> childFragments = mParentFragment.getChildFragmentManager().getFragments();
|
||||
assertThat(childFragments)
|
||||
@@ -574,6 +608,8 @@ public class AudioSharingDialogHandlerTest {
|
||||
AudioSharingUtils.MetricKey.METRIC_KEY_CANDIDATE_DEVICE_COUNT
|
||||
.ordinal(),
|
||||
2));
|
||||
assertThat(showDialog).isTrue();
|
||||
|
||||
AudioSharingJoinDialogFragment.DialogEventListener listener = fragment.getListener();
|
||||
assertThat(listener).isNotNull();
|
||||
listener.onShareClick();
|
||||
@@ -599,7 +635,8 @@ public class AudioSharingDialogHandlerTest {
|
||||
when(mAssistant.getAllConnectedDevices()).thenReturn(deviceList);
|
||||
when(mAssistant.getAllSources(mDevice1)).thenReturn(ImmutableList.of());
|
||||
when(mAssistant.getAllSources(mDevice3)).thenReturn(ImmutableList.of(mState));
|
||||
mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */ false);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */
|
||||
false);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
List<Fragment> childFragments = mParentFragment.getChildFragmentManager().getFragments();
|
||||
assertThat(childFragments)
|
||||
@@ -628,6 +665,8 @@ public class AudioSharingDialogHandlerTest {
|
||||
AudioSharingUtils.MetricKey.METRIC_KEY_CANDIDATE_DEVICE_COUNT
|
||||
.ordinal(),
|
||||
1));
|
||||
assertThat(showDialog).isTrue();
|
||||
|
||||
AudioSharingJoinDialogFragment.DialogEventListener listener = fragment.getListener();
|
||||
assertThat(listener).isNotNull();
|
||||
listener.onCancelClick();
|
||||
@@ -644,7 +683,8 @@ public class AudioSharingDialogHandlerTest {
|
||||
when(mAssistant.getAllSources(mDevice1)).thenReturn(ImmutableList.of());
|
||||
when(mAssistant.getAllSources(mDevice3)).thenReturn(ImmutableList.of(mState));
|
||||
when(mAssistant.getAllSources(mDevice4)).thenReturn(ImmutableList.of(mState));
|
||||
mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */ false);
|
||||
boolean showDialog = mHandler.handleDeviceConnected(mCachedDevice1, /* userTriggered= */
|
||||
false);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
List<Fragment> childFragments = mParentFragment.getChildFragmentManager().getFragments();
|
||||
assertThat(childFragments)
|
||||
@@ -673,6 +713,8 @@ public class AudioSharingDialogHandlerTest {
|
||||
AudioSharingUtils.MetricKey.METRIC_KEY_CANDIDATE_DEVICE_COUNT
|
||||
.ordinal(),
|
||||
1));
|
||||
assertThat(showDialog).isTrue();
|
||||
|
||||
AudioSharingDisconnectDialogFragment.DialogEventListener listener = fragment.getListener();
|
||||
assertThat(listener).isNotNull();
|
||||
listener.onItemClick(AudioSharingUtils.buildAudioSharingDeviceItem(mCachedDevice3));
|
||||
|
@@ -273,6 +273,7 @@ public class AudioSharingJoinHandlerControllerTest {
|
||||
verify(mDeviceManager, never()).findDevice(any(BluetoothDevice.class));
|
||||
verify(mDialogHandler, never())
|
||||
.handleDeviceConnected(any(CachedBluetoothDevice.class), anyBoolean());
|
||||
verify(mActivity).finish();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -285,10 +286,30 @@ public class AudioSharingJoinHandlerControllerTest {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(EXTRA_BLUETOOTH_DEVICE, device);
|
||||
doReturn(intent).when(mActivity).getIntent();
|
||||
when(mDialogHandler.handleDeviceConnected(any(), anyBoolean())).thenReturn(true);
|
||||
mController.displayPreference(mScreen);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
|
||||
verify(mDialogHandler).handleDeviceConnected(cachedDevice, /* userTriggered = */ false);
|
||||
verify(mActivity, never()).finish();
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags({Flags.FLAG_ENABLE_LE_AUDIO_SHARING,
|
||||
Flags.FLAG_PROMOTE_AUDIO_SHARING_FOR_SECOND_AUTO_CONNECTED_LEA_DEVICE})
|
||||
public void handleDeviceClickFromIntent_noDialogToShow_finish() {
|
||||
CachedBluetoothDevice cachedDevice = mock(CachedBluetoothDevice.class);
|
||||
BluetoothDevice device = mock(BluetoothDevice.class);
|
||||
when(mDeviceManager.findDevice(device)).thenReturn(cachedDevice);
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(EXTRA_BLUETOOTH_DEVICE, device);
|
||||
doReturn(intent).when(mActivity).getIntent();
|
||||
when(mDialogHandler.handleDeviceConnected(any(), anyBoolean())).thenReturn(false);
|
||||
mController.displayPreference(mScreen);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
|
||||
verify(mDialogHandler).handleDeviceConnected(cachedDevice, /* userTriggered = */ false);
|
||||
verify(mActivity).finish();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -323,4 +344,20 @@ public class AudioSharingJoinHandlerControllerTest {
|
||||
// Above callbacks won't dismiss stale dialogs
|
||||
verifyNoInteractions(mDialogHandler);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onBluetoothStateChanged_stateOn_doNothing() {
|
||||
mController.onBluetoothStateChanged(BluetoothAdapter.STATE_ON);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
|
||||
verify(mActivity, never()).finish();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onBluetoothStateChanged_stateOff_finish() {
|
||||
mController.onBluetoothStateChanged(BluetoothAdapter.STATE_OFF);
|
||||
shadowOf(Looper.getMainLooper()).idle();
|
||||
|
||||
verify(mActivity).finish();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user