Merge "Hide "Pair new device" from connected device slice"
This commit is contained in:
@@ -30,7 +30,6 @@ import static org.mockito.Mockito.when;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.core.graphics.drawable.IconCompat;
|
||||
import androidx.slice.Slice;
|
||||
@@ -122,18 +121,6 @@ public class BluetoothDevicesSliceTest {
|
||||
SliceTester.assertAnySliceItemContainsTitle(sliceItems, BLUETOOTH_MOCK_TITLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSlice_hasBluetoothDevices_shouldHavePairNewDevice() {
|
||||
mockBluetoothDeviceList(1);
|
||||
doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
|
||||
|
||||
final Slice slice = mBluetoothDevicesSlice.getSlice();
|
||||
|
||||
final List<SliceItem> sliceItems = slice.getItems();
|
||||
SliceTester.assertAnySliceItemContainsTitle(sliceItems,
|
||||
mContext.getString(R.string.bluetooth_pairing_pref_title));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSlice_noBluetoothDevices_shouldHaveNoBluetoothDevicesTitle() {
|
||||
doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
|
||||
@@ -145,17 +132,6 @@ public class BluetoothDevicesSliceTest {
|
||||
mContext.getString(R.string.no_bluetooth_devices));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSlice_noBluetoothDevices_shouldNotHavePairNewDevice() {
|
||||
doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
|
||||
|
||||
final Slice slice = mBluetoothDevicesSlice.getSlice();
|
||||
|
||||
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
|
||||
assertThat(hasTitle(metadata,
|
||||
mContext.getString(R.string.bluetooth_pairing_pref_title))).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSlice_exceedDefaultRowCount_shouldOnlyShowDefaultRows() {
|
||||
mockBluetoothDeviceList(BluetoothDevicesSlice.DEFAULT_EXPANDED_ROW_COUNT + 1);
|
||||
@@ -204,9 +180,4 @@ public class BluetoothDevicesSliceTest {
|
||||
mBluetoothDeviceList.add(mCachedBluetoothDevice);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasTitle(SliceMetadata metadata, String title) {
|
||||
final CharSequence sliceTitle = metadata.getTitle();
|
||||
return TextUtils.equals(sliceTitle, title);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user