Loading android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceTest.java +6 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ public class A2dpServiceTest { } TestUtils.setAdapterService(mAdapterService); doReturn(true).when(mAdapterService).isA2dpOffloadEnabled(); doReturn(MAX_CONNECTED_AUDIO_DEVICES).when(mAdapterService).getMaxConnectedAudioDevices(); doReturn(true, false).when(mAdapterService).isStartedProfile(anyString()); doReturn(false).when(mAdapterService).isQuietModeEnabled(); Loading Loading @@ -865,6 +866,11 @@ public class A2dpServiceTest { verifySupportTime, verifyNotSupportTime, verifyEnabledTime); } @Test public void testDumpDoesNotCrash() { mA2dpService.dump(new StringBuilder()); } private void connectDevice(BluetoothDevice device) { connectDeviceWithCodecStatus(device, null); } Loading android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpStateMachineTest.java +18 −0 Original line number Diff line number Diff line Loading @@ -417,4 +417,22 @@ public class A2dpStateMachineTest { // Check if low latency audio been update. verify(mA2dpService, times(6)).updateLowLatencyAudioSupport(mTestDevice); } @Test public void dump_doesNotCrash() { BluetoothCodecConfig[] codecsSelectableSbc; codecsSelectableSbc = new BluetoothCodecConfig[1]; codecsSelectableSbc[0] = mCodecConfigSbc; BluetoothCodecConfig[] codecsSelectableSbcAac; codecsSelectableSbcAac = new BluetoothCodecConfig[2]; codecsSelectableSbcAac[0] = mCodecConfigSbc; codecsSelectableSbcAac[1] = mCodecConfigAac; BluetoothCodecStatus codecStatusSbcAndSbc = new BluetoothCodecStatus(mCodecConfigSbc, Arrays.asList(codecsSelectableSbcAac), Arrays.asList(codecsSelectableSbc)); mA2dpStateMachine.processCodecConfigEvent(codecStatusSbcAndSbc); mA2dpStateMachine.dump(new StringBuilder()); } } android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkServiceTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -464,4 +464,12 @@ public class A2dpSinkServiceTest { assertThat(mService.setConnectionPolicy(mDevice1, BluetoothProfile.CONNECTION_POLICY_ALLOWED)).isFalse(); } @Test public void testDumpDoesNotCrash() { mockDevicePriority(mDevice1, BluetoothProfile.CONNECTION_POLICY_ALLOWED); setupDeviceConnection(mDevice1); mService.dump(new StringBuilder()); } } android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceTest.java +6 −0 Original line number Diff line number Diff line Loading @@ -428,4 +428,10 @@ public class AvrcpControllerServiceTest { eq(AvrcpControllerStateMachine.MESSAGE_PROCESS_GET_PLAYER_ITEMS), eq(new ArrayList<>(Arrays.asList(items)))); } @Test public void dump_doesNotCrash() { mService.getRcPsm(REMOTE_DEVICE_ADDRESS_AS_ARRAY, 1); mService.dump(new StringBuilder()); } } android/app/tests/unit/src/com/android/bluetooth/bas/BatteryServiceTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -211,7 +211,7 @@ public class BatteryServiceTest { * Test that an outgoing connection to device */ @Test public void testConnect() { public void testConnectAndDump() { // Update the device policy so okToConnect() returns true when(mAdapterService.getDatabase()).thenReturn(mDatabaseManager); when(mDatabaseManager Loading @@ -222,6 +222,9 @@ public class BatteryServiceTest { .getRemoteUuids(any(BluetoothDevice.class)); // Send a connect request Assert.assertTrue("Connect expected to succeed", mService.connect(mDevice)); // Test dump() is not crashed. mService.dump(new StringBuilder()); } /** Loading Loading
android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpServiceTest.java +6 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ public class A2dpServiceTest { } TestUtils.setAdapterService(mAdapterService); doReturn(true).when(mAdapterService).isA2dpOffloadEnabled(); doReturn(MAX_CONNECTED_AUDIO_DEVICES).when(mAdapterService).getMaxConnectedAudioDevices(); doReturn(true, false).when(mAdapterService).isStartedProfile(anyString()); doReturn(false).when(mAdapterService).isQuietModeEnabled(); Loading Loading @@ -865,6 +866,11 @@ public class A2dpServiceTest { verifySupportTime, verifyNotSupportTime, verifyEnabledTime); } @Test public void testDumpDoesNotCrash() { mA2dpService.dump(new StringBuilder()); } private void connectDevice(BluetoothDevice device) { connectDeviceWithCodecStatus(device, null); } Loading
android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpStateMachineTest.java +18 −0 Original line number Diff line number Diff line Loading @@ -417,4 +417,22 @@ public class A2dpStateMachineTest { // Check if low latency audio been update. verify(mA2dpService, times(6)).updateLowLatencyAudioSupport(mTestDevice); } @Test public void dump_doesNotCrash() { BluetoothCodecConfig[] codecsSelectableSbc; codecsSelectableSbc = new BluetoothCodecConfig[1]; codecsSelectableSbc[0] = mCodecConfigSbc; BluetoothCodecConfig[] codecsSelectableSbcAac; codecsSelectableSbcAac = new BluetoothCodecConfig[2]; codecsSelectableSbcAac[0] = mCodecConfigSbc; codecsSelectableSbcAac[1] = mCodecConfigAac; BluetoothCodecStatus codecStatusSbcAndSbc = new BluetoothCodecStatus(mCodecConfigSbc, Arrays.asList(codecsSelectableSbcAac), Arrays.asList(codecsSelectableSbc)); mA2dpStateMachine.processCodecConfigEvent(codecStatusSbcAndSbc); mA2dpStateMachine.dump(new StringBuilder()); } }
android/app/tests/unit/src/com/android/bluetooth/a2dpsink/A2dpSinkServiceTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -464,4 +464,12 @@ public class A2dpSinkServiceTest { assertThat(mService.setConnectionPolicy(mDevice1, BluetoothProfile.CONNECTION_POLICY_ALLOWED)).isFalse(); } @Test public void testDumpDoesNotCrash() { mockDevicePriority(mDevice1, BluetoothProfile.CONNECTION_POLICY_ALLOWED); setupDeviceConnection(mDevice1); mService.dump(new StringBuilder()); } }
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceTest.java +6 −0 Original line number Diff line number Diff line Loading @@ -428,4 +428,10 @@ public class AvrcpControllerServiceTest { eq(AvrcpControllerStateMachine.MESSAGE_PROCESS_GET_PLAYER_ITEMS), eq(new ArrayList<>(Arrays.asList(items)))); } @Test public void dump_doesNotCrash() { mService.getRcPsm(REMOTE_DEVICE_ADDRESS_AS_ARRAY, 1); mService.dump(new StringBuilder()); } }
android/app/tests/unit/src/com/android/bluetooth/bas/BatteryServiceTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -211,7 +211,7 @@ public class BatteryServiceTest { * Test that an outgoing connection to device */ @Test public void testConnect() { public void testConnectAndDump() { // Update the device policy so okToConnect() returns true when(mAdapterService.getDatabase()).thenReturn(mDatabaseManager); when(mDatabaseManager Loading @@ -222,6 +222,9 @@ public class BatteryServiceTest { .getRemoteUuids(any(BluetoothDevice.class)); // Send a connect request Assert.assertTrue("Connect expected to succeed", mService.connect(mDevice)); // Test dump() is not crashed. mService.dump(new StringBuilder()); } /** Loading