1
0
Fork 0

No issue: Remove feature flag for tips (#12172)

master
Sawyer Blatz 2020-07-01 14:47:40 -07:00 committed by GitHub
parent f59c64b68e
commit 306505fee0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 56 deletions

View File

@ -10,11 +10,6 @@ object FeatureFlags {
*/
const val pullToRefreshEnabled = false
/**
* Enables tip feature
*/
val tips = Config.channel.isDebug
/**
* Allows edit of saved logins.
*/
@ -29,10 +24,4 @@ object FeatureFlags {
* Enables new tab tray pref
*/
val tabTray = Config.channel.isNightlyOrDebug
/**
* Allows search widget CFR to be displayed.
* This is a placeholder for the experimentation framework determining cohorts.
*/
val searchWidgetCFR = Config.channel.isDebug
}

View File

@ -4,8 +4,6 @@
package org.mozilla.fenix.components.tips
import org.mozilla.fenix.FeatureFlags
sealed class TipType {
data class Button(val text: String, val action: () -> Unit) : TipType()
}
@ -31,7 +29,6 @@ class FenixTipManager(
private val providers: List<TipProvider>
) : TipManager {
override fun getTip(): Tip? {
if (!FeatureFlags.tips) { return null }
return providers
.firstOrNull { it.shouldDisplay }
?.tip

View File

@ -4,54 +4,12 @@
package org.mozilla.fenix.components.tips
import io.mockk.every
import io.mockk.mockk
import io.mockk.mockkObject
import io.mockk.unmockkObject
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Before
import org.junit.Test
import org.mozilla.fenix.FeatureFlags
class TipManagerTest {
@Before
fun setup() {
mockkObject(FeatureFlags)
every { FeatureFlags.tips } returns true
}
@After
fun after() {
unmockkObject(FeatureFlags)
}
@Test
fun `test feature flag off`() {
every { FeatureFlags.tips } returns false
assertNull(FenixTipManager(emptyList()).getTip())
assertNull(FenixTipManager(listOf(
object : TipProvider {
override val tip = mockk<Tip>()
override val shouldDisplay = true
},
object : TipProvider {
override val tip = mockk<Tip>()
override val shouldDisplay = false
},
object : TipProvider {
override val tip: Tip? = null
override val shouldDisplay = true
},
object : TipProvider {
override val tip: Tip? = null
override val shouldDisplay = false
}
)).getTip())
}
@Test
fun `test first with shouldDisplay`() {
val shouldDisplayProvider = object : TipProvider {