1
0
Fork 0

For #514 & #5742: Updates "launch links in private tab" functionality (#5721)

* For #514 & #5742: Updates "launch links in private tab" functionality

* Fixes comments
master
Sawyer Blatz 2019-10-03 12:43:33 -07:00 committed by GitHub
parent 4a0917ba32
commit 371e2ac3d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 305 additions and 72 deletions

View File

@ -123,6 +123,55 @@
android:resource="@mipmap/ic_launcher" />
</activity>
<!-- Launch in private mode alias -->
<activity-alias
android:name="org.mozilla.fenix.alias.IntentReceiverActivity"
android:label="@string/app_name_private"
android:icon="@mipmap/ic_launcher_private"
android:roundIcon="@mipmap/ic_launcher_private_round"
android:targetActivity=".IntentReceiverActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:mimeType="text/html" />
<data android:mimeType="text/plain" />
<data android:mimeType="application/xhtml+xml" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.ASSIST" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="com.android.systemui.action_assist_icon"
android:resource="@mipmap/ic_launcher_private" />
<meta-data
android:name="org.mozilla.fenix.LAUNCH_PRIVATE_LINK"
android:value="true" />
</activity-alias>
<activity android:name=".widget.VoiceSearchActivity" />
<activity

View File

@ -29,6 +29,7 @@ import mozilla.components.service.fxa.sync.SyncReason
import mozilla.components.support.base.feature.BackHandler
import mozilla.components.support.ktx.kotlin.isUrl
import mozilla.components.support.ktx.kotlin.toNormalizedUrl
import mozilla.components.support.utils.Browsers
import mozilla.components.support.utils.SafeIntent
import mozilla.components.support.utils.toSafeIntent
import org.mozilla.fenix.browser.UriOpenedObserver
@ -57,6 +58,7 @@ import org.mozilla.fenix.settings.SettingsFragmentDirections
import org.mozilla.fenix.settings.TrackingProtectionFragmentDirections
import org.mozilla.fenix.theme.DefaultThemeManager
import org.mozilla.fenix.theme.ThemeManager
import java.lang.ref.WeakReference
@SuppressWarnings("TooManyFunctions", "LargeClass")
open class HomeActivity : AppCompatActivity() {
@ -107,6 +109,9 @@ open class HomeActivity : AppCompatActivity() {
@CallSuper
override fun onResume() {
super.onResume()
unsetOpenLinksInAPrivateTab()
lifecycleScope.launch {
with(components.backgroundServices) {
// Make sure accountManager is initialized.
@ -120,6 +125,21 @@ open class HomeActivity : AppCompatActivity() {
}
}
private fun unsetOpenLinksInAPrivateTab() {
// Toggle off the open_link_in_private_tab pref if we are no longer set as the default browser
// We do this on a separate thread to alleviate performance issues
val weakReferenceContext = WeakReference(this)
lifecycleScope.launch {
val context = weakReferenceContext.get() ?: return@launch
if (!Browsers.all(context).isDefaultBrowser) {
context.settings().preferences
.edit()
.putBoolean(context.getString(R.string.pref_key_open_links_in_a_private_tab), false)
.apply()
}
}
}
/**
* Handles intents received when the activity is open.
*/
@ -251,8 +271,8 @@ open class HomeActivity : AppCompatActivity() {
AboutFragmentDirections.actionAboutFragmentToBrowserFragment(customTabSessionId)
BrowserDirection.FromTrackingProtection ->
TrackingProtectionFragmentDirections.actionTrackingProtectionFragmentToBrowserFragment(
customTabSessionId
)
customTabSessionId
)
}
private fun load(

View File

@ -6,11 +6,13 @@ package org.mozilla.fenix
import android.app.Activity
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import androidx.annotation.VisibleForTesting
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import mozilla.components.feature.intent.processing.TabIntentProcessor
import mozilla.components.support.utils.Browsers
import org.mozilla.fenix.customtabs.AuthCustomTabActivity
import org.mozilla.fenix.customtabs.AuthCustomTabActivity.Companion.EXTRA_AUTH_CUSTOM_TAB
import org.mozilla.fenix.customtabs.ExternalAppBrowserActivity
@ -37,7 +39,22 @@ class IntentReceiverActivity : Activity() {
}
suspend fun processIntent(intent: Intent) {
val tabIntentProcessor = if (settings().launchLinksInPrivateTab) {
val didLaunchPrivateLink = packageManager
?.getActivityInfo(componentName, PackageManager.GET_META_DATA)
?.metaData
?.getBoolean(LAUNCH_PRIVATE_LINK) ?: false
/* If LAUNCH_PRIVATE_LINK is set AND we're the default browser they must have pressed "always."
This is because LAUNCH_PRIVATE_LINK is only accessible through the "launch browser intent" menu
Which only appears if the user doesn't have a default set. */
if (didLaunchPrivateLink && Browsers.all(this).isDefaultBrowser) {
this.settings().openLinksInAPrivateTab = true
} else if (!Browsers.all(this).isDefaultBrowser) {
/* If the user has unset us as the default browser, unset alwaysOpenInPrivateMode */
this.settings().openLinksInAPrivateTab = false
}
val tabIntentProcessor = if (settings().openLinksInAPrivateTab || didLaunchPrivateLink) {
components.intentProcessors.privateIntentProcessor
} else {
components.intentProcessors.intentProcessor
@ -105,6 +122,9 @@ class IntentReceiverActivity : Activity() {
}
companion object {
// This constant must match the metadata from the private activity-alias
const val LAUNCH_PRIVATE_LINK = "org.mozilla.fenix.LAUNCH_PRIVATE_LINK"
const val ACTION_OPEN_TAB = "org.mozilla.fenix.OPEN_TAB"
const val ACTION_OPEN_PRIVATE_TAB = "org.mozilla.fenix.OPEN_PRIVATE_TAB"
}

View File

@ -0,0 +1,105 @@
/* 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 android.content.Intent
import android.content.SharedPreferences
import android.os.Build
import android.os.Build.VERSION.SDK_INT
import android.os.Bundle
import android.provider.Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.preference.CheckBoxPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import mozilla.components.support.utils.Browsers
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getPreferenceKey
import org.mozilla.fenix.ext.settings
/**
* Lets the user control their default browser preferences
*/
class DefaultBrowserSettingsFragment : PreferenceFragmentCompat() {
private val preferenceChangeListener =
SharedPreferences.OnSharedPreferenceChangeListener { sharedPreferences, key ->
when (key) {
getPreferenceKey(R.string.pref_key_telemetry) -> {
if (sharedPreferences.getBoolean(key, requireContext().settings().isTelemetryEnabled)) {
context?.components?.analytics?.metrics?.start()
} else {
context?.components?.analytics?.metrics?.stop()
}
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
context?.let {
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(preferenceChangeListener)
}
val makeDefaultBrowserKey = getPreferenceKey(R.string.pref_key_make_default_browser)
val preferenceMakeDefaultBrowser = findPreference<Preference>(makeDefaultBrowserKey)
preferenceMakeDefaultBrowser?.onPreferenceClickListener =
getClickListenerForMakeDefaultBrowser()
}
override fun onResume() {
super.onResume()
(activity as AppCompatActivity).title = getString(R.string.preferences_set_as_default_browser)
(activity as AppCompatActivity).supportActionBar?.show()
updatePreferences()
}
override fun onDestroy() {
context?.let {
preferenceManager.sharedPreferences.unregisterOnSharedPreferenceChangeListener(preferenceChangeListener)
}
super.onDestroy()
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.default_browser_preferences, rootKey)
updatePreferences()
}
private fun updatePreferences() {
findPreference<DefaultBrowserPreference>(getPreferenceKey(R.string.pref_key_make_default_browser))
?.updateSwitch()
findPreference<CheckBoxPreference>(getPreferenceKey(R.string.pref_key_open_links_in_a_private_tab))?.apply {
isEnabled = Browsers.all(requireContext()).isDefaultBrowser
isChecked = context.settings().openLinksInAPrivateTab
onPreferenceChangeListener = SharedPreferenceUpdater()
}
}
private fun getClickListenerForMakeDefaultBrowser(): Preference.OnPreferenceClickListener {
return if (SDK_INT >= Build.VERSION_CODES.N) {
Preference.OnPreferenceClickListener {
val intent = Intent(
ACTION_MANAGE_DEFAULT_APPS_SETTINGS
)
startActivity(intent)
true
}
} else {
defaultClickListener
}
}
private val defaultClickListener =
Preference.OnPreferenceClickListener { preference ->
Toast.makeText(context, "${preference.title} Clicked", Toast.LENGTH_SHORT).show()
true
}
}

View File

@ -12,8 +12,6 @@ import android.net.Uri
import android.os.Build
import android.os.Build.VERSION.SDK_INT
import android.os.Bundle
import android.provider.Settings
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import androidx.navigation.Navigation
@ -22,7 +20,6 @@ import androidx.preference.Preference
import androidx.preference.Preference.OnPreferenceClickListener
import androidx.preference.PreferenceCategory
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import kotlinx.coroutines.launch
import mozilla.components.concept.sync.AccountObserver
import mozilla.components.concept.sync.AuthType
@ -44,7 +41,6 @@ import org.mozilla.fenix.R.string.pref_key_delete_browsing_data
import org.mozilla.fenix.R.string.pref_key_delete_browsing_data_on_quit_preference
import org.mozilla.fenix.R.string.pref_key_help
import org.mozilla.fenix.R.string.pref_key_language
import org.mozilla.fenix.R.string.pref_key_launch_links_in_private_tab
import org.mozilla.fenix.R.string.pref_key_leakcanary
import org.mozilla.fenix.R.string.pref_key_make_default_browser
import org.mozilla.fenix.R.string.pref_key_privacy_link
@ -100,7 +96,7 @@ class SettingsFragment : PreferenceFragmentCompat(), AccountObserver {
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(preferenceChangeListener)
if (SDK_INT <= Build.VERSION_CODES.M) {
findPreference<DefaultBrowserPreference>(getPreferenceKey(R.string.pref_key_make_default_browser))?.apply {
findPreference<DefaultBrowserPreference>(getPreferenceKey(pref_key_make_default_browser))?.apply {
isVisible = false
}
}
@ -115,9 +111,6 @@ class SettingsFragment : PreferenceFragmentCompat(), AccountObserver {
(activity as AppCompatActivity).title = getString(R.string.settings_title)
(activity as AppCompatActivity).supportActionBar?.show()
val defaultBrowserPreference =
findPreference<DefaultBrowserPreference>(getPreferenceKey(R.string.pref_key_make_default_browser))
defaultBrowserPreference?.updateSwitch()
val trackingProtectionPreference =
findPreference<Preference>(getPreferenceKey(R.string.pref_key_tracking_protection_settings))
@ -166,6 +159,9 @@ class SettingsFragment : PreferenceFragmentCompat(), AccountObserver {
// TODO #220
ItsNotBrokenSnack(context!!).showSnackbar(issueNumber = "220")
}
resources.getString(pref_key_make_default_browser) -> {
navigateToDefaultBrowserFragment()
}
resources.getString(pref_key_data_choices) -> {
navigateToDataChoices()
}
@ -239,25 +235,11 @@ class SettingsFragment : PreferenceFragmentCompat(), AccountObserver {
}
private fun setupPreferences() {
val makeDefaultBrowserKey = getPreferenceKey(pref_key_make_default_browser)
val leakKey = getPreferenceKey(pref_key_leakcanary)
val debuggingKey = getPreferenceKey(pref_key_remote_debugging)
val preferenceLaunchLinksPrivateTabKey = getPreferenceKey(
pref_key_launch_links_in_private_tab
)
val preferenceMakeDefaultBrowser = findPreference<Preference>(makeDefaultBrowserKey)
val preferenceLeakCanary = findPreference<Preference>(leakKey)
val preferenceRemoteDebugging = findPreference<Preference>(debuggingKey)
val preferenceLaunchLinksInPrivateTab = findPreference<SwitchPreference>(preferenceLaunchLinksPrivateTabKey)
preferenceLaunchLinksInPrivateTab?.setOnPreferenceClickListener {
requireContext().settings().launchLinksInPrivateTab = !requireContext().settings().launchLinksInPrivateTab
true
}
preferenceMakeDefaultBrowser?.onPreferenceClickListener =
getClickListenerForMakeDefaultBrowser()
if (!Config.channel.isReleased) {
preferenceLeakCanary?.setOnPreferenceChangeListener { _, newValue ->
@ -274,25 +256,6 @@ class SettingsFragment : PreferenceFragmentCompat(), AccountObserver {
}
}
private val defaultClickListener = OnPreferenceClickListener { preference ->
Toast.makeText(context, "${preference.title} Clicked", Toast.LENGTH_SHORT).show()
true
}
private fun getClickListenerForMakeDefaultBrowser(): OnPreferenceClickListener {
return if (SDK_INT >= Build.VERSION_CODES.N) {
OnPreferenceClickListener {
val intent = Intent(
Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS
)
startActivity(intent)
true
}
} else {
defaultClickListener
}
}
private fun navigateToSearchEngineSettings() {
val directions = SettingsFragmentDirections.actionSettingsFragmentToSearchEngineFragment()
Navigation.findNavController(view!!).navigate(directions)
@ -319,6 +282,11 @@ class SettingsFragment : PreferenceFragmentCompat(), AccountObserver {
Navigation.findNavController(view!!).navigate(directions)
}
private fun navigateToDefaultBrowserFragment() {
val directions = SettingsFragmentDirections.actionSettingsFragmentToDefaultBrowserFragment()
Navigation.findNavController(view!!).navigate(directions)
}
private fun navigateToDataChoices() {
val directions = SettingsFragmentDirections.actionSettingsFragmentToDataChoicesFragment()
Navigation.findNavController(view!!).navigate(directions)

View File

@ -95,8 +95,8 @@ class Settings private constructor(
default = false
)
var launchLinksInPrivateTab by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_launch_links_in_private_tab),
var openLinksInAPrivateTab by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_open_links_in_a_private_tab),
default = false
)

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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/. -->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
android:paddingStart="8dp"
android:paddingEnd="?android:attr/scrollbarSize">
<LinearLayout
android:id="@android:id/widget_frame"
android:layout_width="48dp"
android:layout_height="0dp"
android:gravity="center_vertical"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@android:id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/state_list_text_color"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@android:id/summary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@android:id/widget_frame"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Delete browsing data category" />
<TextView
android:id="@android:id/summary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/secondary_state_list_text_color"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@android:id/widget_frame"
app:layout_constraintTop_toBottomOf="@android:id/title"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Delete browsing data summary" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -12,7 +12,7 @@
android:focusable="true"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
android:paddingStart="64dp"
android:paddingStart="8dp"
android:paddingEnd="?android:attr/scrollbarSize">
<LinearLayout

View File

@ -26,20 +26,20 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<org.mozilla.fenix.settings.deletebrowsingdata.DeleteBrowsingDataItem
android:id="@+id/open_tabs_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<org.mozilla.fenix.settings.deletebrowsingdata.DeleteBrowsingDataItem
android:id="@+id/open_tabs_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
app:deleteBrowsingDataItemTitle="@string/preferences_delete_browsing_data_tabs_title"
app:deleteBrowsingDataItemSubtitle="@string/preferences_delete_browsing_data_tabs_subtitle" />
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
app:deleteBrowsingDataItemTitle="@string/preferences_delete_browsing_data_tabs_title"
app:deleteBrowsingDataItemSubtitle="@string/preferences_delete_browsing_data_tabs_subtitle" />
<org.mozilla.fenix.settings.deletebrowsingdata.DeleteBrowsingDataItem
android:id="@+id/browsing_data_item"
android:layout_width="match_parent"

View File

@ -361,6 +361,9 @@
<action
android:id="@+id/action_settingsFragment_to_deleteBrowsingDataOnQuitFragment"
app:destination="@id/deleteBrowsingDataOnQuitFragment" />
<action
android:id="@+id/action_settingsFragment_to_defaultBrowserFragment"
app:destination="@id/defaultBrowserFragment" />
</fragment>
<fragment
android:id="@+id/dataChoicesFragment"
@ -585,4 +588,8 @@
android:id="@+id/addNewDeviceFragment"
android:name="org.mozilla.fenix.share.AddNewDeviceFragment"
android:label="AddNewDeviceFragment" />
<fragment
android:id="@+id/defaultBrowserFragment"
android:name="org.mozilla.fenix.settings.DefaultBrowserSettingsFragment"
android:label="DefaultBrowserFragment" />
</navigation>

View File

@ -100,7 +100,7 @@
<string name="pref_key_tracking_protection_onboarding" translatable="false">pref_key_tracking_protection_onboarding</string>
<!-- Privacy Settings -->
<string name="pref_key_launch_links_in_private_tab" translatable="false">pref_key_launch_links_in_private_tab</string>
<string name="pref_key_open_links_in_a_private_tab" translatable="false">pref_key_open_links_in_a_private_tab</string>
<!-- Quick Action Sheet -->
<string name="pref_key_bounce_quick_action" translatable="false">pref_key_bounce_quick_action</string>

View File

@ -3,7 +3,7 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources>
<!-- App name for private browsing mode, only the "(Private)" portion should be localized. -->
<string name="app_name_private">Firefox Preview (Private)</string>
<string name="app_name_private">Private Firefox Preview</string>
<!-- Home Fragment -->
<!-- Content description (not visible, for screen readers etc.): "Three dot" menu button. -->

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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/. -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<org.mozilla.fenix.settings.DefaultBrowserPreference
android:key="@string/pref_key_make_default_browser"
android:title="@string/preferences_set_as_default_browser"
app:iconSpaceReserved="false" />
<CheckBoxPreference
android:layout="@layout/checkbox_left_preference"
android:key="@string/pref_key_open_links_in_a_private_tab"
android:title="@string/preferences_open_links_in_a_private_tab" />
</PreferenceScreen>

View File

@ -46,7 +46,8 @@
android:key="@string/pref_key_accessibility"
android:title="@string/preferences_accessibility" />
<org.mozilla.fenix.settings.DefaultBrowserPreference
<androidx.preference.Preference
android:icon="@drawable/ic_internet"
android:key="@string/pref_key_make_default_browser"
android:title="@string/preferences_set_as_default_browser" />
</androidx.preference.PreferenceCategory>
@ -58,10 +59,6 @@
android:icon="@drawable/ic_tracking_protection_enabled"
android:key="@string/pref_key_tracking_protection_settings"
android:title="@string/preference_enhanced_tracking_protection" />
<androidx.preference.SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_launch_links_in_private_tab"
android:title="@string/preferences_open_links_in_a_private_tab" />
<androidx.preference.Preference
android:icon="@drawable/ic_private_browsing"
android:key="@string/pref_key_add_private_browsing_shortcut"

View File

@ -29,7 +29,7 @@ class IntentReceiverActivityTest {
@Test
fun `process intent with launchLinksInPrivateTab set to true`() {
runBlockingTest {
testContext.settings().launchLinksInPrivateTab = true
testContext.settings().openLinksInAPrivateTab = true
val intent = Intent()
`when`(testContext.components.intentProcessors.privateIntentProcessor.process(intent)).thenReturn(true)
@ -46,7 +46,7 @@ class IntentReceiverActivityTest {
@Test
fun `process intent with launchLinksInPrivateTab set to false`() {
runBlockingTest {
testContext.settings().launchLinksInPrivateTab = false
testContext.settings().openLinksInAPrivateTab = false
val intent = Intent()
`when`(testContext.components.intentProcessors.intentProcessor.process(intent)).thenReturn(true)

View File

@ -58,16 +58,16 @@ class SettingsTest {
fun launchLinksInPrivateTab() {
// When just created
// Then
assertFalse(settings.launchLinksInPrivateTab)
assertFalse(settings.openLinksInAPrivateTab)
// When
settings.launchLinksInPrivateTab = true
settings.openLinksInAPrivateTab = true
// Then
assertTrue(settings.launchLinksInPrivateTab)
assertTrue(settings.openLinksInAPrivateTab)
// When
settings.launchLinksInPrivateTab = false
settings.openLinksInAPrivateTab = false
// Then
assertFalse(settings.usePrivateMode)