Add Hearable control slice in bluetooth device detail settings

Bug: 229048602
Test: make -j64 RunSettingsRoboTests
Change-Id: I850aaee9bf7518c9f9de065fbbd1eb4919fc62ee
This commit is contained in:
Alan Huang
2022-05-12 15:47:59 +00:00
parent 56c7f91cea
commit 8595cf779a
5 changed files with 87 additions and 0 deletions

View File

@@ -33,6 +33,11 @@ import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
public class BluetoothFeatureProviderImplTest {
private static final String SETTINGS_URI = "content://test.provider/settings_uri";
private static final String CONTROL_METADATA =
"<HEARABLE_CONTROL_SLICE_WITH_WIDTH>" + SETTINGS_URI
+ "</HEARABLE_CONTROL_SLICE_WITH_WIDTH>";
private static final int METADATA_FAST_PAIR_CUSTOMIZED_FIELDS = 25;
private BluetoothFeatureProvider mBluetoothFeatureProvider;
@Mock
@@ -54,4 +59,13 @@ public class BluetoothFeatureProviderImplTest {
final Uri uri = mBluetoothFeatureProvider.getBluetoothDeviceSettingsUri(mBluetoothDevice);
assertThat(uri.toString()).isEqualTo(SETTINGS_URI);
}
@Test
public void getBluetoothDeviceControlUri_returnsCorrectUri() {
when(mBluetoothDevice.getMetadata(METADATA_FAST_PAIR_CUSTOMIZED_FIELDS)).thenReturn(
CONTROL_METADATA.getBytes());
assertThat(
mBluetoothFeatureProvider.getBluetoothDeviceControlUri(mBluetoothDevice)).isEqualTo(
SETTINGS_URI);
}
}