The UI only shows the active LE device
At the media device, it only shows the active LE device which is connected. Bug: 232892046 Test: make RunSettingsRoboTests ROBOTEST_FILTER=AvailableMediaBluetoothDeviceUpdaterTest make RunSettingsRoboTests ROBOTEST_FILTER=ConnectedBluetoothDeviceUpdaterTest make RunSettingsRoboTests ROBOTEST_FILTER=SavedBluetoothDeviceUpdaterTest Change-Id: Iac661206def4d43bc40ab9bb1938f084926899c2
This commit is contained in:
@@ -77,6 +77,7 @@ public class SavedBluetoothDeviceUpdaterTest {
|
||||
private Context mContext;
|
||||
private SavedBluetoothDeviceUpdater mBluetoothDeviceUpdater;
|
||||
private BluetoothDevicePreference mPreference;
|
||||
private List<CachedBluetoothDevice> mCachedDevices = new ArrayList<>();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
@@ -99,6 +100,10 @@ public class SavedBluetoothDeviceUpdaterTest {
|
||||
false, BluetoothDevicePreference.SortType.TYPE_DEFAULT);
|
||||
doNothing().when(mBluetoothDeviceUpdater).addPreference(any());
|
||||
doNothing().when(mBluetoothDeviceUpdater).removePreference(any());
|
||||
mCachedDevices.add(mCachedBluetoothDevice);
|
||||
when(mBluetoothManager.getCachedDeviceManager()).thenReturn(mDeviceManager);
|
||||
when(mDeviceManager.getCachedDevicesCopy()).thenReturn(mCachedDevices);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -143,6 +148,31 @@ public class SavedBluetoothDeviceUpdaterTest {
|
||||
BluetoothDevicePreference.SortType.TYPE_NO_SORT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void
|
||||
onProfileConnectionStateChanged_leDeviceDisconnected_inDeviceList_invokesAddPreference()
|
||||
{
|
||||
when(mBluetoothDevice.isConnected()).thenReturn(false);
|
||||
|
||||
mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice,
|
||||
BluetoothProfile.STATE_DISCONNECTED, BluetoothProfile.LE_AUDIO);
|
||||
|
||||
verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice,
|
||||
BluetoothDevicePreference.SortType.TYPE_NO_SORT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void
|
||||
onProfileConnectionStateChanged_deviceDisconnected_notInDeviceList_invokesRemovePreference() {
|
||||
when(mBluetoothDevice.isConnected()).thenReturn(false);
|
||||
mCachedDevices.clear();
|
||||
|
||||
mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice,
|
||||
BluetoothProfile.STATE_DISCONNECTED, BluetoothProfile.LE_AUDIO);
|
||||
|
||||
verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onClick_Preference_setConnect() {
|
||||
mBluetoothDeviceUpdater.onPreferenceClick(mPreference);
|
||||
|
Reference in New Issue
Block a user