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

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

Issue 2625493004: Move DownloadSharedPreferenceEntry handling into another class (Closed)
Patch Set: fixing thread check in tests Created 3 years, 11 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/javatests/src/org/chromium/chrome/browser/download/MockDownloadNotificationService.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/SystemDownloadNotifierTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/SystemDownloadNotifierTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/SystemDownloadNotifierTest.java
index e776ec71453c8556169994f2379142e1242930cb..4a568b1156759415a560cfde2b7adffabdebbcfd 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/SystemDownloadNotifierTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/SystemDownloadNotifierTest.java
@@ -12,6 +12,8 @@ import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.AdvancedMockContext;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.RetryOnFailure;
+import org.chromium.content.browser.test.util.Criteria;
+import org.chromium.content.browser.test.util.CriteriaHelper;
import java.util.UUID;
@@ -79,7 +81,13 @@ public class SystemDownloadNotifierTest extends InstrumentationTestCase {
DownloadInfo info = new DownloadInfo.Builder()
.setDownloadGuid(UUID.randomUUID().toString()).build();
mDownloadNotifier.notifyDownloadProgress(info, 1L, true);
- assertTrue(mDownloadNotifier.mStarted);
+ assertFalse(mDownloadNotifier.mStarted);
+ CriteriaHelper.pollUiThread(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ return mDownloadNotifier.mStarted;
+ }
+ });
onServiceConnected();
assertEquals(1, mService.getNotificationIds().size());
@@ -95,14 +103,24 @@ public class SystemDownloadNotifierTest extends InstrumentationTestCase {
DownloadInfo info = new DownloadInfo.Builder()
.setDownloadGuid(UUID.randomUUID().toString()).build();
mDownloadNotifier.notifyDownloadProgress(info, 1L, true);
- assertTrue(mDownloadNotifier.mStarted);
+ assertFalse(mDownloadNotifier.mStarted);
+ CriteriaHelper.pollUiThread(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ return mDownloadNotifier.mStarted;
+ }
+ });
DownloadInfo info2 = new DownloadInfo.Builder()
.setDownloadGuid(UUID.randomUUID().toString()).build();
mDownloadNotifier.notifyDownloadProgress(info2, 1L, true);
mDownloadNotifier.notifyDownloadFailed(info);
- assertTrue(mDownloadNotifier.mStarted);
mDownloadNotifier.notifyDownloadSuccessful(info2, 100L, true, false);
- assertFalse(mDownloadNotifier.mStarted);
+ CriteriaHelper.pollUiThread(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ return !mDownloadNotifier.mStarted;
+ }
+ });
}
}
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/download/MockDownloadNotificationService.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698