test(android): update RemotePlayerState threshold expectation to 30
android / Build + lint + test (push) Has been cancelled
android / Build + lint + test (push) Has been cancelled
This commit is contained in:
@@ -53,17 +53,23 @@ class RemotePlayerStateTest {
|
||||
@Test
|
||||
fun `recordPollFailure trips after threshold`() {
|
||||
val state = RemotePlayerState()
|
||||
assertFalse(state.recordPollFailure())
|
||||
assertFalse(state.recordPollFailure())
|
||||
// Threshold is 30 -- tolerate ~30s of screen-off WiFi sleep before
|
||||
// declaring the remote dropped. Pre-threshold calls all return false.
|
||||
repeat(DROP_THRESHOLD - 1) {
|
||||
assertFalse(state.recordPollFailure())
|
||||
}
|
||||
assertTrue(state.recordPollFailure())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `recordPollSuccess clears the failure counter`() {
|
||||
val state = RemotePlayerState()
|
||||
state.recordPollFailure()
|
||||
state.recordPollFailure()
|
||||
repeat(DROP_THRESHOLD - 1) { state.recordPollFailure() }
|
||||
state.recordPollSuccess()
|
||||
assertFalse(state.recordPollFailure())
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val DROP_THRESHOLD = 30
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user