Search in sources :

Example 16 with InstantAppDataProvider

use of com.android.settingslib.applications.instantapps.InstantAppDataProvider in project android_packages_apps_Settings by LineageOS.

the class AdvancedPowerUsageDetailTest method testInitHeader_HasAppEntry_InstantApp.

@Test
public void testInitHeader_HasAppEntry_InstantApp() {
    ReflectionHelpers.setStaticField(AppUtils.class, "sInstantAppDataProvider", new InstantAppDataProvider() {

        @Override
        public boolean isInstantApp(ApplicationInfo info) {
            return true;
        }
    });
    mFragment.mAppEntry = mAppEntry;
    mFragment.initHeader();
    verify(mEntityHeaderController).setIcon(mAppEntry);
    verify(mEntityHeaderController).setLabel(mAppEntry);
    verify(mEntityHeaderController).setIsInstantApp(true);
    verify(mEntityHeaderController).setSummary((CharSequence) null);
}
Also used : InstantAppDataProvider(com.android.settingslib.applications.instantapps.InstantAppDataProvider) ApplicationInfo(android.content.pm.ApplicationInfo) Test(org.junit.Test)

Example 17 with InstantAppDataProvider

use of com.android.settingslib.applications.instantapps.InstantAppDataProvider in project android_packages_apps_Settings by LineageOS.

the class AppButtonsPreferenceControllerTest method testIsAvailable_nonInstantApp.

@Test
public void testIsAvailable_nonInstantApp() throws Exception {
    mController.mAppEntry = mAppEntry;
    ReflectionHelpers.setStaticField(AppUtils.class, "sInstantAppDataProvider", new InstantAppDataProvider() {

        @Override
        public boolean isInstantApp(ApplicationInfo info) {
            return false;
        }
    });
    assertThat(mController.isAvailable()).isTrue();
}
Also used : InstantAppDataProvider(com.android.settingslib.applications.instantapps.InstantAppDataProvider) ApplicationInfo(android.content.pm.ApplicationInfo) Test(org.junit.Test)

Example 18 with InstantAppDataProvider

use of com.android.settingslib.applications.instantapps.InstantAppDataProvider in project android_packages_apps_Settings by omnirom.

the class AppButtonsPreferenceControllerTest method testIsAvailable_nonInstantApp.

@Test
public void testIsAvailable_nonInstantApp() throws Exception {
    mController.mAppEntry = mAppEntry;
    ReflectionHelpers.setStaticField(AppUtils.class, "sInstantAppDataProvider", new InstantAppDataProvider() {

        @Override
        public boolean isInstantApp(ApplicationInfo info) {
            return false;
        }
    });
    assertThat(mController.isAvailable()).isTrue();
}
Also used : InstantAppDataProvider(com.android.settingslib.applications.instantapps.InstantAppDataProvider) ApplicationInfo(android.content.pm.ApplicationInfo) Test(org.junit.Test)

Example 19 with InstantAppDataProvider

use of com.android.settingslib.applications.instantapps.InstantAppDataProvider in project android_packages_apps_Settings by DirtyUnicorns.

the class AdvancedPowerUsageDetailTest method testInitHeader_HasAppEntry_InstantApp.

@Test
public void testInitHeader_HasAppEntry_InstantApp() {
    ReflectionHelpers.setStaticField(AppUtils.class, "sInstantAppDataProvider", new InstantAppDataProvider() {

        @Override
        public boolean isInstantApp(ApplicationInfo info) {
            return true;
        }
    });
    mFragment.mAppEntry = mAppEntry;
    mFragment.initHeader();
    verify(mEntityHeaderController).setIcon(mAppEntry);
    verify(mEntityHeaderController).setLabel(mAppEntry);
    verify(mEntityHeaderController).setIsInstantApp(true);
    verify(mEntityHeaderController).setSummary((CharSequence) null);
}
Also used : InstantAppDataProvider(com.android.settingslib.applications.instantapps.InstantAppDataProvider) ApplicationInfo(android.content.pm.ApplicationInfo) Test(org.junit.Test)

Example 20 with InstantAppDataProvider

use of com.android.settingslib.applications.instantapps.InstantAppDataProvider in project android_packages_apps_Settings by crdroidandroid.

the class AppButtonsPreferenceControllerTest method testIsAvailable_instantApp.

@Test
public void testIsAvailable_instantApp() throws Exception {
    mController.mAppEntry = mAppEntry;
    ReflectionHelpers.setStaticField(AppUtils.class, "sInstantAppDataProvider", new InstantAppDataProvider() {

        @Override
        public boolean isInstantApp(ApplicationInfo info) {
            return true;
        }
    });
    assertThat(mController.isAvailable()).isFalse();
}
Also used : InstantAppDataProvider(com.android.settingslib.applications.instantapps.InstantAppDataProvider) ApplicationInfo(android.content.pm.ApplicationInfo) Test(org.junit.Test)

Aggregations

ApplicationInfo (android.content.pm.ApplicationInfo)28 InstantAppDataProvider (com.android.settingslib.applications.instantapps.InstantAppDataProvider)28 Test (org.junit.Test)28