Skip to content

Commit

Permalink
Launch stopped apps before test to ensure they get backed up
Browse files Browse the repository at this point in the history
  • Loading branch information
grote committed Sep 25, 2024
1 parent 20069ca commit a5c3622
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

package com.stevesoltys.seedvault.e2e.impl

import android.content.Intent
import android.content.Intent.ACTION_MAIN
import androidx.test.filters.LargeTest
import com.stevesoltys.seedvault.MAGIC_PACKAGE_MANAGER
import com.stevesoltys.seedvault.e2e.SeedvaultLargeTest
Expand All @@ -17,6 +19,7 @@ internal class BackupRestoreTest : SeedvaultLargeTest() {

@Test
fun `backup and restore applications`() {
launchStoppedApps()
launchBackupActivity()

if (!keyManager.hasBackupKey()) {
Expand Down Expand Up @@ -58,6 +61,15 @@ internal class BackupRestoreTest : SeedvaultLargeTest() {
}
}

private fun launchStoppedApps() {
packageService.notBackedUpPackages.forEach { packageInfo ->
val i = Intent(ACTION_MAIN).apply {
`package` = packageInfo.packageName
}
targetContext.startActivity(i)
}
}

private fun assertValidResults(
backup: SeedvaultLargeTestResult,
restore: SeedvaultLargeTestResult,
Expand Down

0 comments on commit a5c3622

Please sign in to comment.