Loading tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java +10 −3 Original line number Diff line number Diff line Loading @@ -668,11 +668,18 @@ public class AvrcpControllerStateMachineTest { secondAvrcpStateMachine.start(); Assert.assertFalse(mAvrcpStateMachine.isActive()); // Connect device 1 and 2 and verify first one is set as active // Connect device 1 and 2 and verify second one is set as active setUpConnectedState(true, true); secondAvrcpStateMachine.connect(StackEvent.connectionStateChanged(true, true)); TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper()); Assert.assertTrue(mAvrcpStateMachine.isActive()); Assert.assertFalse(secondAvrcpStateMachine.isActive()); secondAvrcpStateMachine.connect(StackEvent.connectionStateChanged(true, true)); TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper()); TestUtils.waitForLooperToFinishScheduledTask(secondAvrcpStateMachine.getHandler() .getLooper()); Assert.assertFalse(mAvrcpStateMachine.isActive()); Assert.assertTrue(secondAvrcpStateMachine.isActive()); // Request the second device to play an item and verify active device switched BrowseTree.BrowseNode results = mAvrcpStateMachine.findNode(rootName); Loading tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java +6 −2 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.android.bluetooth.R; import com.android.bluetooth.TestUtils; import com.android.bluetooth.Utils; import org.hamcrest.core.AllOf; Loading Loading @@ -96,6 +97,7 @@ public class HeadsetClientStateMachineTest { new HeadsetClientStateMachine(mHeadsetClientService, mHandlerThread.getLooper(), mNativeInterface); mHeadsetClientStateMachine.start(); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); } @After Loading @@ -103,6 +105,7 @@ public class HeadsetClientStateMachineTest { if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_hfpclient)) { return; } TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); mHeadsetClientStateMachine.doQuit(); mHandlerThread.quit(); } Loading Loading @@ -292,10 +295,11 @@ public class HeadsetClientStateMachineTest { -1)); Assert.assertEquals(true, mHeadsetClientStateMachine.getInBandRing()); // Simulate a new incoming phone call StackEvent eventCallStatusUpdated = new StackEvent(StackEvent.EVENT_TYPE_CLIP); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); mHeadsetClientStateMachine.sendMessage(StackEvent.STACK_EVENT, eventCallStatusUpdated); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); verify(mHeadsetClientService, timeout(STANDARD_WAIT_MILLIS).times(3)).sendBroadcast( intentArgument.capture(), anyString()); Loading @@ -319,11 +323,11 @@ public class HeadsetClientStateMachineTest { StackEvent eventCommandStatus = new StackEvent(StackEvent.EVENT_TYPE_CMD_RESULT); eventCommandStatus.valueInt = AT_OK; mHeadsetClientStateMachine.sendMessage(StackEvent.STACK_EVENT, eventCommandStatus); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); verify(mHeadsetClientService, timeout(QUERY_CURRENT_CALLS_TEST_WAIT_MILLIS).times(4)) .sendBroadcast( intentArgument.capture(), anyString()); // Verify that the new call is being registered with the inBandRing flag set. Assert.assertEquals(true, ((BluetoothHeadsetClientCall) intentArgument.getValue().getParcelableExtra( Loading Loading
tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java +10 −3 Original line number Diff line number Diff line Loading @@ -668,11 +668,18 @@ public class AvrcpControllerStateMachineTest { secondAvrcpStateMachine.start(); Assert.assertFalse(mAvrcpStateMachine.isActive()); // Connect device 1 and 2 and verify first one is set as active // Connect device 1 and 2 and verify second one is set as active setUpConnectedState(true, true); secondAvrcpStateMachine.connect(StackEvent.connectionStateChanged(true, true)); TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper()); Assert.assertTrue(mAvrcpStateMachine.isActive()); Assert.assertFalse(secondAvrcpStateMachine.isActive()); secondAvrcpStateMachine.connect(StackEvent.connectionStateChanged(true, true)); TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper()); TestUtils.waitForLooperToFinishScheduledTask(secondAvrcpStateMachine.getHandler() .getLooper()); Assert.assertFalse(mAvrcpStateMachine.isActive()); Assert.assertTrue(secondAvrcpStateMachine.isActive()); // Request the second device to play an item and verify active device switched BrowseTree.BrowseNode results = mAvrcpStateMachine.findNode(rootName); Loading
tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java +6 −2 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.android.bluetooth.R; import com.android.bluetooth.TestUtils; import com.android.bluetooth.Utils; import org.hamcrest.core.AllOf; Loading Loading @@ -96,6 +97,7 @@ public class HeadsetClientStateMachineTest { new HeadsetClientStateMachine(mHeadsetClientService, mHandlerThread.getLooper(), mNativeInterface); mHeadsetClientStateMachine.start(); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); } @After Loading @@ -103,6 +105,7 @@ public class HeadsetClientStateMachineTest { if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_hfpclient)) { return; } TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); mHeadsetClientStateMachine.doQuit(); mHandlerThread.quit(); } Loading Loading @@ -292,10 +295,11 @@ public class HeadsetClientStateMachineTest { -1)); Assert.assertEquals(true, mHeadsetClientStateMachine.getInBandRing()); // Simulate a new incoming phone call StackEvent eventCallStatusUpdated = new StackEvent(StackEvent.EVENT_TYPE_CLIP); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); mHeadsetClientStateMachine.sendMessage(StackEvent.STACK_EVENT, eventCallStatusUpdated); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); verify(mHeadsetClientService, timeout(STANDARD_WAIT_MILLIS).times(3)).sendBroadcast( intentArgument.capture(), anyString()); Loading @@ -319,11 +323,11 @@ public class HeadsetClientStateMachineTest { StackEvent eventCommandStatus = new StackEvent(StackEvent.EVENT_TYPE_CMD_RESULT); eventCommandStatus.valueInt = AT_OK; mHeadsetClientStateMachine.sendMessage(StackEvent.STACK_EVENT, eventCommandStatus); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); verify(mHeadsetClientService, timeout(QUERY_CURRENT_CALLS_TEST_WAIT_MILLIS).times(4)) .sendBroadcast( intentArgument.capture(), anyString()); // Verify that the new call is being registered with the inBandRing flag set. Assert.assertEquals(true, ((BluetoothHeadsetClientCall) intentArgument.getValue().getParcelableExtra( Loading