Commit 737cee07 authored by Kate Glazko's avatar Kate Glazko
Browse files

For #1159: Enable to download blob files in GeckoViewFetchClient

parent 4d71b7ab
......@@ -55,10 +55,7 @@ class FetchDownloadManager<T : AbstractFetchDownloadService>(
* @return the id reference of the scheduled download.
*/
override fun download(download: DownloadState, cookie: String): Long? {
if (!download.isScheme(listOf("http", "https", "data"))) {
// We are ignoring everything that is not http(s) or data. This is a limitation of
// GeckoView: https://bugzilla.mozilla.org/show_bug.cgi?id=1501735 and
// https://bugzilla.mozilla.org/show_bug.cgi?id=1432949
if (!download.isScheme(listOf("http", "https", "data", "blob"))) {
return null
}
......
......@@ -22,15 +22,16 @@ import mozilla.components.support.test.any
import mozilla.components.support.test.mock
import mozilla.components.support.test.robolectric.grantPermission
import mozilla.components.support.test.robolectric.testContext
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.verify
import mozilla.components.feature.downloads.AbstractFetchDownloadService.DownloadJobStatus
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Assert.assertNull
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertEquals
import org.mockito.Mockito.times
@RunWith(AndroidJUnit4::class)
......@@ -136,6 +137,15 @@ class FetchDownloadManagerTest {
assertNull(id)
}
@Test
fun `trying to download a file with a blob scheme should trigger a download`() {
val validBlobDownload = download.copy(url = "blob:https://ipv4.download.thinkbroadband.com/5MB.zip")
grantPermissions()
val id = downloadManager.download(validBlobDownload)!!
assertNotNull(id)
}
@Test
fun `sendBroadcast with valid downloadID must call onDownloadStopped after download`() {
var downloadCompleted = false
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment