summaryrefslogtreecommitdiffstats
path: root/tests/SmokeTest
diff options
context:
space:
mode:
authorBrett Chabot <brettchabot@google.com>2014-01-02 14:41:21 -0800
committerBrett Chabot <brettchabot@google.com>2014-01-02 14:41:21 -0800
commitc0104148fab184efce25c3bcb9aad596545256ea (patch)
treec31efca98724dbd81e3d23345df1e0fecf20f127 /tests/SmokeTest
parent23ab74de5eda745e2ef88bd156cde83fbcd4b5da (diff)
downloadframeworks_base-c0104148fab184efce25c3bcb9aad596545256ea.zip
frameworks_base-c0104148fab184efce25c3bcb9aad596545256ea.tar.gz
frameworks_base-c0104148fab184efce25c3bcb9aad596545256ea.tar.bz2
Don't attempt to launch disabled activities in smoke test.
Also remove the superfluous runner from manifest. Bug: 12245071 Change-Id: I724b87dd49b04eb3291be88f6d7ab035d67c3971
Diffstat (limited to 'tests/SmokeTest')
-rw-r--r--tests/SmokeTest/tests/AndroidManifest.xml9
-rw-r--r--tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java13
2 files changed, 12 insertions, 10 deletions
diff --git a/tests/SmokeTest/tests/AndroidManifest.xml b/tests/SmokeTest/tests/AndroidManifest.xml
index cad37c5..f1a0a4c 100644
--- a/tests/SmokeTest/tests/AndroidManifest.xml
+++ b/tests/SmokeTest/tests/AndroidManifest.xml
@@ -27,15 +27,6 @@
</application>
<!--
- This declares that this app uses the instrumentation test runner targeting the package of
- com.android.smoketest. To run the tests use the command:
- `adb shell am instrument -w com.android.smoketest.tests/android.test.InstrumentationTestRunner`
- -->
- <instrumentation android:name="android.test.InstrumentationTestRunner"
- android:targetPackage="com.android.smoketest"
- android:label="System Smoke Tests"/>
-
- <!--
This declares a method to run the instrumentation with a special runner, which will run each
app as a separate testcase. To do so, use the command:
`adb shell am instrument -w com.android.smoketest.tests/com.android.smoketest.SmokeTestRunner`
diff --git a/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java b/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java
index 03c2923..946299b 100644
--- a/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java
+++ b/tests/SmokeTest/tests/src/com/android/smoketest/ProcessErrorsTest.java
@@ -154,6 +154,11 @@ public class ProcessErrorsTest extends AndroidTestCase {
// launch app, and wait 7 seconds for it to start/settle
final Intent intent = intentForActivity(app);
+ if (intent == null) {
+ Log.i(TAG, String.format("Activity %s/%s is disabled, skipping",
+ app.activityInfo.packageName, app.activityInfo.name));
+ return Collections.EMPTY_LIST;
+ }
getContext().startActivity(intent);
try {
Thread.sleep(appLaunchWait);
@@ -238,10 +243,16 @@ public class ProcessErrorsTest extends AndroidTestCase {
/**
* A helper function to create an {@link Intent} to run, given a {@link ResolveInfo} specifying
* an activity to be launched.
+ *
+ * @return the {@link Intent} or <code>null</code> if given app is disabled
*/
- static Intent intentForActivity(ResolveInfo app) {
+ Intent intentForActivity(ResolveInfo app) {
final ComponentName component = new ComponentName(app.activityInfo.packageName,
app.activityInfo.name);
+ if (getContext().getPackageManager().getComponentEnabledSetting(component) ==
+ PackageManager.COMPONENT_ENABLED_STATE_DISABLED) {
+ return null;
+ }
final Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(component);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);