Fix ui test compilation

This commit is contained in:
valere 2022-12-14 10:43:03 +01:00
parent 8b7238e051
commit 71d56108c2
3 changed files with 12 additions and 4 deletions

View File

@ -45,6 +45,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment
import im.vector.app.core.time.DefaultClock
import im.vector.app.espresso.tools.waitUntilViewVisible
import kotlinx.coroutines.runBlocking
import org.hamcrest.Matcher
import org.hamcrest.Matchers
import org.hamcrest.StringDescription
@ -229,7 +230,7 @@ fun allSecretsKnownIdling(session: Session): IdlingResource {
val res = object : IdlingResource, Observer<Optional<PrivateKeysInfo>> {
private var callback: IdlingResource.ResourceCallback? = null
var privateKeysInfo: PrivateKeysInfo? = session.cryptoService().crossSigningService().getCrossSigningPrivateKeys()
var privateKeysInfo: PrivateKeysInfo? = null
override fun getName() = "AllSecretsKnownIdling_${session.myUserId}"
override fun isIdleNow(): Boolean {
@ -251,6 +252,10 @@ fun allSecretsKnownIdling(session: Session): IdlingResource {
}
}
res.privateKeysInfo = runBlocking {
session.cryptoService().crossSigningService().getCrossSigningPrivateKeys()
}
runOnUiThread {
session.cryptoService().crossSigningService().getLiveCrossSigningPrivateKeys().observeForever(res)
}

View File

@ -164,7 +164,10 @@ class SecurityBootstrapTest : VerificationTestBase() {
onView(withText(R.string._continue)).perform(click())
// Assert that all is configured
assert(uiSession.cryptoService().crossSigningService().isCrossSigningInitialized())
val crossSigningInitialized = runBlockingTest {
uiSession.cryptoService().crossSigningService().isCrossSigningInitialized()
}
assert(crossSigningInitialized)
assert(uiSession.cryptoService().crossSigningService().canCrossSign())
assert(uiSession.cryptoService().crossSigningService().allPrivateKeysKnown())
assert(uiSession.cryptoService().keysBackupService().isEnabled())

View File

@ -74,7 +74,7 @@ class VerifySessionPassphraseTest : VerificationTestBase() {
val matrix = getMatrixInstance()
val userName = "foobar_${Random.nextLong()}"
existingSession = createAccountAndSync(matrix, userName, password, true)
doSync<Unit> {
runBlockingTest {
existingSession!!.cryptoService().crossSigningService()
.initializeCrossSigning(
object : UserInteractiveAuthInterceptor {
@ -87,7 +87,7 @@ class VerifySessionPassphraseTest : VerificationTestBase() {
)
)
}
}, it
}
)
}