Search in sources :

Example 16 with ShadowPackageManager

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

the class LiveCaptionPreferenceControllerTest method getAvailabilityStatus_noResolveIntent_shouldReturnUnavailable.

@Test
public void getAvailabilityStatus_noResolveIntent_shouldReturnUnavailable() {
    final ShadowPackageManager pm = Shadows.shadowOf(RuntimeEnvironment.application.getPackageManager());
    pm.setResolveInfosForIntent(LiveCaptionPreferenceController.LIVE_CAPTION_INTENT, Collections.emptyList());
    assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
}
Also used : ShadowPackageManager(org.robolectric.shadows.ShadowPackageManager) Test(org.junit.Test)

Example 17 with ShadowPackageManager

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

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);
}
Also used : ShadowPackageManager(org.robolectric.shadows.ShadowPackageManager) ComponentName(android.content.ComponentName) Test(org.junit.Test)

Aggregations

ShadowPackageManager (org.robolectric.shadows.ShadowPackageManager)17 Test (org.junit.Test)9 ResolveInfo (android.content.pm.ResolveInfo)7 ApplicationInfo (android.content.pm.ApplicationInfo)5 ComponentName (android.content.ComponentName)4 Before (org.junit.Before)4 Intent (android.content.Intent)3 PackageInfo (android.content.pm.PackageInfo)3 PackageManager (android.content.pm.PackageManager)3 ServiceInfo (android.content.pm.ServiceInfo)3 Context (android.content.Context)2 ProviderInfo (android.content.pm.ProviderInfo)2 BatteryFixSliceTest (com.android.settings.homepage.contextualcards.slices.BatteryFixSliceTest)2 ActivityThread (android.app.ActivityThread)1 Application (android.app.Application)1 LoadedApk (android.app.LoadedApk)1 Package (android.content.pm.PackageParser.Package)1 Resources (android.content.res.Resources)1 Bundle (android.os.Bundle)1 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)1