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