Skip to content

Commit

Permalink
For mozilla-mobile#24210: Remove wrapper from opened synced tab event.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarare committed Apr 6, 2022
1 parent da1419f commit 49971d1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ sealed class Event {

object TabSettingsOpened : Event()

object SyncedTabOpened : Event()

object HaveOpenTabs : Event()
object HaveNoOpenTabs : Event()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,6 @@ private val Event.wrapper: EventWrapper<*>?
{ ProgressiveWebApp.installTap.record(it) }
)

is Event.SyncedTabOpened -> EventWrapper<NoExtraKeys>(
{ Events.syncedTabOpened.record(it) }
)

is Event.TabSettingsOpened -> EventWrapper<NoExtraKeys>(
{ Tabs.settingOpened.record(it) }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -250,7 +249,7 @@ class DefaultNavigationInteractor(
}

override fun onSyncedTabClicked(tab: SyncTab) {
metrics.track(Event.SyncedTabOpened)
Events.syncedTabOpened.record(NoExtras())

dismissTabTray()
activity.openToBrowserAndLoad(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -228,6 +226,7 @@ class NavigationInteractorTest {
fun `onSyncedTabsClicked sets metrics and opens browser`() {
val tab = mockk<SyncTab>()
val entry = mockk<TabEntry>()
assertFalse(Events.syncedTabOpened.testHasValue())

every { tab.active() }.answers { entry }
every { entry.url }.answers { "https://mozilla.org" }
Expand All @@ -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,
Expand Down

0 comments on commit 49971d1

Please sign in to comment.