Merge "Moving state ordinals to TestProtocol" into ub-launcher3-master
This commit is contained in:
committed by
Android (Google) Code Review
commit
bcd70baf51
@@ -19,6 +19,10 @@ import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_AUTO;
|
||||
import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS;
|
||||
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
|
||||
|
||||
import static com.android.launcher3.TestProtocol.ALL_APPS_STATE_ORDINAL;
|
||||
import static com.android.launcher3.TestProtocol.BACKGROUND_APP_STATE_ORDINAL;
|
||||
import static com.android.launcher3.TestProtocol.OVERVIEW_STATE_ORDINAL;
|
||||
import static com.android.launcher3.TestProtocol.SPRING_LOADED_STATE_ORDINAL;
|
||||
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
|
||||
import static com.android.launcher3.states.RotationHelper.REQUEST_NONE;
|
||||
|
||||
@@ -84,10 +88,12 @@ public class LauncherState {
|
||||
/**
|
||||
* Various Launcher states arranged in the increasing order of UI layers
|
||||
*/
|
||||
public static final LauncherState SPRING_LOADED = new SpringLoadedState(1);
|
||||
public static final LauncherState OVERVIEW = new OverviewState(2);
|
||||
public static final LauncherState ALL_APPS = new AllAppsState(3);
|
||||
public static final LauncherState BACKGROUND_APP = new BackgroundAppState(4);
|
||||
public static final LauncherState SPRING_LOADED = new SpringLoadedState(
|
||||
SPRING_LOADED_STATE_ORDINAL);
|
||||
public static final LauncherState OVERVIEW = new OverviewState(OVERVIEW_STATE_ORDINAL);
|
||||
public static final LauncherState ALL_APPS = new AllAppsState(ALL_APPS_STATE_ORDINAL);
|
||||
public static final LauncherState BACKGROUND_APP = new BackgroundAppState(
|
||||
BACKGROUND_APP_STATE_ORDINAL);
|
||||
|
||||
public final int ordinal;
|
||||
|
||||
|
||||
@@ -25,4 +25,8 @@ public final class TestProtocol {
|
||||
public static final String STATE_FIELD = "state";
|
||||
public static final String SWITCHED_TO_STATE_MESSAGE = "TAPL_SWITCHED_TO_STATE";
|
||||
public static final String RESPONSE_MESSAGE_POSTFIX = "_RESPONSE";
|
||||
public static final int SPRING_LOADED_STATE_ORDINAL = 1;
|
||||
public static final int OVERVIEW_STATE_ORDINAL = 2;
|
||||
public static final int ALL_APPS_STATE_ORDINAL = 3;
|
||||
public static final int BACKGROUND_APP_STATE_ORDINAL = 4;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.launcher3.tapl;
|
||||
|
||||
import static com.android.launcher3.TestProtocol.OVERVIEW_STATE_ORDINAL;
|
||||
|
||||
import android.graphics.Point;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -45,8 +47,7 @@ public final class AllAppsFromOverview extends AllApps {
|
||||
final Point start = qsb.getVisibleCenter();
|
||||
final int endY = (int) (mLauncher.getDevice().getDisplayHeight() * 0.6);
|
||||
LauncherInstrumentation.log("AllAppsFromOverview.switchBackToOverview before swipe");
|
||||
mLauncher.swipe(
|
||||
start.x, start.y, start.x, endY, LauncherInstrumentation.OVERVIEW_STATE_ORDINAL);
|
||||
mLauncher.swipe(start.x, start.y, start.x, endY, OVERVIEW_STATE_ORDINAL);
|
||||
|
||||
return new Overview(mLauncher);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
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;
|
||||
|
||||
@@ -50,7 +51,7 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
|
||||
@NonNull
|
||||
public BaseOverview switchToOverview() {
|
||||
verifyActiveContainer();
|
||||
goToOverviewUnchecked(LauncherInstrumentation.BACKGROUND_APP_STATE_ORDINAL);
|
||||
goToOverviewUnchecked(BACKGROUND_APP_STATE_ORDINAL);
|
||||
assertTrue("Overview not visible", mLauncher.getDevice().wait(
|
||||
Until.hasObject(By.pkg(getOverviewPackageName())), WAIT_TIME_MS));
|
||||
return new BaseOverview(mLauncher);
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.launcher3.tapl;
|
||||
|
||||
import static com.android.launcher3.TestProtocol.OVERVIEW_STATE_ORDINAL;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
/**
|
||||
@@ -47,7 +49,7 @@ public abstract class Home extends Background {
|
||||
@Override
|
||||
public Overview switchToOverview() {
|
||||
verifyActiveContainer();
|
||||
goToOverviewUnchecked(LauncherInstrumentation.OVERVIEW_STATE_ORDINAL);
|
||||
goToOverviewUnchecked(OVERVIEW_STATE_ORDINAL);
|
||||
return new Overview(mLauncher);
|
||||
}
|
||||
}
|
||||
@@ -54,9 +54,6 @@ import java.util.concurrent.TimeoutException;
|
||||
public final class LauncherInstrumentation {
|
||||
|
||||
private static final String TAG = "Tapl";
|
||||
static final int OVERVIEW_STATE_ORDINAL = 2;
|
||||
static final int APPS_LIST_STATE_ORDINAL = 4;
|
||||
static final int BACKGROUND_APP_STATE_ORDINAL = 5;
|
||||
|
||||
// Types for launcher containers that the user is interacting with. "Background" is a
|
||||
// pseudo-container corresponding to inactive launcher covered by another app.
|
||||
@@ -425,8 +422,8 @@ public final class LauncherInstrumentation {
|
||||
event -> TestProtocol.SWITCHED_TO_STATE_MESSAGE.equals(event.getClassName()),
|
||||
"Swipe failed to receive an event for the swipe end: " + startX + ", " + startY
|
||||
+ ", " + endX + ", " + endY);
|
||||
// assertEquals("Swipe switched launcher to a wrong state",
|
||||
// expectedState, parcel.getInt(TestProtocol.STATE_FIELD));
|
||||
assertEquals("Swipe switched launcher to a wrong state",
|
||||
expectedState, parcel.getInt(TestProtocol.STATE_FIELD));
|
||||
}
|
||||
|
||||
void waitForIdle() {
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.launcher3.tapl;
|
||||
|
||||
import static com.android.launcher3.TestProtocol.ALL_APPS_STATE_ORDINAL;
|
||||
|
||||
import android.graphics.Point;
|
||||
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation.ContainerType;
|
||||
@@ -51,8 +53,7 @@ public final class Overview extends BaseOverview {
|
||||
final UiObject2 navBar = mLauncher.getSystemUiObject("navigation_bar_frame");
|
||||
final Point start = navBar.getVisibleCenter();
|
||||
LauncherInstrumentation.log("Overview.switchToAllApps before swipe");
|
||||
mLauncher.swipe(
|
||||
start.x, start.y, start.x, 0, LauncherInstrumentation.APPS_LIST_STATE_ORDINAL);
|
||||
mLauncher.swipe(start.x, start.y, start.x, 0, ALL_APPS_STATE_ORDINAL);
|
||||
|
||||
return new AllAppsFromOverview(mLauncher);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.launcher3.tapl;
|
||||
|
||||
import static com.android.launcher3.TestProtocol.ALL_APPS_STATE_ORDINAL;
|
||||
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
|
||||
import android.graphics.Point;
|
||||
@@ -56,7 +58,7 @@ public final class Workspace extends Home {
|
||||
start.y,
|
||||
start.x,
|
||||
endY,
|
||||
LauncherInstrumentation.APPS_LIST_STATE_ORDINAL
|
||||
ALL_APPS_STATE_ORDINAL
|
||||
);
|
||||
|
||||
return new AllApps(mLauncher);
|
||||
|
||||
Reference in New Issue
Block a user