summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorvadimt <vadimt@google.com>2019-04-30 19:54:43 -0700
committervadimt <vadimt@google.com>2019-05-01 12:21:56 -0700
commitf1e0c90a3b4c3ea193527bbff4b4df32955658dc (patch)
tree9a6078aab29d93069a73610dcc744d023d6e33b8 /tests
parentc9a2eb08091e6ef8252cff2a182540e60942ee43 (diff)
downloadandroid_packages_apps_Trebuchet-f1e0c90a3b4c3ea193527bbff4b4df32955658dc.tar.gz
android_packages_apps_Trebuchet-f1e0c90a3b4c3ea193527bbff4b4df32955658dc.tar.bz2
android_packages_apps_Trebuchet-f1e0c90a3b4c3ea193527bbff4b4df32955658dc.zip
Not using Contacts app
Bug: 131628231 Change-Id: If877cc95879263330b7bbd344ddd3a526a5e6fac
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),