Verify repeated cleanup across incoming alert lifecycle failures
This commit is contained in:
1 parent
66e99066f9
commit
774284b699
2 files changed
+16
-6
No files matched your search
+1
-1
@@ -212,6 +212,6 @@ class IncomingCallCleanupTest {
|
||||
val attempts = notifications.cancellations.size
|
||||
IncomingCallManager.stopRinging()
|
||||
assertEquals(attempts, notifications.cancellations.size)
|
||||
assertTrue(notifications.active.isEmpty()); assertEquals(1, lock.releaseCalls - 1)
|
||||
assertTrue(notifications.active.isEmpty()); assertEquals(2, lock.releaseCalls)
|
||||
}
|
||||
}
|
||||
+15
-5
@@ -49,7 +49,8 @@ class IncomingCallLifecycleTest {
|
||||
@After fun release() {
|
||||
AppLanguage.failContext = false; AppLanguage.failText = false
|
||||
notifications.failures = emptySet(); NotificationCompat.failBuild = false
|
||||
PendingIntent.created.forEach { it.failCancel = false }
|
||||
power.failures = emptySet(); power.locks.forEach { it.failures = emptySet() }
|
||||
PendingIntent.created.forEach { it.failCancel = false; it.failCancelAfter = false }
|
||||
IncomingCallManager.stopRinging()
|
||||
Looper.getMainLooper().advanceBy(10_000)
|
||||
Build.VERSION.SDK_INT = 36
|
||||
@@ -437,20 +438,29 @@ class IncomingCallLifecycleTest {
|
||||
|
||||
@Test fun cleanupFailureMatrixDoesNotSkipOtherOwnedResources() {
|
||||
for (failure in listOf("query", "release")) {
|
||||
power.failures = setOf(failure)
|
||||
show(if (failure == "query") 11 else 22)
|
||||
val lock = power.locks.last().also { it.failures = setOf(failure) }
|
||||
val tokens = listOf(requireNotNull(current.contentIntent), decline())
|
||||
tokens.first().failCancel = true
|
||||
notifications.failures = setOf("cancel")
|
||||
val cancellations = notifications.cancellations.size
|
||||
repeat(3) { IncomingCallManager.stopRinging() }
|
||||
assertEquals(1, RingtoneManager.created.last().stopCalls)
|
||||
assertEquals(1, tokens.first().cancelCalls)
|
||||
assertTrue(tokens.drop(1).all { it.cancelled })
|
||||
assertEquals(3, tokens.first().cancelCalls)
|
||||
assertTrue(tokens.drop(1).all { it.cancelled && it.cancelCalls == 1 })
|
||||
assertTrue(lock.held)
|
||||
lock.failures = emptySet(); tokens.first().failCancel = false; notifications.failures = emptySet()
|
||||
repeat(3) { IncomingCallManager.stopRinging() }
|
||||
assertFalse(lock.held)
|
||||
assertTrue(tokens.all { it.cancelled })
|
||||
assertEquals(4, tokens.first().cancelCalls)
|
||||
assertEquals(cancellations + 4, notifications.cancellations.size)
|
||||
assertFalse(notifications.active.containsKey(IncomingCallManager.NOTIF_ID))
|
||||
}
|
||||
diagnostic("wake lock release failed")
|
||||
diagnostic("cancel action failed")
|
||||
diagnostic("cancel notification failed")
|
||||
assertEquals(2, notifications.cancellations.size)
|
||||
assertEquals(8, notifications.cancellations.size)
|
||||
}
|
||||
|
||||
@Test fun workerCallsAreRejectedBeforeChangingCurrentAlert() {
|
||||
|
||||
Reference in new issue
Block a user