Loading android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineTest.java +9 −16 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class PbapClientStateMachineTest{ private ArgumentCaptor<Intent> mIntentArgument = ArgumentCaptor.forClass(Intent.class); static final int DISCONNECT_TIMEOUT = 3100; static final int DISCONNECT_TIMEOUT = 5000; @Before public void setUp() throws Exception { Loading Loading @@ -114,10 +114,11 @@ public class PbapClientStateMachineTest{ } /** * Test transition from STATE_CONNECTING to STATE_DISCONNECTING with MSG_DISCONNECT * Test transition from STATE_CONNECTING to STATE_DISCONNECTING * and then to STATE_DISCONNECTED after timeout. */ @Test public void testStateTransitionFromConnectingToDisconnecting() { public void testStateTransitionFromConnectingToDisconnected() { assertThat(mPbapClientStateMachine.getConnectionState()) .isEqualTo(BluetoothProfile.STATE_CONNECTING); Loading @@ -127,19 +128,11 @@ public class PbapClientStateMachineTest{ .getLooper()); assertThat(mPbapClientStateMachine.getConnectionState()) .isEqualTo(BluetoothProfile.STATE_DISCONNECTING); } /** * Test transition from STATE_DISCONNECTING to STATE_DISCONNECTED with MSG_DISCONNECT_TIMEOUT */ @Test public void testStateTransitionFromDisconnectingToDisconnected_Timeout() { testStateTransitionFromConnectingToDisconnecting(); //wait until timeout occurs verify(mMockPbapClientService, timeout(DISCONNECT_TIMEOUT).times(3)).sendBroadcastMultiplePermissions( mIntentArgument.capture(), any(String[].class), Mockito.clearInvocations(mMockPbapClientService); verify(mMockPbapClientService, timeout(DISCONNECT_TIMEOUT)) .sendBroadcastMultiplePermissions(mIntentArgument.capture(), any(String[].class), any(BroadcastOptions.class)); assertThat(mPbapClientStateMachine.getConnectionState()) .isEqualTo(BluetoothProfile.STATE_DISCONNECTED); Loading Loading
android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientStateMachineTest.java +9 −16 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class PbapClientStateMachineTest{ private ArgumentCaptor<Intent> mIntentArgument = ArgumentCaptor.forClass(Intent.class); static final int DISCONNECT_TIMEOUT = 3100; static final int DISCONNECT_TIMEOUT = 5000; @Before public void setUp() throws Exception { Loading Loading @@ -114,10 +114,11 @@ public class PbapClientStateMachineTest{ } /** * Test transition from STATE_CONNECTING to STATE_DISCONNECTING with MSG_DISCONNECT * Test transition from STATE_CONNECTING to STATE_DISCONNECTING * and then to STATE_DISCONNECTED after timeout. */ @Test public void testStateTransitionFromConnectingToDisconnecting() { public void testStateTransitionFromConnectingToDisconnected() { assertThat(mPbapClientStateMachine.getConnectionState()) .isEqualTo(BluetoothProfile.STATE_CONNECTING); Loading @@ -127,19 +128,11 @@ public class PbapClientStateMachineTest{ .getLooper()); assertThat(mPbapClientStateMachine.getConnectionState()) .isEqualTo(BluetoothProfile.STATE_DISCONNECTING); } /** * Test transition from STATE_DISCONNECTING to STATE_DISCONNECTED with MSG_DISCONNECT_TIMEOUT */ @Test public void testStateTransitionFromDisconnectingToDisconnected_Timeout() { testStateTransitionFromConnectingToDisconnecting(); //wait until timeout occurs verify(mMockPbapClientService, timeout(DISCONNECT_TIMEOUT).times(3)).sendBroadcastMultiplePermissions( mIntentArgument.capture(), any(String[].class), Mockito.clearInvocations(mMockPbapClientService); verify(mMockPbapClientService, timeout(DISCONNECT_TIMEOUT)) .sendBroadcastMultiplePermissions(mIntentArgument.capture(), any(String[].class), any(BroadcastOptions.class)); assertThat(mPbapClientStateMachine.getConnectionState()) .isEqualTo(BluetoothProfile.STATE_DISCONNECTED); Loading