mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
For #21723 Align the default value of the custom cookie setting with the UI
This commit is contained in:
parent
30ce4ddd13
commit
846aefc0f4
@ -248,7 +248,7 @@ private fun assertCustomTrackingProtectionSettings() {
|
||||
|
||||
private fun cookiesCheckbox() = onView(withText("Cookies"))
|
||||
|
||||
private fun cookiesDropDownMenuDefault() = onView(withText("All cookies (will cause websites to break)"))
|
||||
private fun cookiesDropDownMenuDefault() = onView(withText("Cross-site and social media trackers"))
|
||||
|
||||
private fun trackingContentCheckbox() = onView(withText("Tracking content"))
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
package org.mozilla.fenix.settings
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.preference.CheckBoxPreference
|
||||
import androidx.preference.DropDownPreference
|
||||
@ -35,13 +36,20 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
|
||||
requireView().findNavController().navigate(directions)
|
||||
true
|
||||
}
|
||||
private lateinit var customCookies: CheckBoxPreference
|
||||
private lateinit var customCookiesSelect: DropDownPreference
|
||||
private lateinit var customTracking: CheckBoxPreference
|
||||
private lateinit var customTrackingSelect: DropDownPreference
|
||||
private lateinit var customCryptominers: CheckBoxPreference
|
||||
private lateinit var customFingerprinters: CheckBoxPreference
|
||||
private lateinit var customRedirectTrackers: CheckBoxPreference
|
||||
@VisibleForTesting
|
||||
internal lateinit var customCookies: CheckBoxPreference
|
||||
@VisibleForTesting
|
||||
internal lateinit var customCookiesSelect: DropDownPreference
|
||||
@VisibleForTesting
|
||||
internal lateinit var customTracking: CheckBoxPreference
|
||||
@VisibleForTesting
|
||||
internal lateinit var customTrackingSelect: DropDownPreference
|
||||
@VisibleForTesting
|
||||
internal lateinit var customCryptominers: CheckBoxPreference
|
||||
@VisibleForTesting
|
||||
internal lateinit var customFingerprinters: CheckBoxPreference
|
||||
@VisibleForTesting
|
||||
internal lateinit var customRedirectTrackers: CheckBoxPreference
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.tracking_protection_preferences, rootKey)
|
||||
|
@ -39,7 +39,7 @@
|
||||
android:layout="@layout/checkbox_left_preference_etp"
|
||||
android:title="@string/preference_enhanced_tracking_protection_custom_cookies" />
|
||||
<org.mozilla.fenix.settings.DropDownListPreference
|
||||
android:defaultValue="@string/all"
|
||||
android:defaultValue="@string/social"
|
||||
android:dependency="@string/pref_key_tracking_protection_custom_cookies"
|
||||
android:entries="@array/cookies_options_entries"
|
||||
android:entryValues="@array/cookies_options_entry_values"
|
||||
|
@ -0,0 +1,58 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.settings
|
||||
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import mozilla.components.support.test.robolectric.testContext
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
import org.robolectric.Robolectric
|
||||
|
||||
@RunWith(FenixRobolectricTestRunner::class)
|
||||
class TrackingProtectionFragmentTest {
|
||||
|
||||
@Test
|
||||
fun `UI component should match settings defaults`() {
|
||||
val settingsFragment = TrackingProtectionFragment()
|
||||
val activity = Robolectric.buildActivity(FragmentActivity::class.java).create().get()
|
||||
val settings = Settings(testContext)
|
||||
|
||||
activity.supportFragmentManager.beginTransaction()
|
||||
.add(settingsFragment, "settingsFragment")
|
||||
.commitNow()
|
||||
|
||||
val customCookiesCheckBox = settingsFragment.customCookies.isChecked
|
||||
val customCookiesCheckBoxSettings = settings.blockCookiesInCustomTrackingProtection
|
||||
|
||||
val customCookiesSelect = settingsFragment.customCookiesSelect.value
|
||||
val customCookiesSelectSettings = settings.blockCookiesSelectionInCustomTrackingProtection
|
||||
|
||||
val customTrackingContentCheckBox = settingsFragment.customTracking.isChecked
|
||||
val customTrackingContentCheckBoxSettings = settings.blockTrackingContentInCustomTrackingProtection
|
||||
|
||||
val customTrackingContentSelect = settingsFragment.customTrackingSelect.value
|
||||
val customTrackingContentSelectSettings = settings.blockTrackingContentSelectionInCustomTrackingProtection
|
||||
|
||||
val customCryptominersCheckBox = settingsFragment.customCryptominers.isChecked
|
||||
val customCryptominersCheckBoxSettings = settings.blockCryptominersInCustomTrackingProtection
|
||||
|
||||
val customFingerprintersCheckBox = settingsFragment.customFingerprinters.isChecked
|
||||
val customFingerprintersCheckBoxSettings = settings.blockFingerprintersInCustomTrackingProtection
|
||||
|
||||
val customRedirectTrackersCheckBox = settingsFragment.customRedirectTrackers.isChecked
|
||||
val customRedirectTrackersCheckBoxSettings = settings.blockRedirectTrackersInCustomTrackingProtection
|
||||
|
||||
assertEquals(customCookiesCheckBoxSettings, customCookiesCheckBox)
|
||||
assertEquals(customCookiesSelectSettings, customCookiesSelect)
|
||||
assertEquals(customTrackingContentCheckBoxSettings, customTrackingContentCheckBox)
|
||||
assertEquals(customTrackingContentSelect, customTrackingContentSelectSettings)
|
||||
assertEquals(customCryptominersCheckBoxSettings, customCryptominersCheckBox)
|
||||
assertEquals(customFingerprintersCheckBoxSettings, customFingerprintersCheckBox)
|
||||
assertEquals(customRedirectTrackersCheckBoxSettings, customRedirectTrackersCheckBox)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user