Search in sources :

Example 1 with ShadowSubscriptionManager

use of org.robolectric.shadows.ShadowSubscriptionManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ImeiInfoDialogControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    final ShadowSubscriptionManager ssm = Shadow.extract(mContext.getSystemService(SubscriptionManager.class));
    ssm.setActiveSubscriptionInfos(mSubscriptionInfo);
    when(mSubscriptionInfo.getSubscriptionId()).thenReturn(SUB_ID);
    final ShadowTelephonyManager stm = Shadow.extract(mContext.getSystemService(TelephonyManager.class));
    stm.setTelephonyManagerForSubscriptionId(SUB_ID, mTelephonyManager);
    when(mDialog.getContext()).thenReturn(mContext);
    mController = spy(new ImeiInfoDialogController(mDialog, SLOT_ID));
    when(mTelephonyManager.getCdmaPrlVersion()).thenReturn(PRL_VERSION);
    when(mTelephonyManager.getMeid(anyInt())).thenReturn(MEID_NUMBER);
    when(mTelephonyManager.getCdmaMin(anyInt())).thenReturn(MIN_NUMBER);
    when(mTelephonyManager.getDeviceSoftwareVersion(anyInt())).thenReturn(IMEI_SV_NUMBER);
    when(mTelephonyManager.getImei(anyInt())).thenReturn(IMEI_NUMBER);
}
Also used : ShadowTelephonyManager(org.robolectric.shadows.ShadowTelephonyManager) TelephonyManager(android.telephony.TelephonyManager) ShadowTelephonyManager(org.robolectric.shadows.ShadowTelephonyManager) ShadowSubscriptionManager(org.robolectric.shadows.ShadowSubscriptionManager) ShadowSubscriptionManager(org.robolectric.shadows.ShadowSubscriptionManager) SubscriptionManager(android.telephony.SubscriptionManager) Before(org.junit.Before)

Example 2 with ShadowSubscriptionManager

use of org.robolectric.shadows.ShadowSubscriptionManager in project android_packages_apps_Settings by omnirom.

the class ImeiInfoDialogControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    final ShadowSubscriptionManager ssm = Shadow.extract(mContext.getSystemService(SubscriptionManager.class));
    ssm.setActiveSubscriptionInfos(mSubscriptionInfo);
    when(mSubscriptionInfo.getSubscriptionId()).thenReturn(SUB_ID);
    final ShadowTelephonyManager stm = Shadow.extract(mContext.getSystemService(TelephonyManager.class));
    stm.setTelephonyManagerForSubscriptionId(SUB_ID, mTelephonyManager);
    when(mDialog.getContext()).thenReturn(mContext);
    mController = spy(new ImeiInfoDialogController(mDialog, SLOT_ID));
    when(mTelephonyManager.getCdmaPrlVersion()).thenReturn(PRL_VERSION);
    when(mTelephonyManager.getMeid(anyInt())).thenReturn(MEID_NUMBER);
    when(mTelephonyManager.getCdmaMin(anyInt())).thenReturn(MIN_NUMBER);
    when(mTelephonyManager.getDeviceSoftwareVersion(anyInt())).thenReturn(IMEI_SV_NUMBER);
    when(mTelephonyManager.getImei(anyInt())).thenReturn(IMEI_NUMBER);
}
Also used : ShadowTelephonyManager(org.robolectric.shadows.ShadowTelephonyManager) TelephonyManager(android.telephony.TelephonyManager) ShadowTelephonyManager(org.robolectric.shadows.ShadowTelephonyManager) ShadowSubscriptionManager(org.robolectric.shadows.ShadowSubscriptionManager) ShadowSubscriptionManager(org.robolectric.shadows.ShadowSubscriptionManager) SubscriptionManager(android.telephony.SubscriptionManager) Before(org.junit.Before)

Example 3 with ShadowSubscriptionManager

use of org.robolectric.shadows.ShadowSubscriptionManager in project android_packages_apps_Settings by omnirom.

the class ControllerRendererPoolTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    // SubscriptionManager and TelephonyManager for CellularDataConditionController
    ShadowSubscriptionManager shadowSubscriptionMgr = shadowOf(mContext.getSystemService(SubscriptionManager.class));
    shadowSubscriptionMgr.setDefaultDataSubscriptionId(SUB_ID);
    ShadowTelephonyManager shadowTelephonyMgr = Shadow.extract(mContext.getSystemService(TelephonyManager.class));
    shadowTelephonyMgr.setTelephonyManagerForSubscriptionId(SUB_ID, mTelephonyMgr);
    when(mTelephonyMgr.createForSubscriptionId(anyInt())).thenReturn(mTelephonyMgr);
    mPool = new ControllerRendererPool();
}
Also used : ShadowTelephonyManager(org.robolectric.shadows.ShadowTelephonyManager) ShadowTelephonyManager(org.robolectric.shadows.ShadowTelephonyManager) TelephonyManager(android.telephony.TelephonyManager) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) ShadowSubscriptionManager(org.robolectric.shadows.ShadowSubscriptionManager) ShadowSubscriptionManager(org.robolectric.shadows.ShadowSubscriptionManager) SubscriptionManager(android.telephony.SubscriptionManager) Before(org.junit.Before)

Example 4 with ShadowSubscriptionManager

use of org.robolectric.shadows.ShadowSubscriptionManager in project android_packages_apps_Settings by omnirom.

the class ConditionContextualCardControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    // parameters required by CellularDataConditionController
    final ShadowSubscriptionManager shadowSubscriptionMgr = shadowOf(mContext.getSystemService(SubscriptionManager.class));
    shadowSubscriptionMgr.setDefaultDataSubscriptionId(SUB_ID);
    final TelephonyManager telephonyManager = spy(mContext.getSystemService(TelephonyManager.class));
    final ShadowTelephonyManager shadowTelephonyMgr = shadowOf(telephonyManager);
    shadowTelephonyMgr.setTelephonyManagerForSubscriptionId(SUB_ID, telephonyManager);
    mController = spy(new ConditionContextualCardController(mContext));
    ReflectionHelpers.setField(mController, "mConditionManager", mConditionManager);
}
Also used : ShadowTelephonyManager(org.robolectric.shadows.ShadowTelephonyManager) TelephonyManager(android.telephony.TelephonyManager) ShadowTelephonyManager(org.robolectric.shadows.ShadowTelephonyManager) ShadowSubscriptionManager(org.robolectric.shadows.ShadowSubscriptionManager) ShadowSubscriptionManager(org.robolectric.shadows.ShadowSubscriptionManager) SubscriptionManager(android.telephony.SubscriptionManager) Before(org.junit.Before)

Aggregations

SubscriptionManager (android.telephony.SubscriptionManager)4 TelephonyManager (android.telephony.TelephonyManager)4 Before (org.junit.Before)4 ShadowSubscriptionManager (org.robolectric.shadows.ShadowSubscriptionManager)4 ShadowTelephonyManager (org.robolectric.shadows.ShadowTelephonyManager)4 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)1