Skip to content

Commit

Permalink
Remove withContext block over latch.await
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuki-YuXin committed May 3, 2024
1 parent 71be953 commit 3f8e788
Showing 1 changed file with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import java.util.concurrent.TimeoutException
@RunWith(ParameterizedRobolectricTestRunner::class)
@Config(shadows = [ShadowAndroidSdkStorageEncryptionManager::class])
class NativeAuthPublicClientApplicationKotlinTest(private val allowPII: Boolean) : PublicClientApplicationAbstractTest() {
private val DISCARDED_TIME_IN_MILLISECONDS = 10000L
private lateinit var context: Context
private lateinit var components: IPlatformComponents
private lateinit var activity: Activity
Expand Down Expand Up @@ -231,12 +232,9 @@ class NativeAuthPublicClientApplicationKotlinTest(private val allowPII: Boolean)
// check the safe logging
println(loggerCallback.count)

withContext(Dispatchers.IO) {
withTimeout(15000) {
latch.await()
}
}

val shouldLogBeDiscarded = false
val timedOut: Boolean = !latch.await(DISCARDED_TIME_IN_MILLISECONDS, TimeUnit.MILLISECONDS)
assertEquals(shouldLogBeDiscarded, timedOut)
assertFalse(loggerCallback.failCalled)
}

Expand Down Expand Up @@ -287,17 +285,6 @@ class NativeAuthPublicClientApplicationKotlinTest(private val allowPII: Boolean)
// 1a. Server returns invalid password error
assertTrue(codeRequiredResult is SignInError)
assertTrue((codeRequiredResult as SignInError).isInvalidCredentials())

// check the safe logging
println(loggerCallback.count)

withContext(Dispatchers.IO) {
withTimeout(15000) {
latch.await()
}
}

assertFalse(loggerCallback.failCalled)
}

/**
Expand Down

0 comments on commit 3f8e788

Please sign in to comment.