Loading tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,12 @@ public class StagedRollbackTest { */ @Test public void testNativeWatchdogTriggersRollback_Phase1() throws Exception { // When multiple staged sessions are installed on a device which doesn't support checkpoint, // only the 1st one will prevail. We have to check no other rollbacks available to ensure // TestApp.A is always the 1st and the only one to commit so rollback can work as intended. // If there are leftover rollbacks from previous tests, this assertion will fail. assertThat(RollbackUtils.getRollbackManager().getAvailableRollbacks()).isEmpty(); Uninstall.packages(TestApp.A); Install.single(TestApp.A1).commit(); assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1); Loading Loading @@ -373,6 +379,11 @@ public class StagedRollbackTest { assertThat(RollbackUtils.getAvailableRollback(getModuleMetadataPackageName())).isNotNull(); } @Test public void testRollbackWhitelistedApp_cleanUp() throws Exception { RollbackUtils.getRollbackManager().expireRollbackForPackage(getModuleMetadataPackageName()); } private static void runShellCommand(String cmd) { ParcelFileDescriptor pfd = InstrumentationRegistry.getInstrumentation().getUiAutomation() .executeShellCommand(cmd); Loading tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java +10 −3 Original line number Diff line number Diff line Loading @@ -180,9 +180,16 @@ public class StagedRollbackTest extends BaseHostJUnit4Test { */ @Test public void testRollbackWhitelistedApp() throws Exception { try { runPhase("testRollbackWhitelistedApp_Phase1"); getDevice().reboot(); runPhase("testRollbackWhitelistedApp_Phase2"); } finally { // testNativeWatchdogTriggersRollback will fail if multiple staged sessions are // committed on a device which doesn't support checkpoint. Let's clean up the rollback // so there is only one rollback to commit when testing native crashes. runPhase("testRollbackWhitelistedApp_cleanUp"); } } private void crashProcess(String processName, int numberOfCrashes) throws Exception { Loading Loading
tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,12 @@ public class StagedRollbackTest { */ @Test public void testNativeWatchdogTriggersRollback_Phase1() throws Exception { // When multiple staged sessions are installed on a device which doesn't support checkpoint, // only the 1st one will prevail. We have to check no other rollbacks available to ensure // TestApp.A is always the 1st and the only one to commit so rollback can work as intended. // If there are leftover rollbacks from previous tests, this assertion will fail. assertThat(RollbackUtils.getRollbackManager().getAvailableRollbacks()).isEmpty(); Uninstall.packages(TestApp.A); Install.single(TestApp.A1).commit(); assertThat(InstallUtils.getInstalledVersion(TestApp.A)).isEqualTo(1); Loading Loading @@ -373,6 +379,11 @@ public class StagedRollbackTest { assertThat(RollbackUtils.getAvailableRollback(getModuleMetadataPackageName())).isNotNull(); } @Test public void testRollbackWhitelistedApp_cleanUp() throws Exception { RollbackUtils.getRollbackManager().expireRollbackForPackage(getModuleMetadataPackageName()); } private static void runShellCommand(String cmd) { ParcelFileDescriptor pfd = InstrumentationRegistry.getInstrumentation().getUiAutomation() .executeShellCommand(cmd); Loading
tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java +10 −3 Original line number Diff line number Diff line Loading @@ -180,9 +180,16 @@ public class StagedRollbackTest extends BaseHostJUnit4Test { */ @Test public void testRollbackWhitelistedApp() throws Exception { try { runPhase("testRollbackWhitelistedApp_Phase1"); getDevice().reboot(); runPhase("testRollbackWhitelistedApp_Phase2"); } finally { // testNativeWatchdogTriggersRollback will fail if multiple staged sessions are // committed on a device which doesn't support checkpoint. Let's clean up the rollback // so there is only one rollback to commit when testing native crashes. runPhase("testRollbackWhitelistedApp_cleanUp"); } } private void crashProcess(String processName, int numberOfCrashes) throws Exception { Loading