Merge "Fix pinning tests on android virtual device" into ub-launcher3-qt-dev

This commit is contained in:
Vadim Tryshev
2019-05-16 23:51:28 +00:00
committed by Android (Google) Code Review
4 changed files with 9 additions and 9 deletions
@@ -17,26 +17,25 @@ package com.android.launcher3.ui.widget;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.content.Intent;
import android.graphics.Color;
import android.view.View;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.Until;
import android.view.View;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.R;
import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace.ItemOperator;
import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.testcomponent.AppWidgetNoConfig;
import com.android.launcher3.testcomponent.AppWidgetWithConfig;
@@ -49,7 +48,6 @@ import com.android.launcher3.util.rule.ShellCommandRule;
import com.android.launcher3.widget.WidgetCell;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -181,7 +179,9 @@ public class RequestPinItemTest extends AbstractLauncherUiTest {
// Accept confirmation:
BlockingBroadcastReceiver resultReceiver = new BlockingBroadcastReceiver(mCallbackAction);
mDevice.wait(Until.findObject(By.text("Add automatically")), DEFAULT_UI_TIMEOUT).click();
mDevice.wait(Until.findObject(
By.text(mLauncher.isAvd() ? "ADD AUTOMATICALLY" : "Add automatically")),
DEFAULT_UI_TIMEOUT).click();
Intent result = resultReceiver.blockingGetIntent();
assertNotNull(result);
mAppWidgetId = result.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1);
@@ -28,7 +28,7 @@ import java.util.List;
* Common overview pane for both Launcher and fallback recents
*/
public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
private static final int FLING_SPEED = LauncherInstrumentation.needSlowGestures() ? 500 : 1500;
private static final int FLING_SPEED = LauncherInstrumentation.isAvd() ? 500 : 1500;
private static final int FLINGS_FOR_DISMISS_LIMIT = 40;
BaseOverview(LauncherInstrumentation launcher) {
@@ -198,7 +198,7 @@ public final class LauncherInstrumentation {
return NavigationModel.THREE_BUTTON;
}
public static boolean needSlowGestures() {
public static boolean isAvd() {
return Build.MODEL.contains("Cuttlefish");
}
@@ -37,7 +37,7 @@ import com.android.launcher3.TestProtocol;
*/
public final class Workspace extends Home {
private static final float FLING_SPEED =
LauncherInstrumentation.needSlowGestures() ? 1500.0F : 3500.0F;
LauncherInstrumentation.isAvd() ? 1500.0F : 3500.0F;
private static final int DRAG_DURACTION = 2000;
private final UiObject2 mHotseat;