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:
@@ -99,8 +99,8 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
private Context mContext;
|
||||
private PreferenceScreen mScreen;
|
||||
private ListPreference mPreference;
|
||||
private AudioManager mAudioManager;
|
||||
private ShadowAudioManager mShadowAudioManager;
|
||||
private ShadowMediaRouter mShadowMediaRouter;
|
||||
private BluetoothManager mBluetoothManager;
|
||||
private BluetoothAdapter mBluetoothAdapter;
|
||||
private BluetoothDevice mBluetoothDevice;
|
||||
@@ -117,8 +117,8 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(RuntimeEnvironment.application);
|
||||
|
||||
mAudioManager = mContext.getSystemService(AudioManager.class);
|
||||
mShadowAudioManager = ShadowAudioManager.getShadow();
|
||||
mShadowMediaRouter = ShadowMediaRouter.getShadow();
|
||||
|
||||
ShadowBluetoothUtils.sLocalBluetoothManager = mLocalManager;
|
||||
mLocalBluetoothManager = ShadowBluetoothUtils.getLocalBtManager(mContext);
|
||||
@@ -163,7 +163,6 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
mShadowAudioManager.reset();
|
||||
ShadowBluetoothUtils.reset();
|
||||
}
|
||||
|
||||
@@ -173,7 +172,7 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
*/
|
||||
@Test
|
||||
public void setActiveBluetoothDevice_btDeviceWithHisyncId_shouldSetBtDeviceActive() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
when(mHearingAidProfile.getHiSyncId(mLeftBluetoothHapDevice)).thenReturn(HISYNCID1);
|
||||
|
||||
mController.setActiveBluetoothDevice(mLeftBluetoothHapDevice);
|
||||
@@ -188,7 +187,7 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
*/
|
||||
@Test
|
||||
public void setActiveBluetoothDevice_btDeviceWithoutHisyncId_shouldSetBtDeviceActive() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
|
||||
mController.setActiveBluetoothDevice(mBluetoothDevice);
|
||||
|
||||
@@ -203,7 +202,7 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
*/
|
||||
@Test
|
||||
public void setActiveBluetoothDevice_setNull_shouldSetNullToBothProfiles() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
|
||||
mController.setActiveBluetoothDevice(null);
|
||||
|
||||
@@ -217,7 +216,7 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
*/
|
||||
@Test
|
||||
public void setActiveBluetoothDevice_inNormalMode_shouldNotSetActiveDeviceToHeadsetProfile() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||
mAudioManager.setMode(AudioManager.MODE_NORMAL);
|
||||
|
||||
mController.setActiveBluetoothDevice(mBluetoothDevice);
|
||||
|
||||
@@ -245,7 +244,7 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
*/
|
||||
@Test
|
||||
public void updateState_oneHeadsetsAvailableAndActivated_shouldSetDeviceName() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mShadowAudioManager.setOutputDevice(DEVICE_OUT_BLUETOOTH_SCO);
|
||||
mProfileConnectedDevices.clear();
|
||||
mProfileConnectedDevices.add(mBluetoothDevice);
|
||||
@@ -266,7 +265,7 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
*/
|
||||
@Test
|
||||
public void updateState_moreThanOneHfpBtDevicesAreAvailable_shouldSetActivatedDeviceName() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mShadowAudioManager.setOutputDevice(DEVICE_OUT_BLUETOOTH_SCO);
|
||||
List<BluetoothDevice> connectedDevices = new ArrayList<>(2);
|
||||
connectedDevices.add(mBluetoothDevice);
|
||||
@@ -288,7 +287,7 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
*/
|
||||
@Test
|
||||
public void updateState_withAvailableDevicesWiredHeadsetActivated_shouldSetDefaultSummary() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mProfileConnectedDevices.clear();
|
||||
mProfileConnectedDevices.add(mBluetoothDevice);
|
||||
when(mHeadsetProfile.getConnectedDevices()).thenReturn(mProfileConnectedDevices);
|
||||
@@ -308,7 +307,7 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
*/
|
||||
@Test
|
||||
public void updateState_noAvailableHeadsetBtDevices_shouldSetDefaultSummary() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
List<BluetoothDevice> emptyDeviceList = new ArrayList<>();
|
||||
when(mHeadsetProfile.getConnectedDevices()).thenReturn(emptyDeviceList);
|
||||
|
||||
@@ -326,7 +325,7 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
*/
|
||||
@Test
|
||||
public void updateState_oneHapBtDeviceAreAvailable_shouldSetActivatedDeviceName() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mShadowAudioManager.setOutputDevice(DEVICE_OUT_HEARING_AID);
|
||||
mProfileConnectedDevices.clear();
|
||||
mProfileConnectedDevices.add(mLeftBluetoothHapDevice);
|
||||
@@ -350,7 +349,7 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
*/
|
||||
@Test
|
||||
public void updateState_moreThanOneHapBtDevicesAreAvailable_shouldSetActivatedDeviceName() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mShadowAudioManager.setOutputDevice(DEVICE_OUT_HEARING_AID);
|
||||
mProfileConnectedDevices.clear();
|
||||
mProfileConnectedDevices.add(mLeftBluetoothHapDevice);
|
||||
@@ -378,7 +377,7 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
*/
|
||||
@Test
|
||||
public void updateState_hapBtDeviceWithSameId_shouldSetActivatedDeviceName() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mShadowAudioManager.setOutputDevice(DEVICE_OUT_HEARING_AID);
|
||||
mProfileConnectedDevices.clear();
|
||||
mProfileConnectedDevices.add(mBluetoothDevice);
|
||||
@@ -411,7 +410,7 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
*/
|
||||
@Test
|
||||
public void updateState_hapBtDeviceWithSameIdButDifferentOrder_shouldSetActivatedDeviceName() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mShadowAudioManager.setOutputDevice(DEVICE_OUT_HEARING_AID);
|
||||
mProfileConnectedDevices.clear();
|
||||
mProfileConnectedDevices.add(mBluetoothDevice);
|
||||
@@ -443,7 +442,7 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
*/
|
||||
@Test
|
||||
public void updateState_hapBtDeviceWithDifferentId_shouldSetActivatedDeviceName() {
|
||||
mShadowAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
|
||||
mShadowAudioManager.setOutputDevice(DEVICE_OUT_HEARING_AID);
|
||||
mProfileConnectedDevices.clear();
|
||||
mProfileConnectedDevices.add(mBluetoothDevice);
|
||||
|
||||
Reference in New Issue
Block a user