From 40e36bb2281e888b707eeacbf757ad4c053f9a55 Mon Sep 17 00:00:00 2001 From: mcarare Date: Thu, 31 Mar 2022 13:04:35 +0300 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/24210: Remove wrapper from opened synced tab event. --- .../java/org/mozilla/fenix/components/metrics/Event.kt | 2 -- .../fenix/components/metrics/GleanMetricsService.kt | 4 ---- .../org/mozilla/fenix/tabstray/NavigationInteractor.kt | 3 +-- .../org/mozilla/fenix/tabstray/NavigationInteractorTest.kt | 7 +++---- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt index 3de24afbda..2a28def84e 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt @@ -126,8 +126,6 @@ sealed class Event { object TabSettingsOpened : Event() - object SyncedTabOpened : Event() - object HaveOpenTabs : Event() object HaveNoOpenTabs : Event() 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 af44ff5e6c..09624f661a 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 @@ -368,10 +368,6 @@ private val Event.wrapper: EventWrapper<*>? { ProgressiveWebApp.installTap.record(it) } ) - is Event.SyncedTabOpened -> EventWrapper( - { Events.syncedTabOpened.record(it) } - ) - is Event.TabSettingsOpened -> EventWrapper( { Tabs.settingOpened.record(it) } ) diff --git a/app/src/main/java/org/mozilla/fenix/tabstray/NavigationInteractor.kt b/app/src/main/java/org/mozilla/fenix/tabstray/NavigationInteractor.kt index e63e529947..85dde7d4df 100644 --- a/app/src/main/java/org/mozilla/fenix/tabstray/NavigationInteractor.kt +++ b/app/src/main/java/org/mozilla/fenix/tabstray/NavigationInteractor.kt @@ -25,7 +25,6 @@ import org.mozilla.fenix.collections.CollectionsDialog import org.mozilla.fenix.collections.show import org.mozilla.fenix.components.TabCollectionStorage import org.mozilla.fenix.components.bookmarks.BookmarksUseCase -import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.MetricController import org.mozilla.fenix.home.HomeFragment import org.mozilla.fenix.tabstray.ext.getTabSessionState @@ -250,7 +249,7 @@ class DefaultNavigationInteractor( } override fun onSyncedTabClicked(tab: SyncTab) { - metrics.track(Event.SyncedTabOpened) + Events.syncedTabOpened.record(NoExtras()) dismissTabTray() activity.openToBrowserAndLoad( diff --git a/app/src/test/java/org/mozilla/fenix/tabstray/NavigationInteractorTest.kt b/app/src/test/java/org/mozilla/fenix/tabstray/NavigationInteractorTest.kt index ceb8659c44..2fd17b1cfb 100644 --- a/app/src/test/java/org/mozilla/fenix/tabstray/NavigationInteractorTest.kt +++ b/app/src/test/java/org/mozilla/fenix/tabstray/NavigationInteractorTest.kt @@ -14,7 +14,6 @@ import io.mockk.mockkStatic import io.mockk.spyk import io.mockk.unmockkStatic import io.mockk.verify -import io.mockk.verifyOrder import kotlinx.coroutines.test.runBlockingTest import mozilla.components.browser.state.selector.findTab import mozilla.components.browser.state.selector.getNormalOrPrivateTabs @@ -43,7 +42,6 @@ import org.mozilla.fenix.collections.CollectionsDialog import org.mozilla.fenix.collections.show import org.mozilla.fenix.components.TabCollectionStorage import org.mozilla.fenix.components.bookmarks.BookmarksUseCase -import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.MetricController import org.mozilla.fenix.helpers.FenixRobolectricTestRunner import mozilla.components.browser.state.state.createTab as createStateTab @@ -228,6 +226,7 @@ class NavigationInteractorTest { fun `onSyncedTabsClicked sets metrics and opens browser`() { val tab = mockk() val entry = mockk() + assertFalse(Events.syncedTabOpened.testHasValue()) every { tab.active() }.answers { entry } every { entry.url }.answers { "https://mozilla.org" } @@ -240,9 +239,9 @@ class NavigationInteractorTest { ).onSyncedTabClicked(tab) assertTrue(dismissTabTrayInvoked) - verifyOrder { - metrics.track(Event.SyncedTabOpened) + assertTrue(Events.syncedTabOpened.testHasValue()) + verify { activity.openToBrowserAndLoad( searchTermOrURL = "https://mozilla.org", newTab = true,