Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3621575 authored by Yuyang Huang's avatar Yuyang Huang Committed by Gerrit Code Review
Browse files

Merge "Adding a delay after calling startService() to prevent potential...

Merge "Adding a delay after calling startService() to prevent potential failure caused by delayed responses." into main
parents ad40d6dd 545cd756
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.bluetooth.hfpclient;

import static android.content.pm.PackageManager.FEATURE_WATCH;
import java.util.concurrent.TimeUnit;

import static org.mockito.Mockito.any;
import static org.mockito.Mockito.anyInt;
@@ -65,6 +66,7 @@ public class HeadsetClientServiceTest {
    private boolean mIsHeadsetClientServiceStarted;

    private static final int STANDARD_WAIT_MILLIS = 1000;
    private static final int SERVICE_START_WAIT_MILLIS = 100;

    @Rule public MockitoRule mockitoRule = MockitoJUnit.rule();

@@ -127,6 +129,8 @@ public class HeadsetClientServiceTest {
    public void testUpdateBatteryLevel() throws Exception {
        startService();

        // Adding a wait to prevent potential failure caused by delayed broadcast intent.
        TimeUnit.MILLISECONDS.sleep(SERVICE_START_WAIT_MILLIS);
        // Put mock state machine
        BluetoothDevice device =
                BluetoothAdapter.getDefaultAdapter().getRemoteDevice("00:01:02:03:04:05");