Bug 1868172 - Add support for `UnsupportedAddonType` error code

fenix/122.0
William Durand 7 months ago committed by mergify[bot]
parent 83113424fe
commit a5f6d005f7

@ -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

@ -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

@ -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) }
}
}

Loading…
Cancel
Save