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

Commit e25d0810 authored by Kihong Seong's avatar Kihong Seong
Browse files

Fix ScanManagerTest#testFilteredScanTimeout

The test is flaky due to a race condition. Downgrade of scan mode is
expected to happen and the test checks this, however sometimes the check
takes place before downgrade is complete. Therefore, increasing waiting
time for downgrade. Change in AppScanStats.isScanningTooLong() is made
to avoid the corner case when the system executes all steps exactly in
time.

Bug: 297502921
Test: atest BluetoothInstrumentationTests
Change-Id: I507984b2c678cfdcf4541b527f6c316719fda07f
parent a368ac18
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -586,7 +586,7 @@ import java.util.Objects;
            return false;
        }
        return (SystemClock.elapsedRealtime() - mScanStartTime)
                > mAdapterService.getScanTimeoutMillis();
                >= mAdapterService.getScanTimeoutMillis();
    }

    synchronized boolean hasRecentScan() {
+2 −2
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ import org.mockito.Spy;
@RunWith(AndroidJUnit4.class)
public class ScanManagerTest {
    private static final String TAG = ScanManagerTest.class.getSimpleName();
    private static final int DELAY_ASYNC_MS = 10;
    private static final int DELAY_ASYNC_MS = 40;
    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;
@@ -613,7 +613,7 @@ public class ScanManagerTest {
            // Turn off screen
            sendMessageWaitForProcessed(createScreenOnOffMessage(false));
            assertThat(client.settings.getScanMode()).isEqualTo(SCAN_MODE_SCREEN_OFF);
            // Set as backgournd app
            // Set as background app
            sendMessageWaitForProcessed(createImportanceMessage(false));
            assertThat(client.settings.getScanMode()).isEqualTo(SCAN_MODE_SCREEN_OFF);
            // Turn on screen