For #11015 - Switch Default ETP Setting to Standard
parent
749c95e0f0
commit
20e358228e
|
@ -10,6 +10,7 @@ import org.junit.After
|
|||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.mozilla.fenix.ext.settings
|
||||
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
|
||||
import org.mozilla.fenix.helpers.HomeActivityTestRule
|
||||
import org.mozilla.fenix.helpers.TestAssetHelper
|
||||
|
@ -32,7 +33,7 @@ import org.mozilla.fenix.ui.robots.settingsSubMenuEnhancedTrackingProtection
|
|||
* - Verifying Enhanced Tracking Protection site exceptions
|
||||
*/
|
||||
|
||||
class EnhancedTrackingProtectionTest {
|
||||
class StrictEnhancedTrackingProtectionTest {
|
||||
private lateinit var mockWebServer: MockWebServer
|
||||
|
||||
@get:Rule
|
||||
|
@ -45,6 +46,8 @@ class EnhancedTrackingProtectionTest {
|
|||
start()
|
||||
}
|
||||
|
||||
InstrumentationRegistry.getInstrumentation().context.settings().setStrictETP()
|
||||
|
||||
// Reset on-boarding notification for each test
|
||||
TestHelper.setPreference(
|
||||
InstrumentationRegistry.getInstrumentation().context,
|
|
@ -124,7 +124,7 @@ private fun assertEnhancedTrackingProtectionOptions() {
|
|||
onView(withText(stdText))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
onView(withText("Strict (Default)"))
|
||||
onView(withText("Strict"))
|
||||
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
||||
|
||||
val strictText =
|
||||
|
@ -152,13 +152,13 @@ private fun assertEnhancedTrackingProtectionDefaults() {
|
|||
}
|
||||
|
||||
private fun assertRadioButtonDefaults() {
|
||||
onView(withText("Standard")
|
||||
onView(withText("Strict")
|
||||
).assertIsChecked(false)
|
||||
|
||||
onView(
|
||||
allOf(
|
||||
withId(org.mozilla.fenix.R.id.radio_button),
|
||||
hasSibling(withText("Strict (Default)"))
|
||||
hasSibling(withText("Standard"))
|
||||
)
|
||||
).assertIsChecked(true)
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.mozilla.fenix.FeatureFlags
|
|||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
||||
import org.mozilla.fenix.components.metrics.MozillaProductDetector
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.getPreferenceKey
|
||||
import org.mozilla.fenix.settings.PhoneFeature
|
||||
import org.mozilla.fenix.settings.deletebrowsingdata.DeleteBrowsingDataOnQuitType
|
||||
|
@ -332,7 +333,7 @@ class Settings private constructor(
|
|||
|
||||
val useStrictTrackingProtection by booleanPreference(
|
||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_strict_default),
|
||||
true
|
||||
false
|
||||
)
|
||||
|
||||
val useCustomTrackingProtection by booleanPreference(
|
||||
|
@ -340,6 +341,24 @@ class Settings private constructor(
|
|||
false
|
||||
)
|
||||
|
||||
@VisibleForTesting(otherwise = PRIVATE)
|
||||
fun setStrictETP() {
|
||||
preferences.edit().putBoolean(
|
||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_strict_default),
|
||||
true
|
||||
).apply()
|
||||
preferences.edit().putBoolean(
|
||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_standard_option),
|
||||
false
|
||||
).apply()
|
||||
appContext?.components?.let {
|
||||
val policy = it.core.trackingProtectionPolicyFactory
|
||||
.createTrackingProtectionPolicy()
|
||||
it.useCases.settingsUseCases.updateTrackingProtection.invoke(policy)
|
||||
it.useCases.sessionUseCases.reload.invoke()
|
||||
}
|
||||
}
|
||||
|
||||
val blockCookiesInCustomTrackingProtection by booleanPreference(
|
||||
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_cookies),
|
||||
true
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
android:layout_marginBottom="16dp"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:checked="true"
|
||||
android:theme="@style/Checkable.Colored"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/description_text"
|
||||
|
@ -105,7 +106,7 @@
|
|||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:checked="true"
|
||||
android:checked="false"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:theme="@style/Checkable.Colored"
|
||||
|
@ -118,7 +119,7 @@
|
|||
android:id="@+id/protection_strict_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/onboarding_tracking_protection_strict_button"
|
||||
android:text="@string/onboarding_tracking_protection_strict_option"
|
||||
android:textColor="@color/primary_state_list_text_color"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toEndOf="@+id/tracking_protection_strict_default"
|
||||
|
|
|
@ -937,6 +937,8 @@
|
|||
<string name="onboarding_tracking_protection_standard_button_description">Blocks fewer trackers but allows pages to load normally</string>
|
||||
<!-- text for tracking protection radio button option for strict level of blocking -->
|
||||
<string name="onboarding_tracking_protection_strict_button">Strict (recommended)</string>
|
||||
<!-- text for tracking protection radio button option for strict level of blocking -->
|
||||
<string name="onboarding_tracking_protection_strict_option">Strict</string>
|
||||
<!-- text for strict blocking option button description -->
|
||||
<string name="onboarding_tracking_protection_strict_button_description">Blocks more trackers for better protection and performance, but may cause some sites to not work properly</string>
|
||||
<!-- text for the toolbar position card header
|
||||
|
|
|
@ -15,18 +15,17 @@
|
|||
android:key="@string/pref_key_tracking_protection"
|
||||
android:title="@string/preference_enhanced_tracking_protection" />
|
||||
<org.mozilla.fenix.settings.RadioButtonInfoPreference
|
||||
android:defaultValue="false"
|
||||
android:defaultValue="true"
|
||||
android:dependency="@string/pref_key_tracking_protection"
|
||||
android:key="@string/pref_key_tracking_protection_standard_option"
|
||||
android:summary="@string/preference_enhanced_tracking_protection_standard_description_2"
|
||||
android:title="@string/preference_enhanced_tracking_protection_standard_option" />
|
||||
<org.mozilla.fenix.settings.RadioButtonInfoPreference
|
||||
android:defaultValue="true"
|
||||
android:defaultValue="false"
|
||||
android:dependency="@string/pref_key_tracking_protection"
|
||||
android:key="@string/pref_key_tracking_protection_strict_default"
|
||||
android:summary="@string/preference_enhanced_tracking_protection_strict_default_description"
|
||||
android:title="@string/preference_enhanced_tracking_protection_strict_default" />
|
||||
|
||||
android:title="@string/preference_enhanced_tracking_protection_strict" />
|
||||
<org.mozilla.fenix.settings.RadioButtonInfoPreference
|
||||
android:defaultValue="false"
|
||||
android:dependency="@string/pref_key_tracking_protection"
|
||||
|
|
|
@ -334,7 +334,7 @@ class SettingsTest {
|
|||
fun shouldUseTrackingProtectionStrict() {
|
||||
// When
|
||||
// Then
|
||||
assertTrue(settings.useStrictTrackingProtection)
|
||||
assertFalse(settings.useStrictTrackingProtection)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue