use of com.android.settings.network.ims.MockWifiCallingQueryImsState in project android_packages_apps_Settings by omnirom.
the class WifiCallingSettingsForSubTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
doReturn(mContext.getTheme()).when(mActivity).getTheme();
mFragment = spy(new TestFragment());
doReturn(mActivity).when(mFragment).getActivity();
doReturn(mContext).when(mFragment).getContext();
doReturn(mock(Intent.class)).when(mActivity).getIntent();
doReturn(mContext.getResources()).when(mFragment).getResources();
doReturn(mPreferenceScreen).when(mFragment).getPreferenceScreen();
doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(anyInt());
final Bundle bundle = new Bundle();
when(mFragment.getArguments()).thenReturn(bundle);
doNothing().when(mFragment).addPreferencesFromResource(anyInt());
doReturn(mock(ListWithEntrySummaryPreference.class)).when(mFragment).findPreference(any());
doReturn(mButtonWfcMode).when(mFragment).findPreference(BUTTON_WFC_MODE);
doReturn(mButtonWfcRoamingMode).when(mFragment).findPreference(BUTTON_WFC_ROAMING_MODE);
doNothing().when(mFragment).finish();
doReturn(mView).when(mFragment).getView();
mEmptyView = new TextView(mContext);
doReturn(mEmptyView).when(mView).findViewById(android.R.id.empty);
mSwitchBar = new SettingsMainSwitchBar(mContext);
doReturn(mSwitchBar).when(mView).findViewById(R.id.switch_bar);
mQueryImsState = new MockWifiCallingQueryImsState(mContext, SUB_ID);
doReturn(mImsMmTelManager).when(mFragment).getImsMmTelManager();
mQueryImsState.setIsProvisionedOnDevice(true);
mQueryImsState.setIsEnabledByPlatform(true);
mQueryImsState.setIsEnabledByUser(true);
mQueryImsState.setIsTtyOnVolteEnabled(true);
doReturn(ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED).when(mImsMmTelManager).getVoWiFiModeSetting();
doReturn(ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED).when(mImsMmTelManager).getVoWiFiRoamingModeSetting();
doReturn(mBundle).when(sCarrierConfigManager).getConfigForSubId(anyInt());
setDefaultCarrierConfigValues();
doReturn(sCarrierConfigManager).when(mActivity).getSystemService(CarrierConfigManager.class);
doReturn(mContext.getResources()).when(mFragment).getResourcesForSubId();
doNothing().when(mFragment).startActivityForResult(any(Intent.class), anyInt());
mFragment.onAttach(mContext);
mFragment.onCreate(null);
mFragment.onActivityCreated(null);
}
use of com.android.settings.network.ims.MockWifiCallingQueryImsState in project android_packages_apps_Settings by omnirom.
the class WifiCallingSettingsTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
mQueryImsState1 = new MockWifiCallingQueryImsState(mContext, SUB_ID1);
mQueryImsState2 = new MockWifiCallingQueryImsState(mContext, SUB_ID2);
mQueryImsState1.setIsEnabledByUser(true);
mQueryImsState2.setIsEnabledByUser(true);
mQueryImsState1.setIsEnabledByPlatform(true);
mQueryImsState2.setIsEnabledByPlatform(true);
mQueryImsState1.setIsProvisionedOnDevice(true);
mQueryImsState2.setIsProvisionedOnDevice(true);
mFragment = spy(new WifiCallingSettings());
doReturn(mQueryImsState1).when(mFragment).queryImsState(SUB_ID1);
doReturn(mQueryImsState2).when(mFragment).queryImsState(SUB_ID2);
}
use of com.android.settings.network.ims.MockWifiCallingQueryImsState in project android_packages_apps_Settings by omnirom.
the class WifiCallingSliceHelperTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
// setup for SettingsSliceProvider tests
mProvider = spy(new SettingsSliceProvider());
doReturn(mContext).when(mProvider).getContext();
mProvider.onCreateSliceProvider();
// setup for SliceBroadcastReceiver test
mReceiver = spy(new SliceBroadcastReceiver());
mFeatureFactory = FakeFeatureFactory.setupForTest();
mSlicesFeatureProvider = mFeatureFactory.getSlicesFeatureProvider();
mQueryImsState = new MockWifiCallingQueryImsState(mContext, SUB_ID);
mQueryImsState.setIsEnabledByUser(true);
mQueryImsState.setIsEnabledByPlatform(true);
mQueryImsState.setIsProvisionedOnDevice(true);
mWfcSliceHelper = spy(new FakeWifiCallingSliceHelper(mContext));
doReturn(mQueryImsState).when(mWfcSliceHelper).queryImsState(anyInt());
// Set-up specs for SliceMetadata.
SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
}
use of com.android.settings.network.ims.MockWifiCallingQueryImsState in project android_packages_apps_Settings by omnirom.
the class WifiCallingPreferenceControllerTest method setUp.
@Before
@UiThreadTest
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
mQueryImsState = new MockWifiCallingQueryImsState(mContext, SUB_ID);
mQueryImsState.setIsEnabledByUser(true);
mQueryImsState.setIsProvisionedOnDevice(true);
mController = new TestWifiCallingPreferenceController(mContext, "wifi_calling");
mController.mCarrierConfigManager = mCarrierConfigManager;
mController.init(SUB_ID);
mController.mCallState = TelephonyManager.CALL_STATE_IDLE;
mCarrierConfig = new PersistableBundle();
when(mCarrierConfigManager.getConfigForSubId(SUB_ID)).thenReturn(mCarrierConfig);
mPreferenceManager = new PreferenceManager(mContext);
mScreen = mPreferenceManager.createPreferenceScreen(mContext);
mPreference = new Preference(mContext);
mPreference.setKey(mController.getPreferenceKey());
mScreen.addPreference(mPreference);
}
Aggregations