Close #27147: Add telemetry for bookmark search
This commit is contained in:
parent
e81da189cd
commit
3f7391a322
|
@ -2696,6 +2696,39 @@ bookmarks_management:
|
|||
metadata:
|
||||
tags:
|
||||
- Bookmarks
|
||||
search_icon_tapped:
|
||||
type: event
|
||||
description: |
|
||||
A user tapped on the search icon in bookmarks management.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/27147
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/27268
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
expires: 120
|
||||
metadata:
|
||||
tags:
|
||||
- Bookmarks
|
||||
search_result_tapped:
|
||||
type: event
|
||||
description: |
|
||||
A user tapped on the search result in bookmarks management.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/27147
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/27268
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
expires: 120
|
||||
metadata:
|
||||
tags:
|
||||
- Bookmarks
|
||||
|
||||
activation:
|
||||
identifier:
|
||||
type: string
|
||||
|
|
|
@ -41,6 +41,7 @@ class BookmarkFragmentInteractor(
|
|||
}
|
||||
|
||||
override fun onSearch() {
|
||||
BookmarksManagement.searchIconTapped.record(NoExtras())
|
||||
bookmarksController.handleSearch()
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
package org.mozilla.fenix.library.bookmarks
|
||||
|
||||
import mozilla.components.concept.engine.EngineSession.LoadUrlFlags
|
||||
import mozilla.components.service.glean.private.NoExtras
|
||||
import org.mozilla.fenix.BrowserDirection
|
||||
import org.mozilla.fenix.GleanMetrics.BookmarksManagement
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
|
||||
/**
|
||||
|
@ -32,6 +34,7 @@ class BookmarkSearchDialogController(
|
|||
}
|
||||
|
||||
override fun handleUrlTapped(url: String, flags: LoadUrlFlags) {
|
||||
BookmarksManagement.searchResultTapped.record(NoExtras())
|
||||
clearToolbarFocus()
|
||||
|
||||
activity.openToBrowserAndLoad(
|
||||
|
|
|
@ -222,10 +222,12 @@ class BookmarkFragmentInteractorTest {
|
|||
|
||||
@Test
|
||||
fun `WHEN onSearch is called THEN call controller handleSearch`() {
|
||||
assertNull(BookmarksManagement.searchIconTapped.testGetValue())
|
||||
interactor.onSearch()
|
||||
|
||||
verify {
|
||||
bookmarkController.handleSearch()
|
||||
}
|
||||
assertNotNull(BookmarksManagement.searchIconTapped.testGetValue())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,14 +9,26 @@ import io.mockk.impl.annotations.MockK
|
|||
import io.mockk.verify
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import mozilla.components.concept.engine.EngineSession
|
||||
import mozilla.components.service.glean.testing.GleanTestRule
|
||||
import mozilla.components.support.test.robolectric.testContext
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mozilla.fenix.BrowserDirection
|
||||
import org.mozilla.fenix.GleanMetrics.BookmarksManagement
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
||||
|
||||
@RunWith(FenixRobolectricTestRunner::class)
|
||||
class BookmarkSearchControllerTest {
|
||||
|
||||
@get:Rule
|
||||
val gleanTestRule = GleanTestRule(testContext)
|
||||
|
||||
@MockK(relaxed = true)
|
||||
private lateinit var activity: HomeActivity
|
||||
|
||||
|
@ -63,6 +75,8 @@ class BookmarkSearchControllerTest {
|
|||
val url = "https://www.google.com/"
|
||||
val flags = EngineSession.LoadUrlFlags.none()
|
||||
|
||||
assertNull(BookmarksManagement.searchResultTapped.testGetValue())
|
||||
|
||||
createController().handleUrlTapped(url, flags)
|
||||
createController().handleUrlTapped(url)
|
||||
|
||||
|
@ -74,6 +88,8 @@ class BookmarkSearchControllerTest {
|
|||
flags = flags,
|
||||
)
|
||||
}
|
||||
|
||||
assertNotNull(BookmarksManagement.searchResultTapped.testGetValue())
|
||||
}
|
||||
|
||||
private fun createController(
|
||||
|
|
Loading…
Reference in New Issue