am f72181c6: Fix hosttests to use the new ddmlib API.
Merge commit 'f72181c60943dcfb642aac1dc5fa5416c1bb566e' into gingerbread-plus-aosp * commit 'f72181c60943dcfb642aac1dc5fa5416c1bb566e': Fix hosttests to use the new ddmlib API.
This commit is contained in:
@@ -16,24 +16,24 @@
|
||||
|
||||
package android.content.pm;
|
||||
|
||||
import com.android.ddmlib.AdbCommandRejectedException;
|
||||
import com.android.ddmlib.AndroidDebugBridge;
|
||||
import com.android.ddmlib.IDevice;
|
||||
import com.android.ddmlib.IShellOutputReceiver;
|
||||
import com.android.ddmlib.InstallException;
|
||||
import com.android.ddmlib.Log;
|
||||
import com.android.ddmlib.MultiLineReceiver;
|
||||
import com.android.ddmlib.SyncService;
|
||||
import com.android.ddmlib.ShellCommandUnresponsiveException;
|
||||
import com.android.ddmlib.SyncException;
|
||||
import com.android.ddmlib.TimeoutException;
|
||||
import com.android.ddmlib.SyncService.ISyncProgressMonitor;
|
||||
import com.android.ddmlib.SyncService.SyncResult;
|
||||
import com.android.ddmlib.testrunner.ITestRunListener;
|
||||
import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
|
||||
import com.android.ddmlib.testrunner.TestIdentifier;
|
||||
import com.android.hosttest.DeviceTestCase;
|
||||
import com.android.hosttest.DeviceTestSuite;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.StringReader;
|
||||
import java.lang.Runtime;
|
||||
import java.lang.Process;
|
||||
@@ -42,7 +42,6 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import com.android.hosttest.DeviceTestCase;
|
||||
|
||||
/**
|
||||
* Set of tests that verify host side install cases
|
||||
@@ -120,8 +119,14 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
* Helper method to run tests and return the listener that collected the results.
|
||||
* @param pkgName Android application package for tests
|
||||
* @return the {@link CollectingTestRunListener}
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
private CollectingTestRunListener doRunTests(String pkgName) throws IOException {
|
||||
private CollectingTestRunListener doRunTests(String pkgName) throws IOException,
|
||||
TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
RemoteAndroidTestRunner testRunner = new RemoteAndroidTestRunner(
|
||||
pkgName, mDevice);
|
||||
CollectingTestRunListener listener = new CollectingTestRunListener();
|
||||
@@ -134,8 +139,14 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
*
|
||||
* @param pkgName Android application package for tests
|
||||
* @return true if every test passed, false otherwise.
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
public boolean runDeviceTestsDidAllTestsPass(String pkgName) throws IOException {
|
||||
public boolean runDeviceTestsDidAllTestsPass(String pkgName) throws IOException,
|
||||
TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
CollectingTestRunListener listener = doRunTests(pkgName);
|
||||
return listener.didAllTestsPass();
|
||||
}
|
||||
@@ -143,22 +154,26 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
/**
|
||||
* Helper method to push a file to device
|
||||
* @param apkAppPrivatePath
|
||||
* @throws IOException
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws SyncException if the sync failed for another reason.
|
||||
*/
|
||||
public void pushFile(final String localFilePath, final String destFilePath)
|
||||
throws IOException {
|
||||
SyncResult result = mDevice.getSyncService().pushFile(
|
||||
localFilePath, destFilePath, new NullSyncProgressMonitor());
|
||||
assertEquals(SyncService.RESULT_OK, result.getCode());
|
||||
throws IOException, SyncException, TimeoutException, AdbCommandRejectedException {
|
||||
mDevice.getSyncService().pushFile(localFilePath,
|
||||
destFilePath, new NullSyncProgressMonitor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to install a file
|
||||
* @param localFilePath the absolute file system path to file on local host to install
|
||||
* @param reinstall set to <code>true</code> if re-install of app should be performed
|
||||
* @throws IOException
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed
|
||||
*/
|
||||
public void installFile(final String localFilePath, final boolean replace) throws IOException {
|
||||
public void installFile(final String localFilePath, final boolean replace) throws IOException,
|
||||
InstallException {
|
||||
String result = mDevice.installPackage(localFilePath, replace);
|
||||
assertEquals(null, result);
|
||||
}
|
||||
@@ -168,10 +183,11 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
* @param localFilePath the absolute file system path to file on local host to install
|
||||
* @param reinstall set to <code>true</code> if re-install of app should be performed
|
||||
* @return the string output of the failed install attempt
|
||||
* @throws IOException
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed
|
||||
*/
|
||||
public String installFileFail(final String localFilePath, final boolean replace)
|
||||
throws IOException {
|
||||
throws IOException, InstallException {
|
||||
String result = mDevice.installPackage(localFilePath, replace);
|
||||
assertNotNull(result);
|
||||
return result;
|
||||
@@ -181,10 +197,17 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
* Helper method to install a file to device as forward locked
|
||||
* @param localFilePath the absolute file system path to file on local host to install
|
||||
* @param reinstall set to <code>true</code> if re-install of app should be performed
|
||||
* @throws IOException
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws SyncException if the sync failed for another reason.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public String installFileForwardLocked(final String localFilePath, final boolean replace)
|
||||
throws IOException {
|
||||
throws IOException, SyncException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException, InstallException {
|
||||
String remoteFilePath = mDevice.syncPackageToDevice(localFilePath);
|
||||
InstallReceiver receiver = new InstallReceiver();
|
||||
String cmd = String.format(replace ? "pm install -r -l \"%1$s\"" :
|
||||
@@ -199,9 +222,14 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
*
|
||||
* @param destPath the absolute path of file on device to check
|
||||
* @return <code>true</code> if file exists, <code>false</code> otherwise.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
public boolean doesRemoteFileExist(String destPath) throws IOException {
|
||||
public boolean doesRemoteFileExist(String destPath) throws IOException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
String lsGrep = executeShellCommand(String.format("ls %s", destPath));
|
||||
return !lsGrep.contains("No such file or directory");
|
||||
}
|
||||
@@ -212,10 +240,15 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
* @param destPath the absolute path of the file
|
||||
* @return <code>true</code> if file exists containing given string,
|
||||
* <code>false</code> otherwise.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
public boolean doesRemoteFileExistContainingString(String destPath, String searchString)
|
||||
throws IOException {
|
||||
throws IOException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
String lsResult = executeShellCommand(String.format("ls %s", destPath));
|
||||
return lsResult.contains(searchString);
|
||||
}
|
||||
@@ -225,9 +258,14 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
*
|
||||
* @param packageName the Android manifest package to check.
|
||||
* @return <code>true</code> if package exists, <code>false</code> otherwise
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
public boolean doesPackageExist(String packageName) throws IOException {
|
||||
public boolean doesPackageExist(String packageName) throws IOException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
String pkgGrep = executeShellCommand(String.format("pm path %s", packageName));
|
||||
return pkgGrep.contains("package:");
|
||||
}
|
||||
@@ -237,9 +275,14 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
*
|
||||
* @param packageName package name to check for
|
||||
* @return <code>true</code> if file exists, <code>false</code> otherwise.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
public boolean doesAppExistOnDevice(String packageName) throws IOException {
|
||||
public boolean doesAppExistOnDevice(String packageName) throws IOException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
return doesRemoteFileExistContainingString(DEVICE_APP_PATH, packageName);
|
||||
}
|
||||
|
||||
@@ -248,9 +291,14 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
*
|
||||
* @param packageName package name to check for
|
||||
* @return <code>true</code> if file exists, <code>false</code> otherwise.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
public boolean doesAppExistOnSDCard(String packageName) throws IOException {
|
||||
public boolean doesAppExistOnSDCard(String packageName) throws IOException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
return doesRemoteFileExistContainingString(SDCARD_APP_PATH, packageName);
|
||||
}
|
||||
|
||||
@@ -259,9 +307,14 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
*
|
||||
* @param packageName package name to check for
|
||||
* @return <code>true</code> if file exists, <code>false</code> otherwise.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
public boolean doesAppExistAsForwardLocked(String packageName) throws IOException {
|
||||
public boolean doesAppExistAsForwardLocked(String packageName) throws IOException,
|
||||
TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
return doesRemoteFileExistContainingString(APP_PRIVATE_PATH, packageName);
|
||||
}
|
||||
|
||||
@@ -269,9 +322,14 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
* Waits for device's package manager to respond.
|
||||
*
|
||||
* @throws InterruptedException
|
||||
* @throws IOException
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
public void waitForPackageManager() throws InterruptedException, IOException {
|
||||
public void waitForPackageManager() throws InterruptedException, IOException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "waiting for device");
|
||||
int currentWaitTime = 0;
|
||||
// poll the package manager until it returns something for android
|
||||
@@ -337,9 +395,14 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
*
|
||||
* @param packageName The name of the package to wait to load
|
||||
* @throws InterruptedException
|
||||
* @throws IOException
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
public void waitForApp(String packageName) throws InterruptedException, IOException {
|
||||
public void waitForApp(String packageName) throws InterruptedException, IOException,
|
||||
TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "waiting for app to launch");
|
||||
int currentWaitTime = 0;
|
||||
// poll the package manager until it returns something for the package we're looking for
|
||||
@@ -356,9 +419,14 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
/**
|
||||
* Helper method which executes a adb shell command and returns output as a {@link String}
|
||||
* @return the output of the command
|
||||
* @throws IOException
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
public String executeShellCommand(String command) throws IOException {
|
||||
public String executeShellCommand(String command) throws IOException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, String.format("adb shell %s", command));
|
||||
CollectingOutputReceiver receiver = new CollectingOutputReceiver();
|
||||
mDevice.executeShellCommand(command, receiver);
|
||||
@@ -370,9 +438,14 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
/**
|
||||
* Helper method ensures we are in root mode on the host side. It returns only after
|
||||
* PackageManager is actually up and running.
|
||||
* @throws IOException
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
public void runAdbRoot() throws IOException, InterruptedException {
|
||||
public void runAdbRoot() throws IOException, InterruptedException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "adb root");
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
Process process = runtime.exec("adb root"); // adb should be in the path
|
||||
@@ -390,10 +463,15 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
/**
|
||||
* Helper method which reboots the device and returns once the device is online again
|
||||
* and package manager is up and running (note this function is synchronous to callers).
|
||||
* @throws IOException
|
||||
* @throws InterruptedException
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
public void rebootDevice() throws IOException, InterruptedException {
|
||||
public void rebootDevice() throws IOException, InterruptedException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
String command = "reboot"; // no need for -s since mDevice is already tied to a device
|
||||
Log.i(LOG_TAG, command);
|
||||
CollectingOutputReceiver receiver = new CollectingOutputReceiver();
|
||||
@@ -546,17 +624,23 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
/**
|
||||
* Helper method for installing an app to wherever is specified in its manifest, and
|
||||
* then verifying the app was installed onto SD Card.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
*
|
||||
* @param the path of the apk to install
|
||||
* @param the name of the package
|
||||
* @param <code>true</code> if the app should be overwritten, <code>false</code> otherwise
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void installAppAndVerifyExistsOnSDCard(String apkPath, String pkgName, boolean overwrite)
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, InstallException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
// Start with a clean slate if we're not overwriting
|
||||
if (!overwrite) {
|
||||
// cleanup test app just in case it already exists
|
||||
@@ -577,17 +661,23 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
/**
|
||||
* Helper method for installing an app to wherever is specified in its manifest, and
|
||||
* then verifying the app was installed onto device.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
*
|
||||
* @param the path of the apk to install
|
||||
* @param the name of the package
|
||||
* @param <code>true</code> if the app should be overwritten, <code>false</code> otherwise
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void installAppAndVerifyExistsOnDevice(String apkPath, String pkgName, boolean overwrite)
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, InstallException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
// Start with a clean slate if we're not overwriting
|
||||
if (!overwrite) {
|
||||
// cleanup test app just in case it already exists
|
||||
@@ -608,17 +698,24 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
/**
|
||||
* Helper method for installing an app as forward-locked, and
|
||||
* then verifying the app was installed in the proper forward-locked location.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
*
|
||||
* @param the path of the apk to install
|
||||
* @param the name of the package
|
||||
* @param <code>true</code> if the app should be overwritten, <code>false</code> otherwise
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
*/
|
||||
public void installFwdLockedAppAndVerifyExists(String apkPath,
|
||||
String pkgName, boolean overwrite) throws IOException, InterruptedException {
|
||||
String pkgName, boolean overwrite) throws IOException, InterruptedException,
|
||||
InstallException, SyncException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
// Start with a clean slate if we're not overwriting
|
||||
if (!overwrite) {
|
||||
// cleanup test app just in case it already exists
|
||||
@@ -639,14 +736,21 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
|
||||
/**
|
||||
* Helper method for uninstalling an app.
|
||||
*
|
||||
* @param pkgName package name to uninstall
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
*
|
||||
* @param pkgName package name to uninstall
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the uninstall failed.
|
||||
*/
|
||||
public void uninstallApp(String pkgName) throws IOException, InterruptedException {
|
||||
public void uninstallApp(String pkgName) throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
mDevice.uninstallPackage(pkgName);
|
||||
// make sure its not installed anymore
|
||||
assertFalse(doesPackageExist(pkgName));
|
||||
@@ -656,12 +760,18 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
* Helper method for clearing any installed non-system apps.
|
||||
* Useful ensuring no non-system apps are installed, and for cleaning up stale files that
|
||||
* may be lingering on the system for whatever reason.
|
||||
*
|
||||
* @throws IOException if adb shell command failed
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
*
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the uninstall failed.
|
||||
*/
|
||||
public void wipeNonSystemApps() throws IOException {
|
||||
public void wipeNonSystemApps() throws IOException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException, InstallException {
|
||||
String allInstalledPackages = executeShellCommand("pm list packages -f");
|
||||
BufferedReader outputReader = new BufferedReader(new StringReader(allInstalledPackages));
|
||||
|
||||
@@ -686,8 +796,14 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
*
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
public void setDevicePreferredInstallLocation(InstallLocPreference pref) throws IOException {
|
||||
public void setDevicePreferredInstallLocation(InstallLocPreference pref) throws IOException,
|
||||
TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
String command = "pm setInstallLocation %d";
|
||||
int locValue = 0;
|
||||
switch (pref) {
|
||||
@@ -709,8 +825,14 @@ public class PackageManagerHostTestUtils extends Assert {
|
||||
*
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
*/
|
||||
public InstallLocPreference getDevicePreferredInstallLocation() throws IOException {
|
||||
public InstallLocPreference getDevicePreferredInstallLocation() throws IOException,
|
||||
TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
String result = executeShellCommand("pm getInstallLocation");
|
||||
if (result.indexOf('0') != -1) {
|
||||
return InstallLocPreference.AUTO;
|
||||
|
||||
@@ -16,13 +16,12 @@
|
||||
|
||||
package android.content.pm;
|
||||
|
||||
import com.android.ddmlib.IDevice;
|
||||
import com.android.ddmlib.IShellOutputReceiver;
|
||||
import com.android.ddmlib.AdbCommandRejectedException;
|
||||
import com.android.ddmlib.InstallException;
|
||||
import com.android.ddmlib.Log;
|
||||
import com.android.ddmlib.MultiLineReceiver;
|
||||
import com.android.ddmlib.SyncService;
|
||||
import com.android.ddmlib.SyncService.ISyncProgressMonitor;
|
||||
import com.android.ddmlib.SyncService.SyncResult;
|
||||
import com.android.ddmlib.ShellCommandUnresponsiveException;
|
||||
import com.android.ddmlib.SyncException;
|
||||
import com.android.ddmlib.TimeoutException;
|
||||
import com.android.hosttest.DeviceTestCase;
|
||||
import com.android.hosttest.DeviceTestSuite;
|
||||
|
||||
@@ -156,10 +155,18 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* the app, and otherwise cause the system to blow up.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws SyncException if the sync failed for another reason.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testPushAppPrivate() throws IOException, InterruptedException {
|
||||
public void testPushAppPrivate() throws IOException, InterruptedException, InstallException,
|
||||
TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException,
|
||||
SyncException {
|
||||
Log.i(LOG_TAG, "testing pushing an apk to /data/app-private");
|
||||
final String apkAppPrivatePath = appPrivatePath + SIMPLE_APK;
|
||||
|
||||
@@ -187,12 +194,18 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* @param apkName the file name of the test app apk
|
||||
* @param pkgName the package name of the test app apk
|
||||
* @param expectedLocation the file name of the test app apk
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
private void doStandardInstall(String apkName, String pkgName,
|
||||
PackageManagerHostTestUtils.InstallLocation expectedLocation)
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, InstallException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
|
||||
if (expectedLocation == PackageManagerHostTestUtils.InstallLocation.DEVICE) {
|
||||
mPMHostUtils.installAppAndVerifyExistsOnDevice(
|
||||
@@ -211,12 +224,18 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @param preference the device's preferred location of where to install apps
|
||||
* @param expectedLocation the expected location of where the apk was installed
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void installAppAutoLoc(PackageManagerHostTestUtils.InstallLocPreference preference,
|
||||
PackageManagerHostTestUtils.InstallLocation expectedLocation)
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException, InstallException {
|
||||
|
||||
PackageManagerHostTestUtils.InstallLocPreference savedPref =
|
||||
PackageManagerHostTestUtils.InstallLocPreference.AUTO;
|
||||
@@ -239,10 +258,16 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* will install the app to the device when device's preference is auto.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAppAutoLocPrefIsAuto() throws IOException, InterruptedException {
|
||||
public void testInstallAppAutoLocPrefIsAuto() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test installLocation=auto, prefer=auto gets installed on device");
|
||||
installAppAutoLoc(PackageManagerHostTestUtils.InstallLocPreference.AUTO,
|
||||
PackageManagerHostTestUtils.InstallLocation.DEVICE);
|
||||
@@ -253,10 +278,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* will install the app to the device when device's preference is internal.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAppAutoLocPrefIsInternal() throws IOException, InterruptedException {
|
||||
public void testInstallAppAutoLocPrefIsInternal() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test installLocation=auto, prefer=internal gets installed on device");
|
||||
installAppAutoLoc(PackageManagerHostTestUtils.InstallLocPreference.INTERNAL,
|
||||
PackageManagerHostTestUtils.InstallLocation.DEVICE);
|
||||
@@ -267,10 +299,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* will install the app to the SD card when device's preference is external.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAppAutoLocPrefIsExternal() throws IOException, InterruptedException {
|
||||
public void testInstallAppAutoLocPrefIsExternal() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test installLocation=auto, prefer=external gets installed on device");
|
||||
installAppAutoLoc(PackageManagerHostTestUtils.InstallLocPreference.EXTERNAL,
|
||||
PackageManagerHostTestUtils.InstallLocation.DEVICE);
|
||||
@@ -283,12 +322,18 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @param preference the device's preferred location of where to install apps
|
||||
* @param expectedLocation the expected location of where the apk was installed
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the (un)install failed.
|
||||
*/
|
||||
public void installAppInternalLoc(PackageManagerHostTestUtils.InstallLocPreference preference,
|
||||
PackageManagerHostTestUtils.InstallLocation expectedLocation)
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException, InstallException {
|
||||
|
||||
PackageManagerHostTestUtils.InstallLocPreference savedPref =
|
||||
PackageManagerHostTestUtils.InstallLocPreference.AUTO;
|
||||
@@ -311,10 +356,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* will install the app to the device when device's preference is auto.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAppInternalLocPrefIsAuto() throws IOException, InterruptedException {
|
||||
public void testInstallAppInternalLocPrefIsAuto() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test installLocation=internal, prefer=auto gets installed on device");
|
||||
installAppInternalLoc(PackageManagerHostTestUtils.InstallLocPreference.AUTO,
|
||||
PackageManagerHostTestUtils.InstallLocation.DEVICE);
|
||||
@@ -325,10 +377,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* will install the app to the device when device's preference is internal.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAppInternalLocPrefIsInternal() throws IOException, InterruptedException {
|
||||
public void testInstallAppInternalLocPrefIsInternal() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test installLocation=internal, prefer=internal is installed on device");
|
||||
installAppInternalLoc(PackageManagerHostTestUtils.InstallLocPreference.INTERNAL,
|
||||
PackageManagerHostTestUtils.InstallLocation.DEVICE);
|
||||
@@ -339,10 +398,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* will install the app to the device when device's preference is external.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAppInternalLocPrefIsExternal() throws IOException, InterruptedException {
|
||||
public void testInstallAppInternalLocPrefIsExternal() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test installLocation=internal, prefer=external is installed on device");
|
||||
installAppInternalLoc(PackageManagerHostTestUtils.InstallLocPreference.EXTERNAL,
|
||||
PackageManagerHostTestUtils.InstallLocation.DEVICE);
|
||||
@@ -355,12 +421,18 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @param preference the device's preferred location of where to install apps
|
||||
* @param expectedLocation the expected location of where the apk was installed
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void installAppExternalLoc(PackageManagerHostTestUtils.InstallLocPreference preference,
|
||||
PackageManagerHostTestUtils.InstallLocation expectedLocation)
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException, InstallException {
|
||||
|
||||
PackageManagerHostTestUtils.InstallLocPreference savedPref =
|
||||
PackageManagerHostTestUtils.InstallLocPreference.AUTO;
|
||||
@@ -384,10 +456,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* will install the app to the device when device's preference is auto.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAppExternalLocPrefIsAuto() throws IOException, InterruptedException {
|
||||
public void testInstallAppExternalLocPrefIsAuto() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test installLocation=external, pref=auto gets installed on SD Card");
|
||||
installAppExternalLoc(PackageManagerHostTestUtils.InstallLocPreference.AUTO,
|
||||
PackageManagerHostTestUtils.InstallLocation.SDCARD);
|
||||
@@ -398,10 +477,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* will install the app to the device when device's preference is internal.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAppExternalLocPrefIsInternal() throws IOException, InterruptedException {
|
||||
public void testInstallAppExternalLocPrefIsInternal() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test installLocation=external, pref=internal gets installed on SD Card");
|
||||
installAppExternalLoc(PackageManagerHostTestUtils.InstallLocPreference.INTERNAL,
|
||||
PackageManagerHostTestUtils.InstallLocation.SDCARD);
|
||||
@@ -412,10 +498,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* will install the app to the device when device's preference is external.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAppExternalLocPrefIsExternal() throws IOException, InterruptedException {
|
||||
public void testInstallAppExternalLocPrefIsExternal() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test installLocation=external, pref=external gets installed on SD Card");
|
||||
installAppExternalLoc(PackageManagerHostTestUtils.InstallLocPreference.EXTERNAL,
|
||||
PackageManagerHostTestUtils.InstallLocation.SDCARD);
|
||||
@@ -427,10 +520,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* system decide.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAppNoLocPrefIsAuto() throws IOException, InterruptedException {
|
||||
public void testInstallAppNoLocPrefIsAuto() throws IOException, InterruptedException,
|
||||
TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException,
|
||||
InstallException {
|
||||
Log.i(LOG_TAG, "Test an app with no installLocation gets installed on device");
|
||||
|
||||
PackageManagerHostTestUtils.InstallLocPreference savedPref =
|
||||
@@ -456,10 +556,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* external.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAppNoLocPrefIsExternal() throws IOException, InterruptedException {
|
||||
public void testInstallAppNoLocPrefIsExternal() throws IOException, InterruptedException,
|
||||
TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException,
|
||||
InstallException {
|
||||
Log.i(LOG_TAG, "Test an app with no installLocation gets installed on SD card");
|
||||
|
||||
PackageManagerHostTestUtils.InstallLocPreference savedPref =
|
||||
@@ -485,10 +592,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* internal.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAppNoLocPrefIsInternal() throws IOException, InterruptedException {
|
||||
public void testInstallAppNoLocPrefIsInternal() throws IOException, InterruptedException,
|
||||
TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException,
|
||||
InstallException {
|
||||
Log.i(LOG_TAG, "Test an app with no installLocation gets installed on device");
|
||||
|
||||
PackageManagerHostTestUtils.InstallLocPreference savedPref =
|
||||
@@ -513,10 +627,18 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* forward-locked will get installed to the correct location.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws SyncException if the sync failed for another reason.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallFwdLockedAppInternal() throws IOException, InterruptedException {
|
||||
public void testInstallFwdLockedAppInternal() throws IOException, InterruptedException,
|
||||
InstallException, SyncException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test an app with installLoc set to Internal gets installed to app-private");
|
||||
|
||||
try {
|
||||
@@ -534,10 +656,18 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* forward-locked will get installed to the correct location.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws SyncException if the sync failed for another reason.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallFwdLockedAppExternal() throws IOException, InterruptedException {
|
||||
public void testInstallFwdLockedAppExternal() throws IOException, InterruptedException,
|
||||
InstallException, SyncException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test an app with installLoc set to Internal gets installed to app-private");
|
||||
|
||||
try {
|
||||
@@ -555,10 +685,18 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* forward-locked will get installed to the correct location.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws SyncException if the sync failed for another reason.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallFwdLockedAppAuto() throws IOException, InterruptedException {
|
||||
public void testInstallFwdLockedAppAuto() throws IOException, InterruptedException,
|
||||
InstallException, SyncException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test an app with installLoc set to Auto gets installed to app-private");
|
||||
|
||||
try {
|
||||
@@ -576,10 +714,18 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* forward-locked installed will get installed to the correct location.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws SyncException if the sync failed for another reason.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallFwdLockedAppNone() throws IOException, InterruptedException {
|
||||
public void testInstallFwdLockedAppNone() throws IOException, InterruptedException,
|
||||
InstallException, SyncException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test an app with no installLoc set gets installed to app-private");
|
||||
|
||||
try {
|
||||
@@ -597,14 +743,21 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* uninstall it, and reinstall it onto the SD card.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
// TODO: This currently relies on the app's manifest to switch from device to
|
||||
// SD card install locations. We might want to make Device's installPackage()
|
||||
// accept a installLocation flag so we can install a package to the
|
||||
// destination of our choosing.
|
||||
public void testReinstallInternalToExternal() throws IOException, InterruptedException {
|
||||
public void testReinstallInternalToExternal() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test installing an app first to the device, then to the SD Card");
|
||||
|
||||
try {
|
||||
@@ -625,14 +778,21 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* uninstall it, and reinstall it onto the device.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
// TODO: This currently relies on the app's manifest to switch from device to
|
||||
// SD card install locations. We might want to make Device's installPackage()
|
||||
// accept a installLocation flag so we can install a package to the
|
||||
// destination of our choosing.
|
||||
public void testReinstallExternalToInternal() throws IOException, InterruptedException {
|
||||
public void testReinstallExternalToInternal() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test installing an app first to the SD Care, then to the device");
|
||||
|
||||
try {
|
||||
@@ -655,10 +815,16 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* the update onto the SD card as well when location is set to external for both versions
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testUpdateBothExternal() throws IOException, InterruptedException {
|
||||
public void testUpdateBothExternal() throws IOException, InterruptedException, InstallException,
|
||||
TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test updating an app on the SD card stays on the SD card");
|
||||
|
||||
try {
|
||||
@@ -681,10 +847,16 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* updated apps' manifest file.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testUpdateToSDCard() throws IOException, InterruptedException {
|
||||
public void testUpdateToSDCard() throws IOException, InterruptedException, InstallException,
|
||||
TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test updating an app on the SD card stays on the SD card");
|
||||
|
||||
try {
|
||||
@@ -706,10 +878,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* the update onto the device if the manifest has changed to installLocation=internalOnly
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testUpdateSDCardToDevice() throws IOException, InterruptedException {
|
||||
public void testUpdateSDCardToDevice() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test updating an app on the SD card to the Device through manifest change");
|
||||
|
||||
try {
|
||||
@@ -731,11 +910,18 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* the update onto the device's forward-locked location
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws SyncException if the sync failed for another reason.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAndUpdateExternalLocForwardLockedApp()
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, InstallException, SyncException,
|
||||
TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test updating a forward-locked app marked preferExternal");
|
||||
|
||||
try {
|
||||
@@ -757,11 +943,18 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* the update onto the device's forward-locked location
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws SyncException if the sync failed for another reason.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAndUpdateNoLocForwardLockedApp()
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, InstallException, SyncException,
|
||||
TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test updating a forward-locked app with no installLocation pref set");
|
||||
|
||||
try {
|
||||
@@ -783,11 +976,18 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* and then launched without crashing.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws SyncException if the sync failed for another reason.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAndLaunchAllPermsAppOnSD()
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, InstallException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test launching an app with all perms set, installed on SD card");
|
||||
|
||||
try {
|
||||
@@ -808,11 +1008,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* run without permissions errors.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAndLaunchFLPermsAppOnSD()
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, InstallException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test launching an app with location perms set, installed on SD card");
|
||||
|
||||
try {
|
||||
@@ -833,11 +1039,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* run without permissions errors.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAndLaunchBTPermsAppOnSD()
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, InstallException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test launching an app with bluetooth perms set, installed on SD card");
|
||||
|
||||
try {
|
||||
@@ -858,11 +1070,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* SecurityException when launched if its other shared apps are not installed.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAndLaunchSharedPermsAppOnSD_NoPerms()
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, InstallException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test launching an app with no explicit perms set, installed on SD card");
|
||||
|
||||
try {
|
||||
@@ -888,11 +1106,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* shared apps are installed.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAndLaunchSharedPermsAppOnSD_GrantedPerms()
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, InstallException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test launching an app with no explicit perms set, installed on SD card");
|
||||
|
||||
try {
|
||||
@@ -921,11 +1145,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* run without permissions errors even after a reboot
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAndLaunchFLPermsAppOnSD_Reboot()
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, InstallException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test launching an app with location perms set, installed on SD card");
|
||||
|
||||
try {
|
||||
@@ -951,11 +1181,17 @@ public class PackageManagerHostTests extends DeviceTestCase {
|
||||
* shared apps are installed, even after a reboot.
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
* @throws IOException if adb shell command failed
|
||||
* @throws InterruptedException if the thread was interrupted
|
||||
* @throws TimeoutException in case of a timeout on the connection.
|
||||
* @throws AdbCommandRejectedException if adb rejects the command
|
||||
* @throws ShellCommandUnresponsiveException if the device did not output anything for
|
||||
* a period longer than the max time to output.
|
||||
* @throws IOException if connection to device was lost.
|
||||
* @throws InstallException if the install failed.
|
||||
*/
|
||||
public void testInstallAndLaunchSharedPermsAppOnSD_Reboot()
|
||||
throws IOException, InterruptedException {
|
||||
throws IOException, InterruptedException, InstallException, TimeoutException,
|
||||
AdbCommandRejectedException, ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test launching an app on SD, with no explicit perms set after reboot");
|
||||
|
||||
try {
|
||||
|
||||
@@ -16,8 +16,11 @@
|
||||
|
||||
package android.content.pm;
|
||||
|
||||
import com.android.ddmlib.IDevice;
|
||||
import com.android.ddmlib.AdbCommandRejectedException;
|
||||
import com.android.ddmlib.InstallException;
|
||||
import com.android.ddmlib.Log;
|
||||
import com.android.ddmlib.ShellCommandUnresponsiveException;
|
||||
import com.android.ddmlib.TimeoutException;
|
||||
import com.android.hosttest.DeviceTestCase;
|
||||
import com.android.hosttest.DeviceTestSuite;
|
||||
|
||||
@@ -138,7 +141,9 @@ public class PackageManagerStressHostTests extends DeviceTestCase {
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
*/
|
||||
public void testUpdateAppManyTimesOnSD() throws IOException, InterruptedException {
|
||||
public void testUpdateAppManyTimesOnSD() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test updating an app on SD numerous times");
|
||||
|
||||
// cleanup test app just in case it already exists
|
||||
@@ -173,7 +178,9 @@ public class PackageManagerStressHostTests extends DeviceTestCase {
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
*/
|
||||
public void testUninstallReinstallAppOnSDManyTimes() throws IOException, InterruptedException {
|
||||
public void testUninstallReinstallAppOnSDManyTimes() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test updating an app on the SD card stays on the SD card");
|
||||
|
||||
// cleanup test app just in case it was already exists
|
||||
@@ -207,7 +214,9 @@ public class PackageManagerStressHostTests extends DeviceTestCase {
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
*/
|
||||
public void testInstallManyLargeAppsOnSD() throws IOException, InterruptedException {
|
||||
public void testInstallManyLargeAppsOnSD() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test installing 20 large apps onto the sd card");
|
||||
|
||||
try {
|
||||
@@ -251,7 +260,9 @@ public class PackageManagerStressHostTests extends DeviceTestCase {
|
||||
* <p/>
|
||||
* Assumes adb is running as root in device under test.
|
||||
*/
|
||||
public void testInstallManyAppsOnSD() throws IOException, InterruptedException {
|
||||
public void testInstallManyAppsOnSD() throws IOException, InterruptedException,
|
||||
InstallException, TimeoutException, AdbCommandRejectedException,
|
||||
ShellCommandUnresponsiveException {
|
||||
Log.i(LOG_TAG, "Test installing 500 small apps onto SD");
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user