use of com.android.settings.network.ims.MockVolteQueryImsState in project android_packages_apps_Settings by omnirom.
the class VideoCallingPreferenceControllerTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
doReturn(mTelephonyManager).when(mContext).getSystemService(TelephonyManager.class);
doReturn(mCarrierConfigManager).when(mContext).getSystemService(CarrierConfigManager.class);
doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(SUB_ID);
mCarrierConfig = new PersistableBundle();
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_IGNORE_DATA_ENABLED_CHANGED_FOR_VIDEO_CALLS, true);
doReturn(mCarrierConfig).when(mCarrierConfigManager).getConfigForSubId(SUB_ID);
mQueryImsState = new MockVtQueryImsState(mContext, SUB_ID);
mQueryImsState.setIsEnabledByUser(true);
mQueryVoLteState = new MockVolteQueryImsState(mContext, SUB_ID);
mQueryVoLteState.setIsEnabledByUser(true);
mPreference = new SwitchPreference(mContext);
mController = spy(new VideoCallingPreferenceController(mContext, "wifi_calling"));
mController.init(SUB_ID);
doReturn(mQueryImsState).when(mController).queryImsState(anyInt());
doReturn(mQueryVoLteState).when(mController).queryVoLteState(anyInt());
mPreference.setKey(mController.getPreferenceKey());
mQueryImsState.setIsEnabledByPlatform(true);
mQueryImsState.setIsProvisionedOnDevice(true);
mQueryImsState.setServiceStateReady(true);
doReturn(true).when(mTelephonyManager).isDataEnabled();
mController.mCallState = TelephonyManager.CALL_STATE_IDLE;
}
use of com.android.settings.network.ims.MockVolteQueryImsState in project android_packages_apps_Settings by omnirom.
the class Enhanced4gLteSliceHelperTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
mFeatureFactory = FakeFeatureFactory.setupForTest();
mSlicesFeatureProvider = mFeatureFactory.getSlicesFeatureProvider();
// setup for SettingsSliceProvider tests
mProvider = new SettingsSliceProvider();
mProvider.attachInfo(mContext, null);
mProvider.onCreateSliceProvider();
// setup for SliceBroadcastReceiver test
mReceiver = spy(new SliceBroadcastReceiver());
mQueryImsState = spy(new MockVolteQueryImsState(mContext, SUB_ID));
mQueryImsState.setEnabledByPlatform(true);
mQueryImsState.setIsProvisionedOnDevice(true);
mQueryImsState.setIsTtyOnVolteEnabled(true);
mQueryImsState.setServiceStateReady(true);
mQueryImsState.setIsEnabledByUser(true);
mEnhanced4gLteSliceHelper = spy(new FakeEnhanced4gLteSliceHelper(mContext));
// Set-up specs for SliceMetadata.
SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
}
use of com.android.settings.network.ims.MockVolteQueryImsState in project android_packages_apps_Settings by omnirom.
the class Enhanced4gBasePreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager);
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
when(mContext.getSystemService(CarrierConfigManager.class)).thenReturn(mCarrierConfigManager);
doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(SUB_ID);
doReturn(mInvalidTelephonyManager).when(mTelephonyManager).createForSubscriptionId(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
mCarrierConfig = new PersistableBundle();
doReturn(mCarrierConfig).when(mCarrierConfigManager).getConfigForSubId(SUB_ID);
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_HIDE_ENHANCED_4G_LTE_BOOL, false);
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_EDITABLE_ENHANCED_4G_LTE_BOOL, true);
mCarrierConfig.putInt(CarrierConfigManager.KEY_ENHANCED_4G_LTE_TITLE_VARIANT_INT, 1);
mQueryImsState = spy(new MockVolteQueryImsState(mContext, SUB_ID));
mQueryImsState.setEnabledByPlatform(true);
mQueryImsState.setIsProvisionedOnDevice(true);
mQueryImsState.setIsTtyOnVolteEnabled(true);
mQueryImsState.setServiceStateReady(true);
mQueryImsState.setIsEnabledByUser(true);
mPreference = new RestrictedSwitchPreference(mContext);
mController = spy(new Enhanced4gLtePreferenceController(mContext, "VoLTE"));
mController.init(SUB_ID);
doReturn(mQueryImsState).when(mController).queryImsState(anyInt());
doReturn(true).when(mController).isCallStateIdle();
doReturn(1).when(mController).getMode();
mPreference.setKey(mController.getPreferenceKey());
}
Aggregations