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

Commit 1bf2c51b authored by Hyundo Moon's avatar Hyundo Moon Committed by Gerrit Code Review
Browse files

Merge "Fix flaky trimDatabase_trimsOldOrInvisibleRecords" into main

parents 130857ff 0f7340c9
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -19,10 +19,12 @@ import static com.android.bluetooth.opp.BluetoothOppService.WHERE_INVISIBLE_UNCO

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.Mockito.anyString;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;

import static com.google.common.truth.Truth.assertThat;
@@ -47,6 +49,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;

@MediumTest
@@ -82,6 +85,18 @@ public class BluetoothOppServiceTest {
        // Try getting the Bluetooth adapter
        mAdapter = BluetoothAdapter.getDefaultAdapter();
        Assert.assertNotNull(mAdapter);

        // Wait until the initial trimDatabase operation is done.
        verify(mBluetoothMethodProxy, timeout(3_000))
                .contentResolverQuery(
                        any(),
                        eq(BluetoothShare.CONTENT_URI),
                        eq(new String[] {BluetoothShare._ID}),
                        any(),
                        isNull(),
                        eq(BluetoothShare._ID));

        Mockito.clearInvocations(mBluetoothMethodProxy);
    }

    @After