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

Commit 2388d6de authored by Kihong Seong's avatar Kihong Seong
Browse files

Increase delay time for ScanManagerTest

ScanManagerTest#testMetricsScanRadioDuration is currently flaky due to
delay in rare long delays in start and stop scan calls. The test
measures duration of scan and takes into account the delay that may
happen in test situations, but the delay needs to be increased to cover
some very rare test failures due to long delays.

Bug: 323290726
Test: atest BluetoothInstrumentationTests
Flag: EXEMPT, test change only
Change-Id: I278133f6526bb400932b95a92941823d7f9e70ba
parent 8976afc9
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -73,7 +73,6 @@ import com.android.bluetooth.flags.Flags;
import com.android.bluetooth.gatt.GattNativeInterface;
import com.android.bluetooth.gatt.GattObjectsFactory;
import com.android.bluetooth.gatt.GattService;
import com.android.bluetooth.le_scan.ScanClient;
import com.android.internal.app.IBatteryStats;

import org.junit.After;
@@ -101,7 +100,7 @@ import java.util.concurrent.TimeUnit;
@RunWith(AndroidJUnit4.class)
public class ScanManagerTest {
    private static final String TAG = ScanManagerTest.class.getSimpleName();
    private static final int DELAY_ASYNC_MS = 40;
    private static final int DELAY_ASYNC_MS = 50;
    private static final int DELAY_DEFAULT_SCAN_TIMEOUT_MS = 1500000;
    private static final int DELAY_SCAN_TIMEOUT_MS = 100;
    private static final int DEFAULT_SCAN_REPORT_DELAY_MS = 100;
@@ -1365,8 +1364,8 @@ public class ScanManagerTest {
                            mScanDurationCaptor.capture());
            long capturedDuration = mScanDurationCaptor.getValue();
            Log.d(TAG, "capturedDuration: " + String.valueOf(capturedDuration));
            assertThat(weightedScanDuration <= capturedDuration
                    && capturedDuration <= weightedScanDuration + DELAY_ASYNC_MS).isTrue();
            assertThat(capturedDuration).isAtLeast(weightedScanDuration);
            assertThat(capturedDuration).isAtMost(weightedScanDuration + DELAY_ASYNC_MS);
            Mockito.clearInvocations(mMetricsLogger);
        }
    }