Skip to content

Instantly share code, notes, and snippets.

@motorro
Created August 10, 2019 18:44
Show Gist options
  • Save motorro/de91fe2e930d2678c7c7bca62b2beb58 to your computer and use it in GitHub Desktop.
Save motorro/de91fe2e930d2678c7c7bca62b2beb58 to your computer and use it in GitHub Desktop.
AppUpdateManager concurrent modification crash
@Test
@LooperMode(LooperMode.Mode.PAUSED)
fun crashesWhenUnsubscribing() {
updateManager.setUpdateAvailable(100500)
updateManager.withInfo {
startUpdateFlowForResult(it, AppUpdateType.FLEXIBLE, activity, 100)
assertTrue(isConfirmationDialogVisible)
userAcceptsUpdate()
downloadStarts()
(1..2).map {
registerListener(object: InstallStateUpdatedListener {
override fun onStateUpdate(p0: InstallState?) {
unregisterListener(this)
}
})
}
assertFailsWith<ConcurrentModificationException> {
downloadCompletes()
shadowOf(getMainLooper()).idle()
}
}
shadowOf(getMainLooper()).idle()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment