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

Commit 0478ab4e authored by Joseph Pirozzo's avatar Joseph Pirozzo Committed by Myles Watson
Browse files

GATT start timeout

Some tests fail occasionally due to the length of time required to
start GATT taking longer than the length of time allotted for a
context switch. Allow for 500ms.

Bug: 149857512
Test: atest BluetoothInstrumentationTests
Change-Id: Id8a29a3cca97e830e771f59b3233065c26d15447
Merged-In: Id8a29a3cca97e830e771f59b3233065c26d15447
parent 1e29a6e3
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ public class AdapterServiceTest {
    private @Mock android.app.Application mApplication;

    private static final int CONTEXT_SWITCH_MS = 100;
    private static final int GATT_START_TIME_MS = 500;
    private static final int ONE_SECOND_MS = 1000;
    private static final int NATIVE_INIT_MS = 8000;
    private static final int NATIVE_DISABLE_MS = 1000;
@@ -201,7 +202,7 @@ public class AdapterServiceTest {
                invocationNumber + 1, CONTEXT_SWITCH_MS);

        // Start GATT
        verify(mMockContext, timeout(CONTEXT_SWITCH_MS).times(
        verify(mMockContext, timeout(GATT_START_TIME_MS).times(
                startServiceCalls * invocationNumber + 1)).startService(any());
        mAdapterService.addProfile(mMockGattService);
        mAdapterService.onProfileServiceStateChanged(mMockGattService, BluetoothAdapter.STATE_ON);
@@ -331,7 +332,7 @@ public class AdapterServiceTest {
                CONTEXT_SWITCH_MS);

        // Start GATT
        verify(mMockContext, timeout(CONTEXT_SWITCH_MS).times(1)).startService(any());
        verify(mMockContext, timeout(GATT_START_TIME_MS).times(1)).startService(any());
        mAdapterService.addProfile(mMockGattService);

        verifyStateChange(BluetoothAdapter.STATE_BLE_TURNING_ON,
@@ -398,7 +399,7 @@ public class AdapterServiceTest {
                CONTEXT_SWITCH_MS);

        // Start GATT
        verify(mMockContext, timeout(CONTEXT_SWITCH_MS).times(1)).startService(any());
        verify(mMockContext, timeout(GATT_START_TIME_MS).times(1)).startService(any());
        mAdapterService.addProfile(mMockGattService);
        mAdapterService.onProfileServiceStateChanged(mMockGattService, BluetoothAdapter.STATE_ON);