Merge "Use DeviceProfile.isTwoPanels for two panels expectation in tests" into sc-v2-dev

This commit is contained in:
TreeHugger Robot
2021-07-16 17:32:49 +00:00
committed by Android (Google) Code Review
5 changed files with 13 additions and 2 deletions
@@ -121,6 +121,11 @@ public class TestInformationHandler implements ResourceBasedOverride {
response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, mDeviceProfile.isTablet);
return response;
case TestProtocol.REQUEST_IS_TWO_PANELS:
response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
mDeviceProfile.isTwoPanels);
return response;
default:
return null;
}
@@ -95,6 +95,7 @@ public final class TestProtocol {
public static final String REQUEST_STOP_EVENT_LOGGING = "stop-event-logging";
public static final String REQUEST_CLEAR_DATA = "clear-data";
public static final String REQUEST_IS_TABLET = "is-tablet";
public static final String REQUEST_IS_TWO_PANELS = "is-two-panel";
public static boolean sDebugTracing = false;
public static final String REQUEST_ENABLE_DEBUG_TRACING = "enable-debug-tracing";
@@ -81,7 +81,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
}
private int pagesPerScreen() {
return mLauncher.isTablet() ? 2 : 1;
return mLauncher.isTwoPanels() ? 2 : 1;
}
private boolean isWorkspaceScrollable(Launcher launcher) {
@@ -288,6 +288,11 @@ public final class LauncherInstrumentation {
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
}
public boolean isTwoPanels() {
return getTestInfo(TestProtocol.REQUEST_IS_TWO_PANELS)
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
}
void setActiveContainer(VisibleContainer container) {
sActiveContainer = new WeakReference<>(container);
}
@@ -163,7 +163,7 @@ public final class Workspace extends Home {
}
private boolean isWorkspaceScrollable(UiObject2 workspace) {
return workspace.getChildCount() > (mLauncher.isTablet() ? 2 : 1);
return workspace.getChildCount() > (mLauncher.isTwoPanels() ? 2 : 1);
}
@NonNull