mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] No issue: Removes deprecated usage of InstrumentationRegistry
This commit is contained in:
parent
952926509c
commit
e4488b1909
@ -9,11 +9,12 @@ import java.io.IOException
|
||||
import android.net.Uri
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import okhttp3.mockwebserver.Dispatcher
|
||||
import okhttp3.mockwebserver.MockResponse
|
||||
import okhttp3.mockwebserver.MockWebServer
|
||||
import okhttp3.mockwebserver.RecordedRequest
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.helpers.ext.toUri
|
||||
|
||||
object MockWebServerHelper {
|
||||
@ -47,7 +48,7 @@ class AndroidAssetDispatcher : Dispatcher() {
|
||||
private val mainThreadHandler = Handler(Looper.getMainLooper())
|
||||
|
||||
override fun dispatch(request: RecordedRequest): MockResponse {
|
||||
val assetManager = InstrumentationRegistry.getInstrumentation().targetContext.assets
|
||||
val assetManager = ApplicationProvider.getApplicationContext<HomeActivity>().assets
|
||||
val assetContents = try {
|
||||
val pathNoLeadingSlash = request.path.drop(1)
|
||||
assetManager.open(pathNoLeadingSlash).use { inputStream ->
|
||||
|
Loading…
Reference in New Issue
Block a user