Merge "Improve diagnostics when cannot install wellbeing test apk" into sc-dev

This commit is contained in:
Vadim Tryshev 2021-06-04 19:15:55 +00:00 committed by Android (Google) Code Review
commit 1ba5a68e31
1 changed files with 6 additions and 1 deletions

View File

@ -22,6 +22,8 @@ import android.content.res.Resources;
import androidx.test.uiautomator.UiDevice;
import org.junit.Assert;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@ -48,7 +50,10 @@ public class TestUtil {
in.close();
out.close();
UiDevice.getInstance(getInstrumentation()).executeShellCommand("pm install " + apkFilename);
final String result = UiDevice.getInstance(getInstrumentation())
.executeShellCommand("pm install " + apkFilename);
Assert.assertTrue("Failed to install wellbeing test apk; make sure the device is rooted",
"Success".equals(result.replaceAll("\\s+", "")));
}
public static void uninstallDummyApp() throws IOException {