Search in sources :

Example 1 with MockVtQueryImsState

use of com.android.settings.network.ims.MockVtQueryImsState 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;
}
Also used : PersistableBundle(android.os.PersistableBundle) SwitchPreference(androidx.preference.SwitchPreference) MockVolteQueryImsState(com.android.settings.network.ims.MockVolteQueryImsState) MockVtQueryImsState(com.android.settings.network.ims.MockVtQueryImsState) Before(org.junit.Before)

Aggregations

PersistableBundle (android.os.PersistableBundle)1 SwitchPreference (androidx.preference.SwitchPreference)1 MockVolteQueryImsState (com.android.settings.network.ims.MockVolteQueryImsState)1 MockVtQueryImsState (com.android.settings.network.ims.MockVtQueryImsState)1 Before (org.junit.Before)1