use of org.chromium.base.VisibleForTesting in project AndroidChromium by JackyAndroid.
the class MinidumpUploadService method createFindAndUploadAllCrashesIntent.
/**
* Creates an intent that when started will find all minidumps, and try to upload them.
*
* @param context the context to use for the intent.
* @return an Intent to use to start the service.
*/
@VisibleForTesting
static Intent createFindAndUploadAllCrashesIntent(Context context) {
Intent intent = new Intent(context, MinidumpUploadService.class);
intent.setAction(ACTION_FIND_ALL);
return intent;
}
use of org.chromium.base.VisibleForTesting in project AndroidChromium by JackyAndroid.
the class RequestThrottler method purgeAllEntriesForTesting.
@VisibleForTesting
static void purgeAllEntriesForTesting(Context context) {
SharedPreferences sharedPreferences = context.getSharedPreferences(PREFERENCES_NAME, 0);
sharedPreferences.edit().clear().apply();
if (sUidToThrottler != null)
sUidToThrottler.clear();
}
use of org.chromium.base.VisibleForTesting in project AndroidChromium by JackyAndroid.
the class LogcatExtractionCallable method elideUrl.
/**
* Elides any URLs in the specified {@link String} with
* {@link #URL_ELISION}.
*
* @param original String potentially containing URLs.
* @return String with elided URLs.
*/
@VisibleForTesting
protected static String elideUrl(String original) {
StringBuilder buffer = new StringBuilder(original);
Matcher matcher = WEB_URL.matcher(buffer);
int start = 0;
while (matcher.find(start)) {
start = matcher.start();
int end = matcher.end();
String url = buffer.substring(start, end);
if (!likelyToBeChromeNamespace(url) && !likelyToBeSystemNamespace(url)) {
buffer.replace(start, end, URL_ELISION);
end = start + URL_ELISION.length();
matcher = WEB_URL.matcher(buffer);
}
start = end;
}
return buffer.toString();
}
use of org.chromium.base.VisibleForTesting in project AndroidChromium by JackyAndroid.
the class DownloadNotificationService method pauseAllDownloads.
/**
* Called to pause all the download notifications.
*/
@VisibleForTesting
void pauseAllDownloads() {
for (int i = mDownloadSharedPreferenceEntries.size() - 1; i >= 0; --i) {
DownloadSharedPreferenceEntry entry = mDownloadSharedPreferenceEntries.get(i);
notifyDownloadPaused(entry.downloadGuid, !entry.isOffTheRecord, true);
}
}
use of org.chromium.base.VisibleForTesting in project AndroidChromium by JackyAndroid.
the class ExternalNavigationDelegateImpl method getSpecializedHandlersWithFilter.
@VisibleForTesting
static ArrayList<String> getSpecializedHandlersWithFilter(List<ResolveInfo> infos, String filterPackageName) {
ArrayList<String> result = new ArrayList<>();
if (infos == null) {
return result;
}
int count = 0;
for (ResolveInfo info : infos) {
IntentFilter filter = info.filter;
if (filter == null) {
// Error on the side of classifying ResolveInfo as generic.
continue;
}
if (filter.countDataAuthorities() == 0 && filter.countDataPaths() == 0) {
// Don't count generic handlers.
continue;
}
if (!TextUtils.isEmpty(filterPackageName) && (info.activityInfo == null || !info.activityInfo.packageName.equals(filterPackageName))) {
continue;
}
result.add(info.activityInfo != null ? info.activityInfo.packageName : "");
}
return result;
}
Aggregations