|
|
@ -6,14 +6,12 @@ package org.mozilla.fenix.components.metrics
|
|
|
|
|
|
|
|
|
|
|
|
import mozilla.components.service.glean.testing.GleanTestRule
|
|
|
|
import mozilla.components.service.glean.testing.GleanTestRule
|
|
|
|
import mozilla.components.support.test.robolectric.testContext
|
|
|
|
import mozilla.components.support.test.robolectric.testContext
|
|
|
|
import org.junit.Assert.assertEquals
|
|
|
|
|
|
|
|
import org.junit.Assert.assertFalse
|
|
|
|
import org.junit.Assert.assertFalse
|
|
|
|
import org.junit.Assert.assertTrue
|
|
|
|
import org.junit.Assert.assertTrue
|
|
|
|
import org.junit.Before
|
|
|
|
import org.junit.Before
|
|
|
|
import org.junit.Rule
|
|
|
|
import org.junit.Rule
|
|
|
|
import org.junit.Test
|
|
|
|
import org.junit.Test
|
|
|
|
import org.junit.runner.RunWith
|
|
|
|
import org.junit.runner.RunWith
|
|
|
|
import org.mozilla.fenix.GleanMetrics.Addons
|
|
|
|
|
|
|
|
import org.mozilla.fenix.GleanMetrics.Awesomebar
|
|
|
|
import org.mozilla.fenix.GleanMetrics.Awesomebar
|
|
|
|
import org.mozilla.fenix.GleanMetrics.CreditCards
|
|
|
|
import org.mozilla.fenix.GleanMetrics.CreditCards
|
|
|
|
import org.mozilla.fenix.GleanMetrics.RecentBookmarks
|
|
|
|
import org.mozilla.fenix.GleanMetrics.RecentBookmarks
|
|
|
@ -67,33 +65,6 @@ class GleanMetricsServiceTest {
|
|
|
|
assertTrue(Awesomebar.openedTabSuggestionClicked.testHasValue())
|
|
|
|
assertTrue(Awesomebar.openedTabSuggestionClicked.testHasValue())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
fun `Addon events are correctly recorded`() {
|
|
|
|
|
|
|
|
assertFalse(Addons.openAddonsInSettings.testHasValue())
|
|
|
|
|
|
|
|
gleanService.track(Event.AddonsOpenInSettings)
|
|
|
|
|
|
|
|
assertTrue(Addons.openAddonsInSettings.testHasValue())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertFalse(Addons.openAddonInToolbarMenu.testHasValue())
|
|
|
|
|
|
|
|
gleanService.track(Event.AddonsOpenInToolbarMenu("123"))
|
|
|
|
|
|
|
|
assertTrue(Addons.openAddonInToolbarMenu.testHasValue())
|
|
|
|
|
|
|
|
var events = Addons.openAddonInToolbarMenu.testGetValue()
|
|
|
|
|
|
|
|
assertEquals(1, events.size)
|
|
|
|
|
|
|
|
assertEquals("addons", events[0].category)
|
|
|
|
|
|
|
|
assertEquals("open_addon_in_toolbar_menu", events[0].name)
|
|
|
|
|
|
|
|
assertEquals(1, events[0].extra!!.size)
|
|
|
|
|
|
|
|
assertEquals("123", events[0].extra!!["addon_id"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertFalse(Addons.openAddonSetting.testHasValue())
|
|
|
|
|
|
|
|
gleanService.track(Event.AddonOpenSetting("123"))
|
|
|
|
|
|
|
|
assertTrue(Addons.openAddonSetting.testHasValue())
|
|
|
|
|
|
|
|
events = Addons.openAddonSetting.testGetValue()
|
|
|
|
|
|
|
|
assertEquals(1, events.size)
|
|
|
|
|
|
|
|
assertEquals("addons", events[0].category)
|
|
|
|
|
|
|
|
assertEquals("open_addon_setting", events[0].name)
|
|
|
|
|
|
|
|
assertEquals(1, events[0].extra!!.size)
|
|
|
|
|
|
|
|
assertEquals("123", events[0].extra!!["addon_id"])
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
fun `Home screen recent bookmarks events are correctly recorded`() {
|
|
|
|
fun `Home screen recent bookmarks events are correctly recorded`() {
|
|
|
|
assertFalse(RecentBookmarks.shown.testHasValue())
|
|
|
|
assertFalse(RecentBookmarks.shown.testHasValue())
|
|
|
|