mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
For #10467 - removed unused tests and resources related to blue dot notification
This commit is contained in:
parent
3c2c7f705c
commit
632b64971f
@ -224,11 +224,6 @@ class Settings private constructor(
|
|||||||
default = ""
|
default = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
var readerModeOpened by booleanPreference(
|
|
||||||
appContext.getPreferenceKey(R.string.pref_key_reader_mode_opened),
|
|
||||||
default = false
|
|
||||||
)
|
|
||||||
|
|
||||||
var openInAppOpened by booleanPreference(
|
var openInAppOpened by booleanPreference(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_open_in_app_opened),
|
appContext.getPreferenceKey(R.string.pref_key_open_in_app_opened),
|
||||||
default = false
|
default = false
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
<string name="pref_key_experimentation" translatable="false">pref_key_experimentation</string>
|
<string name="pref_key_experimentation" translatable="false">pref_key_experimentation</string>
|
||||||
<string name="pref_key_showed_private_mode_cfr" translatable="false">pref_key_showed_private_mode_cfr</string>
|
<string name="pref_key_showed_private_mode_cfr" translatable="false">pref_key_showed_private_mode_cfr</string>
|
||||||
<string name="pref_key_private_mode_opened" translatable="false">pref_key_private_mode_opened</string>
|
<string name="pref_key_private_mode_opened" translatable="false">pref_key_private_mode_opened</string>
|
||||||
<string name="pref_key_reader_mode_opened" translatable="false">pref_key_reader_mode_opened</string>
|
|
||||||
<string name="pref_key_open_in_app_opened" translatable="false">pref_key_open_in_app_opened</string>
|
<string name="pref_key_open_in_app_opened" translatable="false">pref_key_open_in_app_opened</string>
|
||||||
<string name="pref_key_install_pwa_opened" translatable="false">pref_key_install_pwa_opened</string>
|
<string name="pref_key_install_pwa_opened" translatable="false">pref_key_install_pwa_opened</string>
|
||||||
|
|
||||||
|
@ -62,13 +62,4 @@ class BrowserInteractorTest {
|
|||||||
|
|
||||||
verify { browserToolbarController.handleToolbarItemInteraction(item) }
|
verify { browserToolbarController.handleToolbarItemInteraction(item) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun onBrowserMenuDismissed() {
|
|
||||||
val itemList: List<ToolbarMenu.Item> = listOf()
|
|
||||||
|
|
||||||
interactor.onBrowserMenuDismissed(itemList)
|
|
||||||
|
|
||||||
verify { browserToolbarController.handleBrowserMenuDismissed(itemList) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,6 @@ import org.mozilla.fenix.components.metrics.Event
|
|||||||
import org.mozilla.fenix.components.metrics.MetricController
|
import org.mozilla.fenix.components.metrics.MetricController
|
||||||
import org.mozilla.fenix.ext.components
|
import org.mozilla.fenix.ext.components
|
||||||
import org.mozilla.fenix.ext.nav
|
import org.mozilla.fenix.ext.nav
|
||||||
import org.mozilla.fenix.ext.settings
|
|
||||||
import org.mozilla.fenix.ext.toTab
|
import org.mozilla.fenix.ext.toTab
|
||||||
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
||||||
import org.mozilla.fenix.home.Tab
|
import org.mozilla.fenix.home.Tab
|
||||||
@ -185,22 +184,6 @@ class DefaultBrowserToolbarControllerTest {
|
|||||||
verify { onTabCounterClicked() }
|
verify { onTabCounterClicked() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `handle BrowserMenu dismissed with all options available`() = runBlockingTest {
|
|
||||||
val itemList: List<ToolbarMenu.Item> = listOf(
|
|
||||||
ToolbarMenu.Item.AddToHomeScreen,
|
|
||||||
ToolbarMenu.Item.OpenInApp
|
|
||||||
)
|
|
||||||
|
|
||||||
val activity = HomeActivity()
|
|
||||||
|
|
||||||
val controller = createController(scope = this, activity = activity)
|
|
||||||
controller.handleBrowserMenuDismissed(itemList)
|
|
||||||
|
|
||||||
assertEquals(true, activity.settings().installPwaOpened)
|
|
||||||
assertEquals(true, activity.settings().openInAppOpened)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun handleToolbarClick() = runBlockingTest {
|
fun handleToolbarClick() = runBlockingTest {
|
||||||
every { currentSession.id } returns "1"
|
every { currentSession.id } returns "1"
|
||||||
|
@ -1,109 +0,0 @@
|
|||||||
package org.mozilla.fenix.components.toolbar
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.lifecycle.LifecycleOwner
|
|
||||||
import io.mockk.every
|
|
||||||
import io.mockk.mockk
|
|
||||||
import io.mockk.mockkStatic
|
|
||||||
import io.mockk.spyk
|
|
||||||
import mozilla.components.browser.session.SessionManager
|
|
||||||
import mozilla.components.browser.state.state.BrowserState
|
|
||||||
import mozilla.components.browser.state.state.ReaderState
|
|
||||||
import mozilla.components.browser.state.state.createTab
|
|
||||||
import mozilla.components.browser.state.store.BrowserStore
|
|
||||||
import mozilla.components.concept.storage.BookmarksStorage
|
|
||||||
import mozilla.components.feature.app.links.AppLinkRedirect
|
|
||||||
import mozilla.components.feature.app.links.AppLinksUseCases
|
|
||||||
import org.junit.Assert.assertEquals
|
|
||||||
import org.junit.Before
|
|
||||||
import org.junit.Test
|
|
||||||
import org.mozilla.fenix.ext.components
|
|
||||||
import org.mozilla.fenix.ext.settings
|
|
||||||
import org.mozilla.fenix.utils.Settings
|
|
||||||
|
|
||||||
class DefaultToolbarMenuTest {
|
|
||||||
|
|
||||||
private lateinit var defaultToolbarMenu: DefaultToolbarMenu
|
|
||||||
|
|
||||||
private val context: Context = mockk(relaxed = true)
|
|
||||||
private val sessionManager: SessionManager = mockk(relaxed = true)
|
|
||||||
private val onItemTapped: (ToolbarMenu.Item) -> Unit = {}
|
|
||||||
private val lifecycleOwner: LifecycleOwner = mockk(relaxed = true)
|
|
||||||
private val bookmarksStorage: BookmarksStorage = mockk(relaxed = true)
|
|
||||||
|
|
||||||
private val store: BrowserStore = BrowserStore(initialState = BrowserState(
|
|
||||||
listOf(
|
|
||||||
createTab("https://www.mozilla.org", id = "readerable-tab", readerState = ReaderState(readerable = true))
|
|
||||||
)
|
|
||||||
))
|
|
||||||
|
|
||||||
@Before
|
|
||||||
fun setUp() {
|
|
||||||
defaultToolbarMenu = spyk(
|
|
||||||
DefaultToolbarMenu(
|
|
||||||
context,
|
|
||||||
sessionManager,
|
|
||||||
store,
|
|
||||||
hasAccountProblem = false,
|
|
||||||
shouldReverseItems = false,
|
|
||||||
onItemTapped = onItemTapped,
|
|
||||||
lifecycleOwner = lifecycleOwner,
|
|
||||||
bookmarksStorage = bookmarksStorage
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
val settings = Settings.getInstance(context, true)
|
|
||||||
mockkStatic("org.mozilla.fenix.ext.ContextKt")
|
|
||||||
every { context.settings() } returns settings
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `get all low prio highlight items`() {
|
|
||||||
every { context.components.useCases.webAppUseCases.isPinningSupported() } returns true
|
|
||||||
every { context.components.useCases.webAppUseCases.isInstallable() } returns true
|
|
||||||
|
|
||||||
val getAppLinkRedirect: AppLinksUseCases.GetAppLinkRedirect = mockk(relaxed = true)
|
|
||||||
every { context.components.useCases.appLinksUseCases.appLinkRedirect } returns getAppLinkRedirect
|
|
||||||
val appLinkRedirect: AppLinkRedirect = mockk(relaxed = true)
|
|
||||||
every { appLinkRedirect.hasExternalApp() } returns true
|
|
||||||
every { getAppLinkRedirect(any()) } returns appLinkRedirect
|
|
||||||
|
|
||||||
val list = defaultToolbarMenu.getLowPrioHighlightItems()
|
|
||||||
|
|
||||||
assertEquals(ToolbarMenu.Item.InstallToHomeScreen, list[0])
|
|
||||||
assertEquals(ToolbarMenu.Item.OpenInApp, list[1])
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `get all low prio highlight items without AddToHomeScreen`() {
|
|
||||||
val settings = Settings.getInstance(context, true)
|
|
||||||
mockkStatic("org.mozilla.fenix.ext.ContextKt")
|
|
||||||
every { context.settings() } returns settings
|
|
||||||
|
|
||||||
every { context.components.useCases.webAppUseCases.isPinningSupported() } returns false
|
|
||||||
|
|
||||||
val getAppLinkRedirect: AppLinksUseCases.GetAppLinkRedirect = mockk(relaxed = true)
|
|
||||||
every { context.components.useCases.appLinksUseCases.appLinkRedirect } returns getAppLinkRedirect
|
|
||||||
val appLinkRedirect: AppLinkRedirect = mockk(relaxed = true)
|
|
||||||
every { appLinkRedirect.hasExternalApp() } returns true
|
|
||||||
every { getAppLinkRedirect(any()) } returns appLinkRedirect
|
|
||||||
|
|
||||||
val list = defaultToolbarMenu.getLowPrioHighlightItems()
|
|
||||||
|
|
||||||
assertEquals(ToolbarMenu.Item.OpenInApp, list[0])
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `get all low prio highlight items without OpenInApp`() {
|
|
||||||
every { context.components.useCases.webAppUseCases.isPinningSupported() } returns true
|
|
||||||
every { context.components.useCases.webAppUseCases.isInstallable() } returns true
|
|
||||||
|
|
||||||
val getAppLinkRedirect: AppLinksUseCases.GetAppLinkRedirect = mockk(relaxed = true)
|
|
||||||
every { context.components.useCases.appLinksUseCases.appLinkRedirect } returns getAppLinkRedirect
|
|
||||||
every { getAppLinkRedirect(any()).hasExternalApp() } returns false
|
|
||||||
|
|
||||||
val list = defaultToolbarMenu.getLowPrioHighlightItems()
|
|
||||||
|
|
||||||
assertEquals(ToolbarMenu.Item.InstallToHomeScreen, list[0])
|
|
||||||
}
|
|
||||||
}
|
|
@ -304,19 +304,6 @@ class SettingsTest {
|
|||||||
assertFalse(settings.shouldUseTrackingProtection)
|
assertFalse(settings.shouldUseTrackingProtection)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun shouldSetReaderModeOpened() {
|
|
||||||
// When
|
|
||||||
// Then
|
|
||||||
assertFalse(settings.readerModeOpened)
|
|
||||||
|
|
||||||
// When
|
|
||||||
settings.readerModeOpened = true
|
|
||||||
|
|
||||||
// Then
|
|
||||||
assertTrue(settings.readerModeOpened)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun shouldSetOpenInAppOpened() {
|
fun shouldSetOpenInAppOpened() {
|
||||||
// When
|
// When
|
||||||
|
Loading…
Reference in New Issue
Block a user