1
0
Fork 0

For #5599: Remove dependency on fetch_httpurlconnection (#5716)

* For #5599: Remove dependency on fetch_httpurlconnection

* For #5599: Switch Glean to GeckoViewFetchClient

* Use existing Gecko client for Glean
master
Colin Lee 2019-10-04 12:28:23 -05:00 committed by GitHub
parent 40e6284aef
commit b7647a454f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 13 deletions

View File

@ -422,8 +422,6 @@ dependencies {
debugImplementation Deps.leakcanary
releaseImplementation Deps.leakcanary_noop
implementation Deps.mozilla_lib_fetch_httpurlconnection
implementation Deps.androidx_legacy
implementation Deps.androidx_paging
implementation Deps.androidx_preference

View File

@ -12,6 +12,7 @@ import kotlinx.coroutines.runBlocking
import mozilla.components.service.glean.BuildConfig
import mozilla.components.service.glean.Glean
import mozilla.components.service.glean.config.Configuration
import mozilla.components.service.glean.net.ConceptFetchHttpUploader
import mozilla.components.service.glean.private.NoExtraKeys
import mozilla.components.support.utils.Browsers
import org.mozilla.fenix.GleanMetrics.BookmarksManagement
@ -431,7 +432,11 @@ class GleanMetricsService(private val context: Context) : MetricsService {
// can handle events being recorded before it's initialized.
starter = MainScope().launch {
Glean.registerPings(Pings)
Glean.initialize(context, Configuration(channel = BuildConfig.BUILD_TYPE))
Glean.initialize(context,
Configuration(channel = BuildConfig.BUILD_TYPE,
httpClient = ConceptFetchHttpUploader(
lazy(LazyThreadSafetyMode.NONE) { context.components.core.client }
)))
}
setStartupMetrics()

View File

@ -1,18 +1,18 @@
package org.mozilla.fenix.ext
import mozilla.components.support.test.robolectric.testContext
import android.widget.ImageView
import kotlinx.coroutines.ObsoleteCoroutinesApi
import io.mockk.verify
import io.mockk.spyk
import mozilla.components.browser.icons.IconRequest
import mozilla.components.lib.fetch.httpurlconnection.HttpURLConnectionClient
import org.junit.Test
import org.mozilla.fenix.TestApplication
import io.mockk.verify
import kotlinx.coroutines.ObsoleteCoroutinesApi
import mozilla.components.browser.engine.gecko.fetch.GeckoViewFetchClient
import mozilla.components.browser.icons.BrowserIcons
import mozilla.components.browser.icons.IconRequest
import mozilla.components.support.test.robolectric.testContext
import org.junit.Test
import org.junit.runner.RunWith
import org.mozilla.fenix.TestApplication
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
import org.junit.runner.RunWith
@ObsoleteCoroutinesApi
@RunWith(RobolectricTestRunner::class)
@ -22,7 +22,7 @@ class BrowserIconsTest {
@Test
fun loadIntoViewTest() {
val imageView = spyk(ImageView(testContext))
val icons = spyk(BrowserIcons(testContext, httpClient = HttpURLConnectionClient()))
val icons = spyk(BrowserIcons(testContext, httpClient = GeckoViewFetchClient(testContext)))
val myUrl = "https://mozilla.com"
val request = spyk(IconRequest(url = myUrl))
icons.loadIntoView(imageView, myUrl)

View File

@ -143,7 +143,6 @@ object Deps {
const val mozilla_ui_icons = "org.mozilla.components:ui-icons:${Versions.mozilla_android_components}"
const val mozilla_lib_crash = "org.mozilla.components:lib-crash:${Versions.mozilla_android_components}"
const val mozilla_lib_fetch_httpurlconnection = "org.mozilla.components:lib-fetch-httpurlconnection:${Versions.mozilla_android_components}"
const val mozilla_lib_push_firebase = "org.mozilla.components:lib-push-firebase:${Versions.mozilla_android_components}"
const val mozilla_ui_publicsuffixlist = "org.mozilla.components:lib-publicsuffixlist:${Versions.mozilla_android_components}"