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

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaImageManagerTest.java

Issue 2629083004: [Media>UI] Follow-up fix for avoiding downloading image twice (Closed)
Patch Set: 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/java/src/org/chromium/chrome/browser/media/ui/MediaImageManager.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaImageManagerTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaImageManagerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaImageManagerTest.java
index 372dd0116fa3323f35f6c7098b8ae70465eea5c4..ce176cfc6fda133b325247cf682d75cd64069145 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaImageManagerTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaImageManagerTest.java
@@ -120,6 +120,30 @@ public class MediaImageManagerTest {
}
@Test
+ public void testDownloadSameImageTwiceButFailed() {
+ // First download.
+ mBitmaps.clear();
+ mOriginalImageSizes.clear();
+
+ mMediaImageManager.downloadImage(mImages, mCallback);
+ mMediaImageManager.onFinishDownloadImage(
+ REQUEST_ID_1, 404, IMAGE_URL_1, mBitmaps, mOriginalImageSizes);
+
+ // Second download.
+ mMediaImageManager.downloadImage(mImages, mCallback);
+ // The second download request will never be initiated and the callback
+ // will be ignored.
+ mMediaImageManager.onFinishDownloadImage(
+ REQUEST_ID_1, 200, IMAGE_URL_1, mBitmaps, mOriginalImageSizes);
+
+ verify(mWebContents, times(1))
+ .downloadImage(eq(IMAGE_URL_1), eq(false),
+ eq(MediaImageManager.MAX_BITMAP_SIZE_FOR_DOWNLOAD), eq(false),
+ eq(mMediaImageManager));
+ verify(mCallback, times(1)).onImageDownloaded(isNull(Bitmap.class));
+ }
+
+ @Test
public void testDownloadDifferentImagesTwice() {
// First download.
mMediaImageManager.downloadImage(mImages, mCallback);
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaImageManager.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698