Fix borken test on Bluetooth and connected package
Bug: 187239965 Test: make RunSettingsRoboTests -j56 Change-Id: Ic0d60a6cd46b1211efb2021f079c0b0a6534b383
This commit is contained in:
@@ -35,6 +35,8 @@ import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothProfile;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Pair;
|
||||
|
||||
import androidx.preference.PreferenceGroup;
|
||||
|
||||
@@ -70,6 +72,9 @@ public class BluetoothPairingDetailTest {
|
||||
private PreferenceGroup mPreferenceGroup;
|
||||
@Mock
|
||||
private CachedBluetoothDevice mCachedBluetoothDevice;
|
||||
@Mock
|
||||
private Drawable mDrawable;
|
||||
|
||||
private BluetoothPairingDetail mFragment;
|
||||
private Context mContext;
|
||||
private BluetoothProgressCategory mAvailableDevicesCategory;
|
||||
@@ -82,11 +87,13 @@ public class BluetoothPairingDetailTest {
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
Pair<Drawable, String> pairs = new Pair<>(mDrawable, "fake_device");
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mFragment = spy(new BluetoothPairingDetail());
|
||||
doReturn(mContext).when(mFragment).getContext();
|
||||
doReturn(mResource).when(mFragment).getResources();
|
||||
when(mCachedBluetoothDevice.getAddress()).thenReturn(TEST_DEVICE_ADDRESS);
|
||||
when(mCachedBluetoothDevice.getDrawableWithDescription()).thenReturn(pairs);
|
||||
|
||||
mAvailableDevicesCategory = spy(new BluetoothProgressCategory(mContext));
|
||||
mFooterPreference = new FooterPreference(mContext);
|
||||
|
||||
Reference in New Issue
Block a user