No issue: Fixes GleanMetricsService nits & broken UI test (#5539)
* No issue: Fixes GleanMetricsService nits * No issue: fixes broken UI testmaster
parent
b113c2ac24
commit
856399e9e2
|
@ -298,7 +298,7 @@ private fun assertPrivateSessionHeader() =
|
|||
const val PRIVATE_SESSION_MESSAGE = "Firefox Preview clears your search and browsing history " +
|
||||
"when you quit the app or close all private tabs. While this doesn’t make you anonymous to websites or " +
|
||||
"your internet service provider, it makes it easier to keep what you do online private from anyone else " +
|
||||
"who uses this device.\n\nCommon myths about private browsing"
|
||||
"who uses this device."
|
||||
|
||||
private fun assertPrivateSessionMessage(visible: Boolean) =
|
||||
onView(CoreMatchers.allOf(ViewMatchers.withText(PRIVATE_SESSION_MESSAGE)))
|
||||
|
|
|
@ -112,7 +112,7 @@ open class FenixApplication : Application() {
|
|||
|
||||
components.core.sessionManager.register(NotificationSessionObserver(this))
|
||||
|
||||
if ((System.currentTimeMillis() - this.settings.lastPlacesStorageMaintenance) > ONE_DAY_MILLIS) {
|
||||
if ((System.currentTimeMillis() - this.settings().lastPlacesStorageMaintenance) > ONE_DAY_MILLIS) {
|
||||
runStorageMaintenance()
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ open class FenixApplication : Application() {
|
|||
// run maintenance on one - arbitrarily using bookmarks.
|
||||
components.core.bookmarksStorage.runMaintenance()
|
||||
}
|
||||
this.settings.lastPlacesStorageMaintenance = System.currentTimeMillis()
|
||||
this.settings().lastPlacesStorageMaintenance = System.currentTimeMillis()
|
||||
}
|
||||
|
||||
private fun registerRxExceptionHandling() {
|
||||
|
|
|
@ -430,10 +430,6 @@ class GleanMetricsService(private val context: Context) : MetricsService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets some basic Glean metrics required by Fenix.
|
||||
* This is a separate function to simplify testing.
|
||||
*/
|
||||
internal fun setStartupMetrics() {
|
||||
Metrics.apply {
|
||||
defaultBrowser.set(Browsers.all(context).isDefaultBrowser)
|
||||
|
|
|
@ -10,6 +10,7 @@ import mozilla.components.support.test.robolectric.testContext
|
|||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -27,10 +28,15 @@ class GleanMetricsServiceTest {
|
|||
@get:Rule
|
||||
val gleanRule = GleanTestRule(testContext)
|
||||
|
||||
private lateinit var gleanService: GleanMetricsService
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
gleanService = GleanMetricsService(testContext)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `setStartupMetrics sets some base metrics`() {
|
||||
val gleanService = GleanMetricsService(testContext)
|
||||
|
||||
// Set the metrics.
|
||||
gleanService.setStartupMetrics()
|
||||
|
||||
|
@ -48,8 +54,6 @@ class GleanMetricsServiceTest {
|
|||
|
||||
@Test
|
||||
fun `the app_opened event is correctly recorded`() {
|
||||
val gleanService = GleanMetricsService(testContext)
|
||||
|
||||
// Build the event wrapper used by Fenix.
|
||||
val event = Event.OpenedApp(Event.OpenedApp.Source.APP_ICON)
|
||||
|
||||
|
|
Loading…
Reference in New Issue