summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVadim Tryshev <vadimt@google.com>2019-05-01 19:53:42 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-05-01 19:53:42 +0000
commitdffb214d0f8769cb8c8fbeda91e7ad6b1c4f2f15 (patch)
treea127e23f6350de9f675c7b208653816a0a076e5b /tests
parent428617ebe7946ab8194053806893e3f0edabfeec (diff)
parentf1e0c90a3b4c3ea193527bbff4b4df32955658dc (diff)
downloadandroid_packages_apps_Trebuchet-dffb214d0f8769cb8c8fbeda91e7ad6b1c4f2f15.tar.gz
android_packages_apps_Trebuchet-dffb214d0f8769cb8c8fbeda91e7ad6b1c4f2f15.tar.bz2
android_packages_apps_Trebuchet-dffb214d0f8769cb8c8fbeda91e7ad6b1c4f2f15.zip
Merge "Not using Contacts app" into ub-launcher3-qt-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/AndroidManifest-common.xml3
-rw-r--r--tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java18
2 files changed, 20 insertions, 1 deletions
diff --git a/tests/AndroidManifest-common.xml b/tests/AndroidManifest-common.xml
index 4051fbd70..75ff66e6e 100644
--- a/tests/AndroidManifest-common.xml
+++ b/tests/AndroidManifest-common.xml
@@ -99,7 +99,8 @@
</activity>
<activity
android:name="com.android.launcher3.testcomponent.BaseTestingActivity"
- android:label="LauncherTestApp">
+ android:label="LauncherTestApp"
+ android:taskAffinity="com.android.launcher3.testcomponent.Affinity1">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index dedc6b3c2..43bdb9f3f 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -17,6 +17,7 @@ package com.android.launcher3.ui;
import static androidx.test.InstrumentationRegistry.getInstrumentation;
+import static com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName;
import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_2BUTTON_OVERLAY;
import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_3BUTTON_OVERLAY;
import static com.android.systemui.shared.system.QuickStepContract.NAV_BAR_MODE_GESTURAL_OVERLAY;
@@ -28,6 +29,7 @@ import static java.lang.System.exit;
import android.app.Instrumentation;
import android.content.BroadcastReceiver;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -426,6 +428,22 @@ public abstract class AbstractLauncherUiTest {
mDevice.wait(Until.hasObject(By.pkg(packageName).depth(0)), LONG_WAIT_TIME_MS));
}
+ protected void startTestActivity(int activityNumber) {
+ final String packageName = getAppPackageName();
+ final Instrumentation instrumentation = getInstrumentation();
+ final Intent intent = instrumentation.getContext().getPackageManager().
+ getLaunchIntentForPackage(packageName);
+ intent.addCategory(Intent.CATEGORY_LAUNCHER);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.setComponent(new ComponentName(packageName,
+ "com.android.launcher3.tests.Activity" + activityNumber));
+ instrumentation.getTargetContext().startActivity(intent);
+ assertTrue(packageName + " didn't start",
+ mDevice.wait(
+ Until.hasObject(By.pkg(packageName).text("TestActivity" + activityNumber)),
+ LONG_WAIT_TIME_MS));
+ }
+
protected static String resolveSystemApp(String category) {
return getInstrumentation().getContext().getPackageManager().resolveActivity(
new Intent(Intent.ACTION_MAIN).addCategory(category),