Prepare tests for impending robolectric merge
Some ShadowUserManager function moved into the basic shadow in robolectric proper and has been removed from the Settings ShadowUserManager. Test: make -j56 RunSettingsRoboTests Change-Id: I38647dae5d16bc79bc7925ca139c9362a2035393
This commit is contained in:
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.spy;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -60,7 +61,7 @@ public class AdvancedConnectedDeviceControllerTest {
|
||||
mContentResolver = mContext.getContentResolver();
|
||||
mNfcController = new NfcPreferenceController(mContext,
|
||||
NfcPreferenceController.KEY_TOGGLE_NFC);
|
||||
mShadowNfcAdapter = Shadows.shadowOf(ShadowNfcAdapter.getNfcAdapter(mContext));
|
||||
mShadowNfcAdapter = Shadows.shadowOf(NfcAdapter.getNfcAdapter(mContext));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -68,8 +69,7 @@ public class AdvancedConnectedDeviceControllerTest {
|
||||
AdvancedConnectedDeviceController controller =
|
||||
new AdvancedConnectedDeviceController(mContext, KEY);
|
||||
|
||||
assertThat(controller.getAvailabilityStatus()).isEqualTo(
|
||||
AVAILABLE);
|
||||
assertThat(controller.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -56,10 +56,7 @@ import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(shadows = {
|
||||
ShadowAudioManager.class,
|
||||
ShadowBluetoothUtils.class}
|
||||
)
|
||||
@Config(shadows = {ShadowAudioManager.class, ShadowBluetoothUtils.class})
|
||||
public class AvailableMediaDeviceGroupControllerTest {
|
||||
|
||||
private static final String PREFERENCE_KEY_1 = "pref_key_1";
|
||||
@@ -84,7 +81,7 @@ public class AvailableMediaDeviceGroupControllerTest {
|
||||
private Preference mPreference;
|
||||
private AvailableMediaDeviceGroupController mAvailableMediaDeviceGroupController;
|
||||
private LocalBluetoothManager mLocalBluetoothManager;
|
||||
private ShadowAudioManager mShadowAudioManager;
|
||||
private AudioManager mAudioManager;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
@@ -101,7 +98,7 @@ public class AvailableMediaDeviceGroupControllerTest {
|
||||
|
||||
ShadowBluetoothUtils.sLocalBluetoothManager = mLocalManager;
|
||||
mLocalBluetoothManager = ShadowBluetoothUtils.getLocalBtManager(mContext);
|
||||
mShadowAudioManager = ShadowAudioManager.getShadow();
|
||||
mAudioManager = mContext.getSystemService(AudioManager.class);
|
||||
doReturn(mEventManager).when(mLocalBluetoothManager).getEventManager();
|
||||
|
||||
mAvailableMediaDeviceGroupController = new AvailableMediaDeviceGroupController(mContext);
|
||||
@@ -184,7 +181,7 @@ public class AvailableMediaDeviceGroupControllerTest {
|
||||
|
||||
@Test
|
||||
public void setTitle_inCallState_showCallStateTitle() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_IN_CALL);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
|
||||
mAvailableMediaDeviceGroupController.onAudioModeChanged();
|
||||
|
||||
assertThat(mPreferenceGroup.getTitle()).isEqualTo(
|
||||
@@ -193,7 +190,7 @@ public class AvailableMediaDeviceGroupControllerTest {
|
||||
|
||||
@Test
|
||||
public void setTitle_notInCallState_showMediaStateTitle() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||
mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||
mAvailableMediaDeviceGroupController.onAudioModeChanged();
|
||||
|
||||
assertThat(mPreferenceGroup.getTitle()).isEqualTo(
|
||||
|
Reference in New Issue
Block a user