Skip to content

Commit 48c54ba

Browse files
authored
Sense of Protection Experiemnt: Add new experiment names (#6145)
Task/Issue URL: https://app.asana.com/1/137249556945/project/1207908166761516/task/1210385405168427 ### Description Updated the Sense of Protection experiment toggle names from `senseOfProtectionNewUserExperimentMay25` and `senseOfProtectionExistingUserExperimentMay25` to `senseOfProtectionNewUserExperiment27May25` and `senseOfProtectionExistingUserExperiment27May25` respectively. Also added these new toggle names to the list of visual design experiment toggles. ### Steps to test this PR _Sense of Protection Experiment_ - [ ] Verify that the experiment toggles work correctly for new users - [ ] Verify that the experiment toggles work correctly for existing users - [ ] Check that the experiment cohorts are properly assigned - [ ] Ensure that the tab manager pixel parameters are correctly populated ### UI changes N/A
1 parent efa77a7 commit 48c54ba

File tree

9 files changed

+88
-52
lines changed

9 files changed

+88
-52
lines changed

app/src/internal/java/experiments/trackersblocking/TrackersBlockingExperimentViewModel.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class TrackersBlockingExperimentViewModel @Inject constructor(
5858
viewModelScope.launch(dispatchers.io()) {
5959
val enrollmentDateET = ZonedDateTime.now(ZoneId.of("America/New_York")).toString()
6060
if (checked) {
61-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
61+
senseOfProtectionToggles.senseOfProtectionExistingUserExperiment27May25().setRawStoredState(
6262
State(
6363
remoteEnableState = true,
6464
enable = true,
@@ -71,7 +71,7 @@ class TrackersBlockingExperimentViewModel @Inject constructor(
7171
),
7272
)
7373
} else {
74-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
74+
senseOfProtectionToggles.senseOfProtectionExistingUserExperiment27May25().setRawStoredState(
7575
State(
7676
remoteEnableState = false,
7777
enable = false,
@@ -93,7 +93,7 @@ class TrackersBlockingExperimentViewModel @Inject constructor(
9393
viewModelScope.launch(dispatchers.io()) {
9494
val enrollmentDateET = ZonedDateTime.now(ZoneId.of("America/New_York")).toString()
9595
if (checked) {
96-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
96+
senseOfProtectionToggles.senseOfProtectionExistingUserExperiment27May25().setRawStoredState(
9797
State(
9898
remoteEnableState = true,
9999
enable = true,
@@ -106,7 +106,7 @@ class TrackersBlockingExperimentViewModel @Inject constructor(
106106
),
107107
)
108108
} else {
109-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
109+
senseOfProtectionToggles.senseOfProtectionExistingUserExperiment27May25().setRawStoredState(
110110
State(
111111
remoteEnableState = false,
112112
enable = false,
@@ -128,7 +128,7 @@ class TrackersBlockingExperimentViewModel @Inject constructor(
128128
viewModelScope.launch(dispatchers.io()) {
129129
val enrollmentDateET = ZonedDateTime.now(ZoneId.of("America/New_York")).toString()
130130
if (checked) {
131-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
131+
senseOfProtectionToggles.senseOfProtectionExistingUserExperiment27May25().setRawStoredState(
132132
State(
133133
remoteEnableState = true,
134134
enable = true,
@@ -141,7 +141,7 @@ class TrackersBlockingExperimentViewModel @Inject constructor(
141141
),
142142
)
143143
} else {
144-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
144+
senseOfProtectionToggles.senseOfProtectionExistingUserExperiment27May25().setRawStoredState(
145145
State(
146146
remoteEnableState = false,
147147
enable = false,

app/src/main/java/com/duckduckgo/app/browser/senseofprotection/SenseOfProtectionExperimentImpl.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ class SenseOfProtectionExperimentImpl @Inject constructor(
143143
}
144144

145145
private fun enrollInNewUserExperiment(cohortName: CohortName): Boolean {
146-
return senseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().isEnabled(cohortName)
146+
return senseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().isEnabled(cohortName)
147147
}
148148

149149
private fun enrollInExistingUserExperiment(cohortName: CohortName): Boolean {
150-
return senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().isEnabled(cohortName)
150+
return senseOfProtectionToggles.senseOfProtectionExistingUserExperiment27May25().isEnabled(cohortName)
151151
}
152152

153153
private fun isUserEnrolledInNewUserExperimentModifiedControlCohortAndExperimentEnabled(): Boolean =
@@ -183,22 +183,22 @@ class SenseOfProtectionExperimentImpl @Inject constructor(
183183
}
184184

185185
private fun isNewUserExperimentEnabled(cohortName: CohortName): Boolean =
186-
senseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().isEnrolledAndEnabled(cohortName)
186+
senseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().isEnrolledAndEnabled(cohortName)
187187

188188
private fun isExistingUserExperimentEnabled(cohortName: CohortName): Boolean =
189-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().isEnrolledAndEnabled(cohortName)
189+
senseOfProtectionToggles.senseOfProtectionExistingUserExperiment27May25().isEnrolledAndEnabled(cohortName)
190190

191191
private fun getNewUserExperimentCohortName(): String? =
192-
senseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().getCohort()?.name
192+
senseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().getCohort()?.name
193193

194194
private fun getNewUserExperimentName(): String =
195-
senseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().featureName().name
195+
senseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().featureName().name
196196

197197
private fun getExistingUserExperimentCohortName(): String? =
198-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().getCohort()?.name
198+
senseOfProtectionToggles.senseOfProtectionExistingUserExperiment27May25().getCohort()?.name
199199

200200
private fun getExistingUserExperimentName(): String =
201-
senseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().featureName().name
201+
senseOfProtectionToggles.senseOfProtectionExistingUserExperiment27May25().featureName().name
202202

203203
private fun MetricsPixel.fire() = getPixelDefinitions().forEach {
204204
pixel.fire(it.pixelName, it.params)

app/src/main/java/com/duckduckgo/app/browser/senseofprotection/SenseOfProtectionExperimentToggles.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ interface SenseOfProtectionToggles {
4040
fun self(): Toggle
4141

4242
@Toggle.DefaultValue(DefaultFeatureValue.FALSE)
43-
fun senseOfProtectionNewUserExperimentMay25(): Toggle
43+
fun senseOfProtectionNewUserExperiment27May25(): Toggle
4444

4545
@Toggle.DefaultValue(DefaultFeatureValue.FALSE)
46-
fun senseOfProtectionExistingUserExperimentMay25(): Toggle
46+
fun senseOfProtectionExistingUserExperiment27May25(): Toggle
4747

4848
enum class Cohorts(override val cohortName: String) : CohortName {
4949
MODIFIED_CONTROL("modifiedControl"), // without grey tracker logos from original animation

app/src/main/java/com/duckduckgo/app/survey/rmf/TemporaryDefaultSurveyParameters.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ class SenseOfProtectionCohortSurveyParameterPlugin @Inject constructor(
2929
) : SurveyParameterPlugin {
3030
override val surveyParamKey: String = "senseProtectionCohort"
3131

32-
override suspend fun evaluate(): String = senseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().getCohort()?.name.orEmpty()
32+
override suspend fun evaluate(): String = senseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().getCohort()?.name.orEmpty()
3333
}

app/src/test/java/com/duckduckgo/app/browser/senseofprotection/SenseOfProtectionExperimentImplTest.kt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class SenseOfProtectionExperimentImplTest {
8585
fun `when user is new and and visual design updates not enabled then user can be enrolled`() {
8686
whenever(mockExperimentDataStore.isExperimentEnabled).thenReturn(MutableStateFlow(false))
8787
fakeUserBrowserProperties.setDaysSinceInstalled(28)
88-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
88+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().setRawStoredState(
8989
State(
9090
remoteEnableState = true,
9191
enable = true,
@@ -103,7 +103,7 @@ class SenseOfProtectionExperimentImplTest {
103103
fun `when user is new and and visual design updates not enabled then user can't be enrolled`() {
104104
whenever(mockExperimentDataStore.isExperimentEnabled).thenReturn(MutableStateFlow(true))
105105
fakeUserBrowserProperties.setDaysSinceInstalled(28)
106-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
106+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().setRawStoredState(
107107
State(
108108
remoteEnableState = true,
109109
enable = true,
@@ -121,7 +121,7 @@ class SenseOfProtectionExperimentImplTest {
121121
fun `when user is new and experiment is enabled but for different cohort then isEnabled returns false`() {
122122
whenever(mockExperimentDataStore.isExperimentEnabled).thenReturn(MutableStateFlow(false))
123123
fakeUserBrowserProperties.setDaysSinceInstalled(20)
124-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
124+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().setRawStoredState(
125125
State(
126126
remoteEnableState = true,
127127
enable = true,
@@ -137,7 +137,7 @@ class SenseOfProtectionExperimentImplTest {
137137
fun `when user is new and experiment is disabled then isEnabled returns false`() {
138138
whenever(mockExperimentDataStore.isExperimentEnabled).thenReturn(MutableStateFlow(false))
139139
fakeUserBrowserProperties.setDaysSinceInstalled(10)
140-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
140+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().setRawStoredState(
141141
State(
142142
remoteEnableState = false,
143143
enable = false,
@@ -151,7 +151,7 @@ class SenseOfProtectionExperimentImplTest {
151151

152152
@Test
153153
fun `when user is enrolled in new user experiment then getTabManagerPixelParams returns new user experiment params`() {
154-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
154+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().setRawStoredState(
155155
State(
156156
remoteEnableState = true,
157157
enable = true,
@@ -163,12 +163,12 @@ class SenseOfProtectionExperimentImplTest {
163163
val params = testee.getTabManagerPixelParams()
164164

165165
assertEquals(VARIANT_1.cohortName, params["cohort"])
166-
assertEquals(fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().featureName().name, params["experiment"])
166+
assertEquals(fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().featureName().name, params["experiment"])
167167
}
168168

169169
@Test
170170
fun `when user is enrolled in new user experiment but experiment is disabled then getTabManagerPixelParams returns empty map`() {
171-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
171+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().setRawStoredState(
172172
State(
173173
remoteEnableState = false,
174174
enable = false,
@@ -184,7 +184,7 @@ class SenseOfProtectionExperimentImplTest {
184184

185185
@Test
186186
fun `when user is enrolled in existing user experiment then getTabManagerPixelParams returns existing user experiment params`() {
187-
fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
187+
fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperiment27May25().setRawStoredState(
188188
State(
189189
remoteEnableState = true,
190190
enable = true,
@@ -196,12 +196,12 @@ class SenseOfProtectionExperimentImplTest {
196196
val params = testee.getTabManagerPixelParams()
197197

198198
assertEquals(VARIANT_2.cohortName, params["cohort"])
199-
assertEquals(fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().featureName().name, params["experiment"])
199+
assertEquals(fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperiment27May25().featureName().name, params["experiment"])
200200
}
201201

202202
@Test
203203
fun `when user is enrolled in existing user experiment but experiment is disabled then getTabManagerPixelParams returns empty map`() {
204-
fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
204+
fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperiment27May25().setRawStoredState(
205205
State(
206206
remoteEnableState = false,
207207
enable = false,
@@ -218,15 +218,15 @@ class SenseOfProtectionExperimentImplTest {
218218
@Test
219219
fun `when user is not enrolled in any experiment then getTabManagerPixelParams returns empty map`() {
220220
fakeUserBrowserProperties.setDaysSinceInstalled(30)
221-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
221+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().setRawStoredState(
222222
State(
223223
remoteEnableState = false,
224224
enable = false,
225225
assignedCohort = null,
226226
cohorts = emptyList(),
227227
),
228228
)
229-
fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperimentMay25().setRawStoredState(
229+
fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperiment27May25().setRawStoredState(
230230
State(
231231
remoteEnableState = false,
232232
enable = false,
@@ -242,7 +242,7 @@ class SenseOfProtectionExperimentImplTest {
242242

243243
@Test
244244
fun `when user is enrolled in modified control variant then we can detect it`() {
245-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
245+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().setRawStoredState(
246246
State(
247247
remoteEnableState = true,
248248
enable = true,
@@ -260,7 +260,7 @@ class SenseOfProtectionExperimentImplTest {
260260

261261
@Test
262262
fun `when user is enrolled in variant 1 then other variants are not enabled`() {
263-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
263+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().setRawStoredState(
264264
State(
265265
remoteEnableState = true,
266266
enable = true,
@@ -278,7 +278,7 @@ class SenseOfProtectionExperimentImplTest {
278278

279279
@Test
280280
fun `when user is enrolled in variant 2 then other variants are not enabled`() {
281-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
281+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().setRawStoredState(
282282
State(
283283
remoteEnableState = true,
284284
enable = true,
@@ -297,7 +297,7 @@ class SenseOfProtectionExperimentImplTest {
297297
@Test
298298
fun `when user is enrolled in modified control then legacy privacy shield is shown`() {
299299
fakeUserBrowserProperties.setDaysSinceInstalled(20)
300-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
300+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().setRawStoredState(
301301
State(
302302
remoteEnableState = true,
303303
enable = true,
@@ -312,7 +312,7 @@ class SenseOfProtectionExperimentImplTest {
312312
@Test
313313
fun `when user is not enrolled in any variant`() {
314314
fakeUserBrowserProperties.setDaysSinceInstalled(20)
315-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
315+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().setRawStoredState(
316316
State(
317317
remoteEnableState = true,
318318
enable = true,
@@ -326,7 +326,7 @@ class SenseOfProtectionExperimentImplTest {
326326
@Test
327327
fun `when user is enrolled in variant 1 then new privacy shield is shown`() {
328328
fakeUserBrowserProperties.setDaysSinceInstalled(20)
329-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
329+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().setRawStoredState(
330330
State(
331331
remoteEnableState = true,
332332
enable = true,
@@ -341,7 +341,7 @@ class SenseOfProtectionExperimentImplTest {
341341
@Test
342342
fun `when user is enrolled in variant 2 then new privacy shield is shown`() {
343343
fakeUserBrowserProperties.setDaysSinceInstalled(20)
344-
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25().setRawStoredState(
344+
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25().setRawStoredState(
345345
State(
346346
remoteEnableState = true,
347347
enable = true,

app/src/test/java/com/duckduckgo/app/survey/rmf/TemporaryDefaultSurveyParametersPluginTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class TemporaryDefaultSurveyParametersPluginTest {
2222
on { it.isEnabled() } doReturn true
2323
on { it.getCohort() } doReturn modifiedControlCohort
2424
}
25-
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25()).thenReturn(mockToggle)
25+
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25()).thenReturn(mockToggle)
2626

2727
val plugin = SenseOfProtectionCohortSurveyParameterPlugin(mockSenseOfProtectionToggles)
2828

@@ -36,7 +36,7 @@ class TemporaryDefaultSurveyParametersPluginTest {
3636
on { it.isEnabled() } doReturn true
3737
on { it.getCohort() } doReturn modifiedControlCohort
3838
}
39-
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25()).thenReturn(mockToggle)
39+
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25()).thenReturn(mockToggle)
4040

4141
val plugin = SenseOfProtectionCohortSurveyParameterPlugin(mockSenseOfProtectionToggles)
4242

@@ -50,7 +50,7 @@ class TemporaryDefaultSurveyParametersPluginTest {
5050
on { it.isEnabled() } doReturn true
5151
on { it.getCohort() } doReturn modifiedControlCohort
5252
}
53-
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25()).thenReturn(mockToggle)
53+
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25()).thenReturn(mockToggle)
5454

5555
val plugin = SenseOfProtectionCohortSurveyParameterPlugin(mockSenseOfProtectionToggles)
5656

@@ -63,7 +63,7 @@ class TemporaryDefaultSurveyParametersPluginTest {
6363
on { it.isEnabled() } doReturn false
6464
on { it.getCohort() } doReturn null
6565
}
66-
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperimentMay25()).thenReturn(mockToggle)
66+
whenever(mockSenseOfProtectionToggles.senseOfProtectionNewUserExperiment27May25()).thenReturn(mockToggle)
6767

6868
val plugin = SenseOfProtectionCohortSurveyParameterPlugin(mockSenseOfProtectionToggles)
6969

0 commit comments

Comments
 (0)