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

Commit 56677bcd authored by Charlie Boutier's avatar Charlie Boutier Committed by Gerrit Code Review
Browse files

Merge "BumbleBluetoothTests: Reset Android Bluetooth between tests" into main

parents 2c4b41a6 133641eb
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.bluetooth.le.ScanCallback
import android.bluetooth.le.ScanFilter
import android.bluetooth.le.ScanResult
import android.bluetooth.le.ScanSettings
import android.bluetooth.test_utils.EnableBluetoothRule
import android.content.Context
import android.os.ParcelUuid
import androidx.test.core.app.ApplicationProvider
@@ -69,11 +70,13 @@ public class DckGattTest() {

    // A Rule live from a test setup through it's teardown.
    // Gives shell permissions during the test.
    @Rule @JvmField val mPermissionRule = AdoptShellPermissionsRule()
    @Rule(order = 0) @JvmField val mPermissionRule = AdoptShellPermissionsRule()

    // Setup a Bumble Pandora device for the duration of the test.
    // Acting as a Pandora client, it can be interacted with through the Pandora APIs.
    @Rule @JvmField val mBumble = PandoraDevice()
    @Rule(order = 1) @JvmField val mBumble = PandoraDevice()

    @Rule(order = 2) @JvmField val enableBluetoothRule = EnableBluetoothRule(false, true)

    @Before
    fun setUp() {
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.bluetooth
import android.bluetooth.DckTestRule.LeScanResult
import android.bluetooth.le.ScanFilter
import android.bluetooth.le.ScanSettings
import android.bluetooth.test_utils.EnableBluetoothRule
import android.content.Context
import android.os.ParcelUuid
import androidx.test.core.app.ApplicationProvider
@@ -66,6 +67,8 @@ class DckScanTest(
            isGattConnected = isGattConnected
        )

    @Rule(order = 3) @JvmField val enableBluetoothRule = EnableBluetoothRule(false, true)

    @Test
    fun scanForIrkAndIdentityAddress_remoteFound() {
        // TODO(316001793): Retrieve identity address from Bumble
+8 −4
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;

import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.test_utils.EnableBluetoothRule;
import android.content.Context;
import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.CheckFlagsRule;
@@ -88,14 +89,17 @@ public class GattClientTest {
    private static final UUID TEST_CHARACTERISTIC_UUID =
            UUID.fromString("00010001-0000-0000-0000-000000000000");

    @Rule(order = 2)
    public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule();
    @Rule(order = 0)
    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();

    @Rule(order = 1)
    public final PandoraDevice mBumble = new PandoraDevice();

    @Rule(order = 0)
    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
    @Rule(order = 2)
    public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule();

    @Rule(order = 3)
    public final EnableBluetoothRule mEnableBluetoothRule = new EnableBluetoothRule(false, true);

    private final Context mContext = ApplicationProvider.getApplicationContext();
    private final BluetoothManager mManager = mContext.getSystemService(BluetoothManager.class);
+8 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.bluetooth.le.ScanCallback;
import android.bluetooth.le.ScanFilter;
import android.bluetooth.le.ScanResult;
import android.bluetooth.le.ScanSettings;
import android.bluetooth.test_utils.EnableBluetoothRule;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -75,9 +76,14 @@ public class LeScanningTest {
    private static final byte[] TEST_SERVICE_DATA = {(byte) 0xAA, (byte) 0xBB, (byte) 0xCC};
    private static final String TEST_UUID_SUFFIX = "-0000-1000-8000-00805f9b34fb";

    @Rule public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule();
    @Rule(order = 0)
    public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule();

    @Rule public final PandoraDevice mBumble = new PandoraDevice();
    @Rule(order = 1)
    public final PandoraDevice mBumble = new PandoraDevice();

    @Rule(order = 2)
    public final EnableBluetoothRule mEnableBluetoothRule = new EnableBluetoothRule(false, true);

    private final Context mContext = ApplicationProvider.getApplicationContext();
    private final BluetoothManager mBluetoothManager =