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

Commit ae628738 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add test case - forceUpdate_deviceIsSubDevice_doNothing" am: a3d97ecd...

Merge "Add test case - forceUpdate_deviceIsSubDevice_doNothing" am: a3d97ecd am: 9c2293ca am: 9713bec9

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1925621

Change-Id: I2c7e0aeb425596f168a08f7c7bec653f5244e12e
parents c66bc49f 9713bec9
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -250,4 +250,22 @@ public class SavedBluetoothDeviceUpdaterTest {
        verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice,
                BluetoothDevicePreference.SortType.TYPE_NO_SORT);
    }

    @Test
    public void forceUpdate_deviceIsSubDevice_doesNothing() {
        final List<BluetoothDevice> bluetoothDevices = new ArrayList<>();
        bluetoothDevices.add(mBluetoothDevice);

        when(mBluetoothAdapter.isEnabled()).thenReturn(true);
        when(mBluetoothAdapter.getMostRecentlyConnectedDevices()).thenReturn(bluetoothDevices);
        when(mBluetoothManager.getCachedDeviceManager()).thenReturn(mDeviceManager);
        when(mDeviceManager.findDevice(mBluetoothDevice)).thenReturn(mCachedBluetoothDevice);
        when(mDeviceManager.isSubDevice(mBluetoothDevice)).thenReturn(true);

        mBluetoothDeviceUpdater.forceUpdate();

        verify(mBluetoothDeviceUpdater, never()).removePreference(mCachedBluetoothDevice);
        verify(mBluetoothDeviceUpdater, never()).addPreference(mCachedBluetoothDevice,
                BluetoothDevicePreference.SortType.TYPE_NO_SORT);
    }
}