use of android.platform.test.annotations.Presubmit in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LifecycleEventHandlingTest method launchDashboard_shouldSeeFooter.
@Test
@Presubmit
public void launchDashboard_shouldSeeFooter() {
new SubSettingLauncher(mContext).setDestination(FeatureFlagsDashboard.class.getName()).setSourceMetricsCategory(Instrumentable.METRICS_CATEGORY_UNKNOWN).addFlags(FLAG_ACTIVITY_NEW_TASK).launch();
final String footerText = "Experimental";
// Scroll to bottom
final UiObject2 view = mDevice.wait(Until.findObject(By.res(mTargetPackage, "main_content")), TIMEOUT);
view.scroll(Direction.DOWN, 100f);
assertThat(mDevice.wait(Until.findObject(By.text(footerText)), TIMEOUT)).isNotNull();
}
use of android.platform.test.annotations.Presubmit in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SettingsGatewayTest method publicFragmentMustAppearInSettingsGateway.
@Test
@Presubmit
public void publicFragmentMustAppearInSettingsGateway() throws PackageManager.NameNotFoundException {
final List<String> whitelistedFragment = new ArrayList<>();
final StringBuilder error = new StringBuilder();
for (String fragment : SettingsGateway.ENTRY_FRAGMENTS) {
whitelistedFragment.add(fragment);
}
final PackageInfo pi = mPackageManager.getPackageInfo(mPackageName, GET_META_DATA | MATCH_DISABLED_COMPONENTS | GET_ACTIVITIES);
final List<ActivityInfo> activities = Arrays.asList(pi.activities);
for (ActivityInfo activity : activities) {
final Bundle metaData = activity.metaData;
if (metaData == null || !metaData.containsKey(META_DATA_KEY_FRAGMENT_CLASS)) {
continue;
}
final String fragmentName = metaData.getString(META_DATA_KEY_FRAGMENT_CLASS);
assertThat(fragmentName).isNotNull();
if (!whitelistedFragment.contains(fragmentName)) {
error.append("SettingsGateway.ENTRY_FRAGMENTS must contain " + fragmentName + " because this fragment is used in manifest for " + activity.name).append("\n");
}
}
final String message = error.toString();
if (!TextUtils.isEmpty(message)) {
fail(message);
}
}
use of android.platform.test.annotations.Presubmit in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SettingsGatewayTest method allRestrictedActivityMustBeDefinedInManifest.
@Test
@Presubmit
public void allRestrictedActivityMustBeDefinedInManifest() {
for (String className : SettingsGateway.SETTINGS_FOR_RESTRICTED) {
final Intent intent = new Intent();
intent.setComponent(new ComponentName(mPackageName, className));
List<ResolveInfo> resolveInfos = mPackageManager.queryIntentActivities(intent, MATCH_DISABLED_COMPONENTS);
Log.d(TAG, mPackageName + "/" + className + "; resolveInfo size: " + resolveInfos.size());
assertFalse(className + " is not-defined in manifest", resolveInfos.isEmpty());
}
}
use of android.platform.test.annotations.Presubmit in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class PreferenceControllerContractTest method controllersInSearchShouldImplementPreferenceControllerMixin.
@Test
@Presubmit
public void controllersInSearchShouldImplementPreferenceControllerMixin() {
// Required by AutofillLoggingLevelPreferenceController
Looper.prepare();
final Set<String> errorClasses = new ArraySet<>();
final SearchIndexableResources resources = FeatureFactory.getFactory(mContext).getSearchFeatureProvider().getSearchIndexableResources();
for (Class<?> clazz : resources.getProviderValues()) {
final Indexable.SearchIndexProvider provider = DatabaseIndexingUtils.getSearchIndexProvider(clazz);
if (provider == null) {
continue;
}
final List<AbstractPreferenceController> controllers = provider.getPreferenceControllers(mContext);
if (controllers == null) {
continue;
}
for (AbstractPreferenceController controller : controllers) {
if (!(controller instanceof PreferenceControllerMixin) && !(controller instanceof BasePreferenceController)) {
errorClasses.add(controller.getClass().getName());
}
}
}
if (!errorClasses.isEmpty()) {
final StringBuilder errorMessage = new StringBuilder().append("Each preference must implement PreferenceControllerMixin ").append("or extend BasePreferenceController, ").append("the following classes don't:\n");
for (String c : errorClasses) {
errorMessage.append(c).append("\n");
}
fail(errorMessage.toString());
}
}
use of android.platform.test.annotations.Presubmit in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class HomepageDisplayTests method testHomepageCategory.
@Presubmit
@Test
public void testHomepageCategory() throws Exception {
// Launch Settings
SettingsHelper.launchSettingsPage(InstrumentationRegistry.getContext(), Settings.ACTION_SETTINGS);
// Scroll to top
final UiObject2 view = mDevice.wait(Until.findObject(By.res(SETTINGS_PACKAGE, "main_content")), TIMEOUT);
view.scroll(Direction.UP, 100f);
// Inspect each item
for (String item : HOMEPAGE_ITEMS) {
SettingsTestUtils.assertTitleMatch(mDevice, item);
}
}
Aggregations