Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4114)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest.java

Issue 2809223003: Fix DownloadNotificationService crash caused by early getLastUsedProfile() call (Closed)
Patch Set: Fix tests on KitKat (ServiceTestCase is buggy on KitKat) Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest.java
index bd1b00b10e55eeb3c7ca96ec77d6570336fdbbc0..02b45c98ca970ad10f7c40c28f1b582f8c1f37f0 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest.java
@@ -96,6 +96,16 @@ public class DownloadNotificationServiceTest extends
}
@Override
+ protected void shutdownService() {
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ DownloadNotificationServiceTest.super.shutdownService();
+ }
+ });
+ }
+
+ @Override
protected void tearDown() throws Exception {
SharedPreferences sharedPrefs = ContextUtils.getAppSharedPreferences();
SharedPreferences.Editor editor = sharedPrefs.edit();
@@ -402,7 +412,14 @@ public class DownloadNotificationServiceTest extends
DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS, notifications);
editor.apply();
startNotificationService();
- getService().onTaskRemoved(new Intent());
+
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ getService().onTaskRemoved(new Intent());
+ }
+ });
+
assertTrue(getService().isPaused());
assertFalse(sharedPrefs.contains(
DownloadSharedPreferenceHelper.KEY_PENDING_DOWNLOAD_NOTIFICATIONS));
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698