2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-15 18:12:54 +00:00

Bug 1868172 - Add support for UnsupportedAddonType error code

This commit is contained in:
William Durand 2023-12-04 14:51:10 +01:00 committed by mergify[bot]
parent 83113424fe
commit a5f6d005f7
3 changed files with 22 additions and 5 deletions

View File

@ -161,7 +161,9 @@ class WebExtensionPromptFeature(
return
}
is WebExtensionInstallException.Unknown -> {
is WebExtensionInstallException.UnsupportedAddonType,
is WebExtensionInstallException.Unknown,
-> {
// Making sure we don't have a
// Title = Failed to install
// Message = Failed to install $addonName

View File

@ -109,10 +109,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
updateFxAAllowDomesticChinaServerMenu = ::updateFxAAllowDomesticChinaServerMenu,
)
addonFilePicker = AddonFilePicker(
requireContext(),
requireComponents.addonManager,
)
addonFilePicker = AddonFilePicker(requireContext(), requireComponents.addonManager)
addonFilePicker.registerForResults(this)
// It's important to update the account UI state in onCreate since that ensures we'll never

View File

@ -307,4 +307,22 @@ class WebExtensionPromptFeatureTest {
}
verify(exactly = 1) { onConfirm(true) }
}
@Test
fun `WHEN calling handleInstallationFailedRequest with UnsupportedAddonType error THEN showDialog with the correct message`() {
val expectedTitle = ""
val extensionName = "extensionName"
val exception = WebExtensionInstallException.UnsupportedAddonType(
extensionName = extensionName,
throwable = Exception(),
)
val expectedMessage =
testContext.getString(R.string.mozac_feature_addons_failed_to_install, extensionName)
webExtensionPromptFeature.handleInstallationFailedRequest(
exception = exception,
)
verify { webExtensionPromptFeature.showDialog(expectedTitle, expectedMessage) }
}
}