diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt index 9e9bcc2ad..012ddec33 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt @@ -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))) diff --git a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt index 02728244e..321a62481 100644 --- a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt +++ b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt @@ -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() { diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt index c86978247..8b69e2ad4 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt @@ -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) diff --git a/app/src/test/java/org/mozilla/fenix/components/metrics/GleanMetricsServiceTest.kt b/app/src/test/java/org/mozilla/fenix/components/metrics/GleanMetricsServiceTest.kt index 646b85766..cda566684 100644 --- a/app/src/test/java/org/mozilla/fenix/components/metrics/GleanMetricsServiceTest.kt +++ b/app/src/test/java/org/mozilla/fenix/components/metrics/GleanMetricsServiceTest.kt @@ -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)