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

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

Merge "VolumeControl: Make tests tearDown more robust" into main

parents d7eab71e 60b0d3df
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ import org.mockito.junit.MockitoRule;
@RunWith(AndroidJUnit4.class)
public class VolumeControlStateMachineTest {
    private BluetoothAdapter mAdapter;
    private HandlerThread mHandlerThread;
    private HandlerThread mHandlerThread = null;
    private VolumeControlStateMachine mVolumeControlStateMachine;
    private BluetoothDevice mTestDevice;
    private static final int TIMEOUT_MS = 1000;
@@ -67,6 +67,8 @@ public class VolumeControlStateMachineTest {
    @Mock private VolumeControlService mVolumeControlService;
    @Mock private VolumeControlNativeInterface mVolumeControlNativeInterface;

    boolean mIsAdapterServiceSet;

    @Before
    public void setUp() throws Exception {
        InstrumentationRegistry.getInstrumentation()
@@ -75,6 +77,7 @@ public class VolumeControlStateMachineTest {
        TestUtils.setAdapterService(mAdapterService);

        mAdapter = BluetoothAdapter.getDefaultAdapter();
        mIsAdapterServiceSet = true;

        // Get a device for testing
        mTestDevice = mAdapter.getRemoteDevice("00:01:02:03:04:05");
@@ -95,9 +98,13 @@ public class VolumeControlStateMachineTest {

    @After
    public void tearDown() throws Exception {
        if (mHandlerThread != null) {
            mHandlerThread.quit();
        }
        if (mIsAdapterServiceSet) {
            TestUtils.clearAdapterService(mAdapterService);
        }
    }

    /** Test that default state is disconnected */
    @Test