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

Commit 812c118f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix BluetoothInstrumentationTests" into tm-qpr-dev

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

        InstrumentationRegistry.getInstrumentation().runOnMainSync(
                () -> mAdapterService = new AdapterService());
@@ -239,6 +241,8 @@ public class AdapterServiceTest {
        mPermissionManager = InstrumentationRegistry.getTargetContext()
                .getSystemService(PermissionManager.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
@@ -107,6 +107,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