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

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

Issue 2626903005: [Download Home] Add missing files to map (Closed)
Patch Set: Rebasing 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/ui/DownloadHistoryAdapterTest.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/ui/StubbedProvider.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/ui/StubbedProvider.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/ui/StubbedProvider.java
index 44babce934a4e26435b301baa966298f9cd0603c..3846e681e694dbf4b83d45f9eba08fc3de837822 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/ui/StubbedProvider.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/ui/StubbedProvider.java
@@ -199,118 +199,114 @@ public class StubbedProvider implements BackendProvider {
@Override
public void destroy() {}
- /** See {@link #createDownloadItem(int, String, boolean)}. */
+ /** See {@link #createDownloadItem(int, String, boolean, int, int)}. */
public static DownloadItem createDownloadItem(int which, String date) throws Exception {
- return createDownloadItem(which, date, false, DownloadState.COMPLETE);
+ return createDownloadItem(which, date, false, DownloadState.COMPLETE, 100);
}
/** Creates a new DownloadItem with pre-defined values. */
public static DownloadItem createDownloadItem(
- int which, String date, boolean isIncognito, int state) throws Exception {
- DownloadItem item = null;
+ int which, String date, boolean isIncognito, int state, int percent) throws Exception {
+ DownloadInfo.Builder builder = null;
if (which == 0) {
- item = new DownloadItem(false, new DownloadInfo.Builder()
+ builder = new DownloadInfo.Builder()
.setUrl("https://google.com")
.setContentLength(1)
.setFileName("first_file.jpg")
.setFilePath("/storage/fake_path/Downloads/first_file.jpg")
.setDownloadGuid("first_guid")
- .setMimeType("image/jpeg")
- .setState(state)
- .setIsOffTheRecord(isIncognito)
- .build());
+ .setMimeType("image/jpeg");
} else if (which == 1) {
- item = new DownloadItem(false, new DownloadInfo.Builder()
+ builder = new DownloadInfo.Builder()
.setUrl("https://one.com")
.setContentLength(10)
.setFileName("second_file.gif")
.setFilePath("/storage/fake_path/Downloads/second_file.gif")
.setDownloadGuid("second_guid")
- .setMimeType("image/gif")
- .setState(state)
- .setIsOffTheRecord(isIncognito)
- .build());
+ .setMimeType("image/gif");
} else if (which == 2) {
- item = new DownloadItem(false, new DownloadInfo.Builder()
+ builder = new DownloadInfo.Builder()
.setUrl("https://is.com")
.setContentLength(100)
.setFileName("third_file")
.setFilePath("/storage/fake_path/Downloads/third_file")
.setDownloadGuid("third_guid")
- .setMimeType("text/plain")
- .setState(state)
- .setIsOffTheRecord(isIncognito)
- .build());
+ .setMimeType("text/plain");
} else if (which == 3) {
- item = new DownloadItem(false, new DownloadInfo.Builder()
+ builder = new DownloadInfo.Builder()
.setUrl("https://the.com")
.setContentLength(5)
.setFileName("four.webm")
.setFilePath("/storage/fake_path/Downloads/four.webm")
.setDownloadGuid("fourth_guid")
- .setMimeType("video/webm")
- .setState(state)
- .setIsOffTheRecord(isIncognito)
- .build());
+ .setMimeType("video/webm");
} else if (which == 4) {
- item = new DownloadItem(false, new DownloadInfo.Builder()
+ builder = new DownloadInfo.Builder()
.setUrl("https://loneliest.com")
.setContentLength(50)
.setFileName("five.mp3")
.setFilePath("/storage/fake_path/Downloads/five.mp3")
.setDownloadGuid("fifth_guid")
- .setMimeType("audio/mp3")
- .setState(state)
- .setIsOffTheRecord(isIncognito)
- .build());
+ .setMimeType("audio/mp3");
} else if (which == 5) {
- item = new DownloadItem(false, new DownloadInfo.Builder()
+ builder = new DownloadInfo.Builder()
.setUrl("https://number.com")
.setContentLength(500)
.setFileName("six.mp3")
.setFilePath("/storage/fake_path/Downloads/six.mp3")
.setDownloadGuid("sixth_guid")
- .setMimeType("audio/mp3")
- .setState(state)
- .setIsOffTheRecord(isIncognito)
- .build());
+ .setMimeType("audio/mp3");
} else if (which == 6) {
- item = new DownloadItem(false, new DownloadInfo.Builder()
+ builder = new DownloadInfo.Builder()
.setUrl("https://sigh.com")
.setContentLength(ONE_GIGABYTE)
.setFileName("huge_image.png")
.setFilePath("/storage/fake_path/Downloads/huge_image.png")
.setDownloadGuid("seventh_guid")
- .setMimeType("image/png")
- .setState(state)
- .build());
+ .setMimeType("image/png");
} else if (which == 7) {
- item = new DownloadItem(false, new DownloadInfo.Builder()
+ builder = new DownloadInfo.Builder()
.setUrl("https://sleepy.com")
.setContentLength(ONE_GIGABYTE / 2)
.setFileName("sleep.pdf")
.setFilePath("/storage/fake_path/Downloads/sleep.pdf")
.setDownloadGuid("eighth_guid")
- .setMimeType("application/pdf")
- .setState(state)
- .setIsOffTheRecord(isIncognito)
- .build());
+ .setMimeType("application/pdf");
} else if (which == 8) {
- // This is a duplicate of item 7 above.
- item = new DownloadItem(false, new DownloadInfo.Builder()
+ // This is a duplicate of item 7 above with a different GUID.
+ builder = new DownloadInfo.Builder()
.setUrl("https://sleepy.com")
.setContentLength(ONE_GIGABYTE / 2)
.setFileName("sleep.pdf")
.setFilePath("/storage/fake_path/Downloads/sleep.pdf")
.setDownloadGuid("ninth_guid")
- .setMimeType("application/pdf")
- .setState(state)
- .setIsOffTheRecord(isIncognito)
- .build());
+ .setMimeType("application/pdf");
+ } else if (which == 9) {
+ builder = new DownloadInfo.Builder()
+ .setUrl("https://totallynew.com")
+ .setContentLength(ONE_GIGABYTE / 10)
+ .setFileName("forserious.jpg")
+ .setFilePath(null)
+ .setDownloadGuid("tenth_guid")
+ .setMimeType("image/jpg");
+ } else if (which == 10) {
+ // Duplicate version of #9, but the file path has been set.
+ builder = new DownloadInfo.Builder()
+ .setUrl("https://totallynew.com")
+ .setContentLength(ONE_GIGABYTE / 10)
+ .setFileName("forserious.jpg")
+ .setFilePath("/storage/fake_path/Downloads/forserious.jpg")
+ .setDownloadGuid("tenth_guid")
+ .setMimeType("image/jpg");
} else {
return null;
}
+ builder.setIsOffTheRecord(isIncognito);
+ builder.setPercentCompleted(percent);
+ builder.setState(state);
+
+ DownloadItem item = new DownloadItem(false, builder.build());
item.setStartTime(dateToEpoch(date));
return item;
}
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/download/ui/DownloadHistoryAdapterTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698