summaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/launcher3/ui/AllAppsAppLaunchTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/com/android/launcher3/ui/AllAppsAppLaunchTest.java')
-rw-r--r--tests/src/com/android/launcher3/ui/AllAppsAppLaunchTest.java35
1 files changed, 19 insertions, 16 deletions
diff --git a/tests/src/com/android/launcher3/ui/AllAppsAppLaunchTest.java b/tests/src/com/android/launcher3/ui/AllAppsAppLaunchTest.java
index 0ced7cf33..46343a389 100644
--- a/tests/src/com/android/launcher3/ui/AllAppsAppLaunchTest.java
+++ b/tests/src/com/android/launcher3/ui/AllAppsAppLaunchTest.java
@@ -1,52 +1,55 @@
package com.android.launcher3.ui;
import android.content.pm.LauncherActivityInfo;
-import android.os.Process;
+import android.support.test.filters.LargeTest;
+import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.Until;
-import android.test.suitebuilder.annotation.LargeTest;
-import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.util.Condition;
import com.android.launcher3.util.Wait;
+import com.android.launcher3.util.rule.LauncherActivityRule;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.assertTrue;
/**
* Test for verifying apps is launched from all-apps
*/
@LargeTest
-public class AllAppsAppLaunchTest extends LauncherInstrumentationTestCase {
-
- private LauncherActivityInfo mSettingsApp;
+@RunWith(AndroidJUnit4.class)
+public class AllAppsAppLaunchTest extends AbstractLauncherUiTest {
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- mSettingsApp = LauncherAppsCompat.getInstance(mTargetContext)
- .getActivityList("com.android.settings", Process.myUserHandle()).get(0);
- }
+ @Rule public LauncherActivityRule mActivityMonitor = new LauncherActivityRule();
+ @Test
public void testAppLauncher_portrait() throws Exception {
lockRotation(true);
performTest();
}
+ @Test
public void testAppLauncher_landscape() throws Exception {
lockRotation(false);
performTest();
}
private void performTest() throws Exception {
- startLauncher();
+ mActivityMonitor.startLauncher();
+
+ LauncherActivityInfo settingsApp = getSettingsApp();
// Open all apps and wait for load complete
final UiObject2 appsContainer = openAllApps();
assertTrue(Wait.atMost(Condition.minChildCount(appsContainer, 2), DEFAULT_UI_TIMEOUT));
// Open settings app and verify app launched
- scrollAndFind(appsContainer, By.text(mSettingsApp.getLabel().toString())).click();
+ scrollAndFind(appsContainer, By.text(settingsApp.getLabel().toString())).click();
assertTrue(mDevice.wait(Until.hasObject(By.pkg(
- mSettingsApp.getComponentName().getPackageName()).depth(0)), DEFAULT_UI_TIMEOUT));
+ settingsApp.getComponentName().getPackageName()).depth(0)), DEFAULT_UI_TIMEOUT));
}
}