use of org.robolectric.shadows.ShadowPackageManager in project Parse-SDK-Android by ParsePlatform.
the class ParseClientConfigurationTest method setupMockMetaData.
private Bundle setupMockMetaData() throws Exception {
Bundle metaData = mock(Bundle.class);
ShadowPackageManager packageManager = shadowOf(RuntimeEnvironment.application.getPackageManager());
ApplicationInfo info = packageManager.getApplicationInfo(RuntimeEnvironment.application.getPackageName(), PackageManager.GET_META_DATA);
info.metaData = metaData;
return metaData;
}
use of org.robolectric.shadows.ShadowPackageManager in project sms-backup-plus by jberkel.
the class BackupJobsTest method before.
@Before
public void before() {
initMocks(this);
ShadowPackageManager pm = shadowOf(RuntimeEnvironment.application.getPackageManager());
Intent executeIntent = new Intent("com.firebase.jobdispatcher.ACTION_EXECUTE");
executeIntent.setClassName(RuntimeEnvironment.application, "com.zegoggles.smssync.service.SmsJobService");
ResolveInfo ri = new ResolveInfo();
ServiceInfo si = new ServiceInfo();
si.packageName = "com.zegoggles.smssync.service.SmsJobService";
ri.serviceInfo = si;
ri.isDefault = true;
pm.addResolveInfoForIntent(executeIntent, ri);
subject = new BackupJobs(RuntimeEnvironment.application, preferences);
when(preferences.getDataTypePreferences()).thenReturn(dataTypePreferences);
}
use of org.robolectric.shadows.ShadowPackageManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SetupChooseLockPatternTest method chooseLockSaved_shouldEnableRedactionInterstitial.
@Test
public void chooseLockSaved_shouldEnableRedactionInterstitial() {
findFragment(mActivity).onChosenLockSaveFinished(false, null);
ShadowPackageManager spm = Shadows.shadowOf(application.getPackageManager());
ComponentName cname = new ComponentName(application, SetupRedactionInterstitial.class);
final int componentEnabled = spm.getComponentEnabledSettingFlags(cname) & PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
assertThat(componentEnabled).isEqualTo(PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
}
use of org.robolectric.shadows.ShadowPackageManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LiveCaptionPreferenceControllerTest method getAvailabilityStatus_canResolveIntent_shouldReturnAvailable.
@Test
public void getAvailabilityStatus_canResolveIntent_shouldReturnAvailable() {
final ShadowPackageManager pm = Shadows.shadowOf(RuntimeEnvironment.application.getPackageManager());
pm.addResolveInfoForIntent(LiveCaptionPreferenceController.LIVE_CAPTION_INTENT, new ResolveInfo());
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
}
use of org.robolectric.shadows.ShadowPackageManager in project android_packages_apps_Settings by omnirom.
the class TtsEnginePreferenceFragmentTest method setUp.
@Before
public void setUp() {
mContext = RuntimeEnvironment.application;
final ResolveInfo info = new ResolveInfo();
final ServiceInfo serviceInfo = spy(new ServiceInfo());
serviceInfo.packageName = mContext.getPackageName();
serviceInfo.name = mContext.getClass().getName();
info.serviceInfo = serviceInfo;
doReturn("title").when(serviceInfo).loadLabel(any(PackageManager.class));
doReturn(1).when(serviceInfo).getIconResource();
final ShadowPackageManager spm = Shadow.extract(mContext.getPackageManager());
spm.addResolveInfoForIntent(new Intent(TextToSpeech.Engine.INTENT_ACTION_TTS_SERVICE), info);
}
Aggregations