Merge "TAPL: Simplifying BaseOverview" into ub-launcher3-qt-dev
This commit is contained in:
commit
08ff6f586c
|
@ -17,16 +17,12 @@
|
|||
package com.android.launcher3.tapl;
|
||||
|
||||
import static com.android.launcher3.TestProtocol.BACKGROUND_APP_STATE_ORDINAL;
|
||||
import static com.android.launcher3.tapl.LauncherInstrumentation.WAIT_TIME_MS;
|
||||
import static com.android.launcher3.tapl.TestHelpers.getOverviewPackageName;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.os.SystemClock;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.uiautomator.By;
|
||||
import androidx.test.uiautomator.Until;
|
||||
|
||||
import com.android.launcher3.TestProtocol;
|
||||
|
||||
|
@ -59,8 +55,6 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
|
|||
"want to switch from background to overview")) {
|
||||
verifyActiveContainer();
|
||||
goToOverviewUnchecked(BACKGROUND_APP_STATE_ORDINAL);
|
||||
mLauncher.assertTrue("Overview not visible", mLauncher.getDevice().wait(
|
||||
Until.hasObject(By.pkg(getOverviewPackageName())), WAIT_TIME_MS));
|
||||
return new BaseOverview(mLauncher);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
|
|||
|
||||
BaseOverview(LauncherInstrumentation launcher) {
|
||||
super(launcher);
|
||||
verifyActiveContainer();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,6 +18,7 @@ package com.android.launcher3.tapl;
|
|||
|
||||
import static com.android.launcher3.TestProtocol.BACKGROUND_APP_STATE_ORDINAL;
|
||||
import static com.android.launcher3.TestProtocol.NORMAL_STATE_ORDINAL;
|
||||
import static com.android.launcher3.tapl.TestHelpers.getOverviewPackageName;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Instrumentation;
|
||||
|
@ -296,14 +297,14 @@ public final class LauncherInstrumentation {
|
|||
} else {
|
||||
waitUntilGone(APPS_RES_ID);
|
||||
}
|
||||
// Fall through
|
||||
}
|
||||
case BASE_OVERVIEW: {
|
||||
waitUntilGone(WORKSPACE_RES_ID);
|
||||
waitUntilGone(WIDGETS_RES_ID);
|
||||
|
||||
return waitForLauncherObject(OVERVIEW_RES_ID);
|
||||
}
|
||||
case BASE_OVERVIEW: {
|
||||
return waitForFallbackLauncherObject(OVERVIEW_RES_ID);
|
||||
}
|
||||
case BACKGROUND: {
|
||||
waitUntilGone(WORKSPACE_RES_ID);
|
||||
waitUntilGone(APPS_RES_ID);
|
||||
|
@ -528,10 +529,22 @@ public final class LauncherInstrumentation {
|
|||
return object;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
UiObject2 waitForFallbackLauncherObject(String resName) {
|
||||
final BySelector selector = getFallbackLauncherObjectSelector(resName);
|
||||
final UiObject2 object = mDevice.wait(Until.findObject(selector), WAIT_TIME_MS);
|
||||
assertNotNull("Can't find a fallback launcher object; selector: " + selector, object);
|
||||
return object;
|
||||
}
|
||||
|
||||
BySelector getLauncherObjectSelector(String resName) {
|
||||
return By.res(getLauncherPackageName(), resName);
|
||||
}
|
||||
|
||||
BySelector getFallbackLauncherObjectSelector(String resName) {
|
||||
return By.res(getOverviewPackageName(), resName);
|
||||
}
|
||||
|
||||
String getLauncherPackageName() {
|
||||
return mDevice.getLauncherPackageName();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue