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

Commit a640bc41 authored by William Escande's avatar William Escande
Browse files

Delete separate method to construct ManagerService

Bug: 280518177
Test: atest ServiceBluetoothTests
Change-Id: Ib0eedf40d22de15cc86222aabff5a52e0e48dbb1
parent 2201ca36
Loading
Loading
Loading
Loading
+17 −17
Original line number Diff line number Diff line
@@ -57,6 +57,15 @@ public class BluetoothManagerServiceTest {
    @Before
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);

        // Mock these functions so security errors won't throw
        doReturn("name")
                .when(mBluetoothServerProxy)
                .settingsSecureGetString(any(), eq(Settings.Secure.BLUETOOTH_NAME));
        doReturn("00:11:22:33:44:55")
                .when(mBluetoothServerProxy)
                .settingsSecureGetString(any(), eq(Settings.Secure.BLUETOOTH_ADDRESS));

        mContext =
                spy(
                        new ContextWrapper(
@@ -64,28 +73,19 @@ public class BluetoothManagerServiceTest {

        doReturn(mUserManager).when(mContext).getSystemService(UserManager.class);

        mLooper = new TestLooper();
        mManagerService = createBluetoothManagerService();
    }

    @After
    public void tearDown() {
    }

    private BluetoothManagerService createBluetoothManagerService() {
        doReturn(mock(Intent.class))
                .when(mContext)
                .registerReceiverForAllUsers(any(), any(), eq(null), eq(null));

        BluetoothServerProxy.setInstanceForTesting(mBluetoothServerProxy);

        // Mock these functions so security errors won't throw
        doReturn("name")
                .when(mBluetoothServerProxy)
                .settingsSecureGetString(any(), eq(Settings.Secure.BLUETOOTH_NAME));
        doReturn("00:11:22:33:44:55")
                .when(mBluetoothServerProxy)
                .settingsSecureGetString(any(), eq(Settings.Secure.BLUETOOTH_ADDRESS));
        return new BluetoothManagerService(mContext, mLooper.getLooper());
        mLooper = new TestLooper();

        mManagerService = new BluetoothManagerService(mContext, mLooper.getLooper());
    }

    @After
    public void tearDown() {
    }

    @Test