Fix BluetoothPairingDetailTest fail
Bug: 237625815 Test: make RunSettingsRoboTests ROBOTEST_FILTER=BluetoothPairingDetailTest Change-Id: I183fea9903cad921f7fe69445579b80dea045559
This commit is contained in:
@@ -30,6 +30,7 @@ import android.os.Bundle;
|
|||||||
|
|
||||||
import androidx.test.core.app.ApplicationProvider;
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
|
||||||
|
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
|
||||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||||
import com.android.settingslib.widget.FooterPreference;
|
import com.android.settingslib.widget.FooterPreference;
|
||||||
|
|
||||||
@@ -43,6 +44,8 @@ import org.mockito.junit.MockitoJUnit;
|
|||||||
import org.mockito.junit.MockitoRule;
|
import org.mockito.junit.MockitoRule;
|
||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
public class BluetoothPairingDetailTest {
|
public class BluetoothPairingDetailTest {
|
||||||
@Rule
|
@Rule
|
||||||
@@ -52,6 +55,8 @@ public class BluetoothPairingDetailTest {
|
|||||||
|
|
||||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||||
private LocalBluetoothManager mLocalManager;
|
private LocalBluetoothManager mLocalManager;
|
||||||
|
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||||
|
private CachedBluetoothDeviceManager mDeviceManager;
|
||||||
private BluetoothPairingDetail mFragment;
|
private BluetoothPairingDetail mFragment;
|
||||||
private BluetoothProgressCategory mAvailableDevicesCategory;
|
private BluetoothProgressCategory mAvailableDevicesCategory;
|
||||||
private FooterPreference mFooterPreference;
|
private FooterPreference mFooterPreference;
|
||||||
@@ -69,9 +74,11 @@ public class BluetoothPairingDetailTest {
|
|||||||
.findPreference(BluetoothPairingDetail.KEY_AVAIL_DEVICES);
|
.findPreference(BluetoothPairingDetail.KEY_AVAIL_DEVICES);
|
||||||
doReturn(mFooterPreference).when(mFragment)
|
doReturn(mFooterPreference).when(mFragment)
|
||||||
.findPreference(BluetoothPairingDetail.KEY_FOOTER_PREF);
|
.findPreference(BluetoothPairingDetail.KEY_FOOTER_PREF);
|
||||||
|
doReturn(Collections.emptyList()).when(mDeviceManager).getCachedDevicesCopy();
|
||||||
|
|
||||||
mFragment.mBluetoothAdapter = mBluetoothAdapter;
|
mFragment.mBluetoothAdapter = mBluetoothAdapter;
|
||||||
mFragment.mLocalManager = mLocalManager;
|
mFragment.mLocalManager = mLocalManager;
|
||||||
|
mFragment.mCachedDeviceManager = mDeviceManager;
|
||||||
mFragment.mDeviceListGroup = mAvailableDevicesCategory;
|
mFragment.mDeviceListGroup = mAvailableDevicesCategory;
|
||||||
mFragment.onViewCreated(mFragment.getView(), Bundle.EMPTY);
|
mFragment.onViewCreated(mFragment.getView(), Bundle.EMPTY);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user