Fix logging format and add test cases
For logging purpose, CachedBluetoothDevice#toString is more clear then BluetoothDevice#toString, so change to use CachedBluetoothDevice#toString Bug: 307890347 Test: atest HearingDevicePairingFragmentTest Change-Id: Ia0af65565ca7067fa6c4d5db286c3739fb65c1d2
This commit is contained in:
@@ -178,7 +178,7 @@ public class HearingDevicePairingFragmentTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleLeScanResult_isNotAndroidCompatible_() {
|
||||
public void handleLeScanResult_isNotAndroidCompatible_discoverServices() {
|
||||
ScanResult scanResult = mock(ScanResult.class);
|
||||
doReturn(mDevice).when(scanResult).getDevice();
|
||||
doReturn(mCachedDevice).when(mCachedDeviceManager).findDevice(mDevice);
|
||||
@@ -189,6 +189,19 @@ public class HearingDevicePairingFragmentTest {
|
||||
verify(mFragment).discoverServices(mCachedDevice);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handleLeScanResult_alreadyBonded_doNothing() {
|
||||
ScanResult scanResult = mock(ScanResult.class);
|
||||
doReturn(mDevice).when(scanResult).getDevice();
|
||||
doReturn(mCachedDevice).when(mCachedDeviceManager).findDevice(mDevice);
|
||||
doReturn(BluetoothDevice.BOND_BONDED).when(mCachedDevice).getBondState();
|
||||
|
||||
mFragment.handleLeScanResult(scanResult);
|
||||
|
||||
verify(mFragment, never()).addDevice(mCachedDevice);
|
||||
verify(mFragment, never()).discoverServices(mCachedDevice);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onProfileConnectionStateChanged_deviceConnected_inSelectedList_finish() {
|
||||
doReturn(true).when(mCachedDevice).isConnected();
|
||||
|
Reference in New Issue
Block a user