use of android.platform.test.annotations.Presubmit in project android_packages_apps_Settings by omnirom.
the class LifecycleEventHandlingTest method launchDashboard_shouldSeeFooter.
@Test
@Presubmit
@Ignore("b/133334887")
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 SettingsSearchResultRegressionTest method searchResultsDoNotRegress.
/**
* Tests that the set of search results does not regress.
* <p>
* The data set used here (/tests/unit/assets/search_results_list) needs to be updated
* every once in a while so that we can check newly added results.
* </p>
*/
@Test
@Presubmit
public void searchResultsDoNotRegress() {
final ContentResolver resolver = mContext.getContentResolver();
final Uri uri = getTestProviderUri();
if (uri == null) {
Log.e(TAG, "Something is wrong getting test provider uri, skipping");
return;
}
final Cursor cursor = resolver.query(uri, null, null, null, null);
if (cursor == null) {
// Assume Settings Intelligence is wrong.
return;
}
final Set<SearchData> availableSearchResults = getSearchDataFromCursor(cursor);
final Set<SearchData> registeredSearchResults = getRegisteredResults();
// Seed with results that we expect
final Set<SearchData> missingSearchResults = new HashSet<>(registeredSearchResults);
// Seed with results that are available
final Set<SearchData> newSearchResults = new HashSet<>(availableSearchResults);
// Remove all available results, leaving results that have been removed.
missingSearchResults.removeAll(availableSearchResults);
// Remove all results we expect, leaving results that have not yet been registered.
newSearchResults.removeAll(registeredSearchResults);
assertWithMessage(ERROR_RESULTS_MISSING + ERROR_RERUN_TEST).that(missingSearchResults).isEmpty();
assertWithMessage(ERROR_NEW_RESULTS + ERROR_RERUN_TEST).that(newSearchResults).isEmpty();
}
use of android.platform.test.annotations.Presubmit in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SliceDataContractTest method preferenceWithControllerMustHaveNonEmptyTitle.
@Test
@Presubmit
public void preferenceWithControllerMustHaveNonEmptyTitle() throws IOException, XmlPullParserException {
final Set<String> nullTitleFragments = new HashSet<>();
final SearchIndexableResources resources = FeatureFactory.getFactory(mContext).getSearchFeatureProvider().getSearchIndexableResources();
for (Class<?> clazz : resources.getProviderValues()) {
verifyPreferenceTitle(nullTitleFragments, clazz);
}
if (!nullTitleFragments.isEmpty()) {
final StringBuilder error = new StringBuilder("All preferences with a controller must have a non-empty title by default, " + "found empty title in the following fragments\n");
for (String c : nullTitleFragments) {
error.append(c).append("\n");
}
fail(error.toString());
}
}
use of android.platform.test.annotations.Presubmit in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SettingsSearchIndexablesProviderTest method nonIndexableKeys_shouldNotCrash.
/**
* All {@link Indexable.SearchIndexProvider} should collect a list of non-indexable keys
* without crashing. This test enables crashing of individual providers in the indexing pipeline
* and checks that there are no crashes.
*/
@Test
@Presubmit
public void nonIndexableKeys_shouldNotCrash() {
// Allow crashes in the indexing pipeline.
System.setProperty(SettingsSearchIndexablesProvider.SYSPROP_CRASH_ON_ERROR, "enabled");
final Uri uri = Uri.parse("content://" + mContext.getPackageName() + "/" + SearchIndexablesContract.NON_INDEXABLES_KEYS_PATH);
mContext.getContentResolver().query(uri, null, null, null, null);
}
use of android.platform.test.annotations.Presubmit in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class UniquePreferenceTest method allPreferencesShouldHaveUniqueKey.
/**
* All preferences should have their unique key. It's especially important for many parts of
* Settings to work properly: we assume pref keys are unique in displaying, search ranking,\
* search result suppression, and many other areas.
* <p/>
* So in this test we are checking preferences participating in search.
* <p/>
* Note: Preference is not limited to just <Preference/> object. Everything in preference xml
* should have a key.
*/
@Test
@Presubmit
public void allPreferencesShouldHaveUniqueKey() throws IOException, XmlPullParserException, Resources.NotFoundException {
final Set<String> uniqueKeys = new HashSet<>();
final Set<String> nullKeyClasses = new HashSet<>();
final Set<String> duplicatedKeys = new HashSet<>();
final SearchIndexableResources resources = FeatureFactory.getFactory(mContext).getSearchFeatureProvider().getSearchIndexableResources();
for (Class<?> clazz : resources.getProviderValues()) {
verifyPreferenceKeys(uniqueKeys, duplicatedKeys, nullKeyClasses, clazz);
}
if (!nullKeyClasses.isEmpty()) {
final StringBuilder nullKeyErrors = new StringBuilder().append("Each preference/SearchIndexableData must have a key, ").append("the following classes have null keys:\n");
for (String c : nullKeyClasses) {
nullKeyErrors.append(c).append("\n");
}
fail(nullKeyErrors.toString());
}
if (!duplicatedKeys.isEmpty()) {
final StringBuilder dupeKeysError = new StringBuilder("The following keys are not unique\n");
for (String c : duplicatedKeys) {
dupeKeysError.append(c).append("\n");
}
fail(dupeKeysError.toString());
}
}
Aggregations