Cleanup and fix test compilation

This commit is contained in:
Benoit Marty 2021-01-20 16:32:41 +01:00
parent 4709002429
commit c75eb050df
5 changed files with 6 additions and 7 deletions

View File

@ -378,7 +378,9 @@ class CommonTestHelper(context: Context) {
fun Iterable<Session>.signOutAndClose() = forEach { signOutAndClose(it) } fun Iterable<Session>.signOutAndClose() = forEach { signOutAndClose(it) }
fun signOutAndClose(session: Session) { fun signOutAndClose(session: Session) {
doSync<Unit>(60_000) { session.signOut(true, it) } runBlockingTest(timeout = 60_000) {
session.signOut(true)
}
// no need signout will close // no need signout will close
// session.close() // session.close()
} }

View File

@ -66,8 +66,8 @@ class TimelineForwardPaginationTest : InstrumentedTest {
numberOfMessagesToSend) numberOfMessagesToSend)
// Alice clear the cache // Alice clear the cache
commonTestHelper.doSync<Unit> { commonTestHelper.runBlockingTest {
aliceSession.clearCache(it) aliceSession.clearCache()
} }
// And restarts the sync // And restarts the sync

View File

@ -20,7 +20,6 @@ import androidx.annotation.MainThread
import dagger.Lazy import dagger.Lazy
import io.realm.RealmConfiguration import io.realm.RealmConfiguration
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import org.matrix.android.sdk.api.MatrixCallback
import org.matrix.android.sdk.api.auth.data.SessionParams import org.matrix.android.sdk.api.auth.data.SessionParams
import org.matrix.android.sdk.api.failure.GlobalError import org.matrix.android.sdk.api.failure.GlobalError
import org.matrix.android.sdk.api.pushrules.PushRuleService import org.matrix.android.sdk.api.pushrules.PushRuleService

View File

@ -175,12 +175,10 @@ class MainActivity : VectorBaseActivity<FragmentLoadingBinding>(), UnlockedActiv
emptyViewModel.viewModelScope.launch { emptyViewModel.viewModelScope.launch {
try { try {
session.clearCache() session.clearCache()
Timber.e("CACHE success")
doLocalCleanup(clearPreferences = false) doLocalCleanup(clearPreferences = false)
session.startSyncing(applicationContext) session.startSyncing(applicationContext)
startNextActivityAndFinish() startNextActivityAndFinish()
} catch (failure: Throwable) { } catch (failure: Throwable) {
Timber.e("CACHE failure")
displayError(failure) displayError(failure)
} }
} }

View File

@ -151,7 +151,7 @@ class LinkHandlerActivity : VectorBaseActivity<ActivityProgressBinding>() {
private fun safeSignout(uri: Uri) { private fun safeSignout(uri: Uri) {
val session = sessionHolder.getSafeActiveSession() val session = sessionHolder.getSafeActiveSession()
if(session == null) { if (session == null) {
// Should not happen // Should not happen
startLoginActivity(uri) startLoginActivity(uri)
} else { } else {