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

Commit d3014bdc authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix BluetoothInstrumentationTests"

parents e4ff1a87 8ce512be
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -216,6 +216,8 @@ public class AdapterServiceTest {
        AsyncTask.setDefaultExecutor((r) -> {
            InstrumentationRegistry.getInstrumentation().runOnMainSync(r);
        });
        InstrumentationRegistry.getInstrumentation().getUiAutomation()
                .adoptShellPermissionIdentity();

        InstrumentationRegistry.getInstrumentation().runOnMainSync(
                () -> mAdapterService = new AdapterService());
@@ -243,6 +245,8 @@ public class AdapterServiceTest {
        mBluetoothManager = InstrumentationRegistry.getTargetContext()
                .getSystemService(BluetoothManager.class);

        when(mMockContext.getCacheDir()).thenReturn(InstrumentationRegistry.getTargetContext()
                .getCacheDir());
        when(mMockContext.getApplicationInfo()).thenReturn(mMockApplicationInfo);
        when(mMockContext.getContentResolver()).thenReturn(mMockContentResolver);
        when(mMockContext.getApplicationContext()).thenReturn(mMockContext);
+2 −0
Original line number Diff line number Diff line
@@ -108,6 +108,8 @@ public class TbsGattTest {
            Looper.prepare();
        }

        getInstrumentation().getUiAutomation().adoptShellPermissionIdentity();

        MockitoAnnotations.initMocks(this);

        TestUtils.setAdapterService(mAdapterService);
+2 −0
Original line number Diff line number Diff line
@@ -82,6 +82,8 @@ public class TbsGenericTest {
        mAdapter = BluetoothAdapter.getDefaultAdapter();
        mContext = getInstrumentation().getTargetContext();

        getInstrumentation().getUiAutomation().adoptShellPermissionIdentity();

        // Default TbsGatt mock behavior
        doReturn(true).when(mTbsGatt).init(mGtbsCcidCaptor.capture(), mGtbsUciCaptor.capture(),
                mDefaultGtbsUriSchemesCaptor.capture(), anyBoolean(), anyBoolean(),
+2 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.telephony.TelephonyManager;
import android.util.Log;

import androidx.test.core.app.ApplicationProvider;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.MediumTest;
import androidx.test.rule.ServiceTestRule;
import androidx.test.runner.AndroidJUnit4;
@@ -120,6 +121,7 @@ public class BluetoothInCallServiceTest {
    @Before
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);
        InstrumentationRegistry.getInstrumentation().getUiAutomation().adoptShellPermissionIdentity();

        // Create the service Intent.
        Intent serviceIntent =
+8 −0
Original line number Diff line number Diff line
@@ -18,8 +18,11 @@ package com.android.bluetooth.util;

import static com.google.common.truth.Truth.assertThat;

import androidx.test.InstrumentationRegistry;

import com.android.internal.telephony.uicc.IccUtils;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -29,6 +32,11 @@ public final class GsmAlphabetTest {

  private static final String GSM_EXTENDED_CHARS = "{|}\\[~]\f\u20ac";

  @Before
  public void setUp() throws Exception {
    InstrumentationRegistry.getInstrumentation().getUiAutomation().adoptShellPermissionIdentity();
  }

  @Test
  public void gsm7BitPackedToString() throws Exception {
    byte[] packed;
Loading