Uninstall testapps before running SecondaryUserRollbackTest

Add target_preparer for uninstalling TestApp.A and TestApp.B before
running SecondaryUserRollbackTest.
Also, fix the tearDown command after each case to uninstall the right
apps.

Test: atest SecondaryUserRollbackTest ; atest SecondaryUserRollbackTest
Bug: 136538996
Change-Id: I3d5decae03bf9d2f9d78a534399214da05a6d372
This commit is contained in:
shafik
2019-07-02 11:32:59 +01:00
parent 8e88028ab5
commit cfdc04be7b
2 changed files with 6 additions and 2 deletions

View File

@@ -19,6 +19,10 @@
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="RollbackTest.apk" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
<option name="run-command" value="pm uninstall com.android.cts.install.lib.testapp.A" />
<option name="run-command" value="pm uninstall com.android.cts.install.lib.testapp.B" />
</target_preparer>
<test class="com.android.tradefed.testtype.HostTest" >
<option name="class" value="com.android.tests.rollback.host.SecondaryUserRollbackTest" />
</test>

View File

@@ -43,8 +43,8 @@ public class SecondaryUserRollbackTest extends BaseHostJUnit4Test {
@After
public void tearDown() throws Exception {
getDevice().switchUser(mOriginalUser);
getDevice().executeShellCommand("pm uninstall com.android.tests.rollback.testapp.A");
getDevice().executeShellCommand("pm uninstall com.android.tests.rollback.testapp.B");
getDevice().executeShellCommand("pm uninstall com.android.cts.install.lib.testapp.A");
getDevice().executeShellCommand("pm uninstall com.android.cts.install.lib.testapp.B");
removeSecondaryUserIfNecessary();
}