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

Commit 8dc32ac7 authored by David Duarte's avatar David Duarte
Browse files

MapClientServiceTest: Pass Looper in constructor

Bug: 305741984
Test: atest MapClientServiceTest
Flag: EXEMPT test only change
Change-Id: I617ebcc4937ff28d52a36779d0e849b49e474a39
parent 6f03d6d9
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ public class MapClientService extends ProfileService {
    @VisibleForTesting
    private Handler mHandler;

    @VisibleForTesting Looper mSmLooper;
    private Looper mSmLooper;

    MapClientService() {}

@@ -76,6 +76,12 @@ public class MapClientService extends ProfileService {
        super(ctx);
    }

    @VisibleForTesting
    MapClientService(Context ctx, Looper looper) {
        this(ctx);
        mSmLooper = looper;
    }

    public static boolean isEnabled() {
        return BluetoothProperties.isProfileMapClientEnabled().orElse(false);
    }
+1 −3
Original line number Diff line number Diff line
@@ -74,9 +74,8 @@ public class MapClientServiceTest {

        mTestLooper = new TestLooper();

        mService = new MapClientService(targetContext);
        mService = new MapClientService(targetContext, mTestLooper.getLooper());
        mService.doStart();
        mService.mSmLooper = mTestLooper.getLooper();

        // Try getting the Bluetooth adapter
        mAdapter = BluetoothAdapter.getDefaultAdapter();
@@ -86,7 +85,6 @@ public class MapClientServiceTest {

    @After
    public void tearDown() throws Exception {
        mService.mSmLooper = null;
        mService.doStop();
        mService = MapClientService.getMapClientService();
        assertThat(mService).isNull();