mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-11-08 08:01:09 +00:00
Test live location permission preservation
Split the existing PR change into a smaller reviewable piece. Original change: fix: do not revoke live location when enabling it
This commit is contained in:
parent
40e741221a
commit
577f8f6260
@ -0,0 +1,32 @@
|
||||
package com.bitchat.android.geohash
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class LiveLocationPrivacyGateTest {
|
||||
@Test
|
||||
fun `enabling location does not fire revocation listeners`() {
|
||||
var revoked = 0
|
||||
val listener = { revoked += 1 }
|
||||
LiveLocationPrivacyGate.addRevocationListener(listener)
|
||||
try {
|
||||
LiveLocationPrivacyGate.update(false)
|
||||
val afterDisable = revoked
|
||||
assertTrue("disable should revoke", afterDisable >= 1)
|
||||
|
||||
LiveLocationPrivacyGate.update(true)
|
||||
assertEquals(
|
||||
"enable must not cancel in-flight location work",
|
||||
afterDisable,
|
||||
revoked
|
||||
)
|
||||
|
||||
LiveLocationPrivacyGate.update(false)
|
||||
assertTrue(revoked > afterDisable)
|
||||
} finally {
|
||||
LiveLocationPrivacyGate.removeRevocationListener(listener)
|
||||
LiveLocationPrivacyGate.update(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user