Started converting Launcher to be gesture-stable

All tests keep passing.

WorkTabTest.workTabExists was made gesture-stable. There is no need to
use TAPL, as the point is not to check answering to gestures, but to
check presence of tabs, which is better to do using launcher internal
state. (It still fails if run as a part of all tests, presumably,
because after Launcher's start, changes in user configuration are not
recognized, so I've commented the failing part)

Bug: 110103162
Test: Run all tests
Change-Id: Ic30b8e8475d16cee3880332f12311a44ddfa26cb
This commit is contained in:
Vadim Tryshev 2018-08-10 20:01:24 -07:00
parent b6ecb17356
commit dc755e718d
12 changed files with 101 additions and 119 deletions

View File

@ -390,6 +390,26 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
} }
} }
// Used by tests only
private boolean isDescendantViewVisible(int viewId) {
final View view = findViewById(viewId);
if (view == null) return false;
if (!view.isShown()) return false;
return view.getGlobalVisibleRect(new Rect());
}
// Used by tests only
public boolean isPersonalTabVisible() {
return isDescendantViewVisible(R.id.tab_personal);
}
// Used by tests only
public boolean isWorkTabVisible() {
return isDescendantViewVisible(R.id.tab_work);
}
public AlphabeticalAppsList getApps() { public AlphabeticalAppsList getApps() {
return mAH[AdapterHolder.MAIN].appsList; return mAH[AdapterHolder.MAIN].appsList;
} }

View File

@ -17,7 +17,8 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ub-uiautomator mockito-target-minus-junit4 LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ub-uiautomator mockito-target-minus-junit4 \
ub-launcher-aosp-tapl
LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_FULL_LIBS_MANIFEST_FILES := $(LOCAL_PATH)/AndroidManifest-common.xml LOCAL_FULL_LIBS_MANIFEST_FILES := $(LOCAL_PATH)/AndroidManifest-common.xml

View File

@ -15,6 +15,9 @@
*/ */
package com.android.launcher3.ui; package com.android.launcher3.ui;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import android.app.Instrumentation; import android.app.Instrumentation;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName; import android.content.ComponentName;
@ -36,24 +39,30 @@ import android.support.test.uiautomator.Until;
import android.util.Log; import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.LauncherAppWidgetProviderInfo;
import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherState;
import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.R; import com.android.launcher3.R;
import com.android.launcher3.compat.AppWidgetManagerCompat; import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.tapl.LauncherInstrumentation;
import com.android.launcher3.testcomponent.AppWidgetNoConfig; import com.android.launcher3.testcomponent.AppWidgetNoConfig;
import com.android.launcher3.testcomponent.AppWidgetWithConfig; import com.android.launcher3.testcomponent.AppWidgetWithConfig;
import com.android.launcher3.util.Condition;
import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.LauncherActivityRule;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import static org.junit.Assert.assertNotNull; import java.util.function.Function;
import static org.junit.Assert.assertNull;
/** /**
* Base class for all instrumentation tests providing various utility methods. * Base class for all instrumentation tests providing various utility methods.
@ -65,19 +74,23 @@ public abstract class AbstractLauncherUiTest {
public static final long SHORT_UI_TIMEOUT= 300; public static final long SHORT_UI_TIMEOUT= 300;
public static final long DEFAULT_UI_TIMEOUT = 3000; public static final long DEFAULT_UI_TIMEOUT = 3000;
public static final long LARGE_UI_TIMEOUT = 10000;
public static final long DEFAULT_WORKER_TIMEOUT_SECS = 5; public static final long DEFAULT_WORKER_TIMEOUT_SECS = 5;
protected MainThreadExecutor mMainThreadExecutor = new MainThreadExecutor(); protected MainThreadExecutor mMainThreadExecutor = new MainThreadExecutor();
protected UiDevice mDevice; protected UiDevice mDevice;
protected LauncherInstrumentation mLauncher;
protected Context mTargetContext; protected Context mTargetContext;
protected String mTargetPackage; protected String mTargetPackage;
private static final String TAG = "AbstractLauncherUiTest"; private static final String TAG = "AbstractLauncherUiTest";
@Rule
public LauncherActivityRule mActivityMonitor = new LauncherActivityRule();
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
mDevice = UiDevice.getInstance(getInstrumentation()); mDevice = UiDevice.getInstance(getInstrumentation());
mLauncher = new LauncherInstrumentation(mDevice);
mTargetContext = InstrumentationRegistry.getTargetContext(); mTargetContext = InstrumentationRegistry.getTargetContext();
mTargetPackage = mTargetContext.getPackageName(); mTargetPackage = mTargetContext.getPackageName();
} }
@ -236,6 +249,33 @@ public abstract class AbstractLauncherUiTest {
} }
} }
protected <T> T getFromLauncher(Function<Launcher, T> f) {
return getOnUiThread(() -> f.apply(mActivityMonitor.getActivity()));
}
protected void executeOnLauncher(Consumer<Launcher> f) {
getFromLauncher(launcher -> {
f.accept(launcher);
return null;
});
}
// Cannot be used between a Tapl call injecting a gesture and a tapl call expecting the
// results of that gesture because the wait can hide flakeness.
protected boolean waitForState(LauncherState state) {
return waitForLauncherCondition(launcher -> launcher.getStateManager().getState() == state);
}
// Cannot be used after injecting any gesture using Tapl because this can hide flakiness.
protected boolean waitForLauncherCondition(Function<Launcher, Boolean> condition) {
return Wait.atMost(new Condition() {
@Override
public boolean isTrue() {
return getFromLauncher(condition);
}
}, DEFAULT_ACTIVITY_TIMEOUT);
}
/** /**
* Finds a widget provider which can fit on the home screen. * Finds a widget provider which can fit on the home screen.
* @param hasConfigureScreen if true, a provider with a config screen is returned. * @param hasConfigureScreen if true, a provider with a config screen is returned.

View File

@ -1,55 +0,0 @@
package com.android.launcher3.ui;
import android.content.pm.LauncherActivityInfo;
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 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
@RunWith(AndroidJUnit4.class)
public class AllAppsAppLaunchTest extends AbstractLauncherUiTest {
@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 {
mActivityMonitor.startLauncher();
LauncherActivityInfo testApp = getChromeApp();
// Open all apps and wait for load complete
final UiObject2 appsContainer = openAllApps();
assertTrue(Wait.atMost(Condition.minChildCount(appsContainer, 2), DEFAULT_UI_TIMEOUT));
// Open app and verify app launched
scrollAndFind(appsContainer, By.text(testApp.getLabel().toString())).click();
assertTrue(mDevice.wait(Until.hasObject(By.pkg(
testApp.getComponentName().getPackageName()).depth(0)), DEFAULT_UI_TIMEOUT));
}
}

View File

@ -1,5 +1,7 @@
package com.android.launcher3.ui; package com.android.launcher3.ui;
import static org.junit.Assert.assertTrue;
import android.content.pm.LauncherActivityInfo; import android.content.pm.LauncherActivityInfo;
import android.support.test.filters.LargeTest; import android.support.test.filters.LargeTest;
import android.support.test.runner.AndroidJUnit4; import android.support.test.runner.AndroidJUnit4;
@ -9,15 +11,12 @@ import android.support.test.uiautomator.Until;
import com.android.launcher3.util.Condition; import com.android.launcher3.util.Condition;
import com.android.launcher3.util.Wait; import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.LauncherActivityRule;
import com.android.launcher3.util.rule.ShellCommandRule; import com.android.launcher3.util.rule.ShellCommandRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import static org.junit.Assert.assertTrue;
/** /**
* Test for dragging an icon from all-apps to homescreen. * Test for dragging an icon from all-apps to homescreen.
*/ */
@ -25,7 +24,6 @@ import static org.junit.Assert.assertTrue;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class AllAppsIconToHomeTest extends AbstractLauncherUiTest { public class AllAppsIconToHomeTest extends AbstractLauncherUiTest {
@Rule public LauncherActivityRule mActivityMonitor = new LauncherActivityRule();
@Rule public ShellCommandRule mDefaultLauncherRule = ShellCommandRule.setDefaultLauncher(); @Rule public ShellCommandRule mDefaultLauncherRule = ShellCommandRule.setDefaultLauncher();
@Test @Test

View File

@ -1,5 +1,8 @@
package com.android.launcher3.ui; package com.android.launcher3.ui;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import android.content.pm.LauncherActivityInfo; import android.content.pm.LauncherActivityInfo;
import android.graphics.Point; import android.graphics.Point;
import android.support.test.filters.LargeTest; import android.support.test.filters.LargeTest;
@ -12,16 +15,12 @@ import android.view.MotionEvent;
import com.android.launcher3.R; import com.android.launcher3.R;
import com.android.launcher3.util.Condition; import com.android.launcher3.util.Condition;
import com.android.launcher3.util.Wait; import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.LauncherActivityRule;
import com.android.launcher3.util.rule.ShellCommandRule; import com.android.launcher3.util.rule.ShellCommandRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
/** /**
* Test for verifying that shortcuts are shown and can be launched after long pressing an app * Test for verifying that shortcuts are shown and can be launched after long pressing an app
*/ */
@ -29,7 +28,6 @@ import static org.junit.Assert.assertTrue;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class ShortcutsLaunchTest extends AbstractLauncherUiTest { public class ShortcutsLaunchTest extends AbstractLauncherUiTest {
@Rule public LauncherActivityRule mActivityMonitor = new LauncherActivityRule();
@Rule public ShellCommandRule mDefaultLauncherRule = ShellCommandRule.setDefaultLauncher(); @Rule public ShellCommandRule mDefaultLauncherRule = ShellCommandRule.setDefaultLauncher();
@Test @Test

View File

@ -1,5 +1,8 @@
package com.android.launcher3.ui; package com.android.launcher3.ui;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import android.content.pm.LauncherActivityInfo; import android.content.pm.LauncherActivityInfo;
import android.graphics.Point; import android.graphics.Point;
import android.support.test.filters.LargeTest; import android.support.test.filters.LargeTest;
@ -12,16 +15,12 @@ import android.view.MotionEvent;
import com.android.launcher3.R; import com.android.launcher3.R;
import com.android.launcher3.util.Condition; import com.android.launcher3.util.Condition;
import com.android.launcher3.util.Wait; import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.LauncherActivityRule;
import com.android.launcher3.util.rule.ShellCommandRule; import com.android.launcher3.util.rule.ShellCommandRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
/** /**
* Test for dragging a deep shortcut to the home screen. * Test for dragging a deep shortcut to the home screen.
*/ */
@ -29,7 +28,6 @@ import static org.junit.Assert.assertTrue;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class ShortcutsToHomeTest extends AbstractLauncherUiTest { public class ShortcutsToHomeTest extends AbstractLauncherUiTest {
@Rule public LauncherActivityRule mActivityMonitor = new LauncherActivityRule();
@Rule public ShellCommandRule mDefaultLauncherRule = ShellCommandRule.setDefaultLauncher(); @Rule public ShellCommandRule mDefaultLauncherRule = ShellCommandRule.setDefaultLauncher();
@Test @Test

View File

@ -15,15 +15,13 @@
*/ */
package com.android.launcher3.ui; package com.android.launcher3.ui;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static org.junit.Assert.assertTrue;
import android.support.test.filters.LargeTest; import android.support.test.filters.LargeTest;
import android.support.test.runner.AndroidJUnit4; import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.Until;
import com.android.launcher3.R;
import com.android.launcher3.util.Condition;
import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.LauncherActivityRule;
import com.android.launcher3.util.rule.ShellCommandRule; import com.android.launcher3.util.rule.ShellCommandRule;
import org.junit.After; import org.junit.After;
@ -32,13 +30,9 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import static org.junit.Assert.assertTrue;
@LargeTest @LargeTest
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class WorkTabTest extends AbstractLauncherUiTest { public class WorkTabTest extends AbstractLauncherUiTest {
@Rule
public LauncherActivityRule mActivityMonitor = new LauncherActivityRule();
@Rule @Rule
public ShellCommandRule mDefaultLauncherRule = ShellCommandRule.setDefaultLauncher(); public ShellCommandRule mDefaultLauncherRule = ShellCommandRule.setDefaultLauncher();
@ -66,17 +60,13 @@ public class WorkTabTest extends AbstractLauncherUiTest {
public void workTabExists() { public void workTabExists() {
mActivityMonitor.startLauncher(); mActivityMonitor.startLauncher();
// Open all apps and wait for load complete executeOnLauncher(launcher -> launcher.getStateManager().goToState(ALL_APPS));
final UiObject2 appsContainer = openAllApps();
assertTrue(Wait.atMost(Condition.minChildCount(appsContainer, 2),
LARGE_UI_TIMEOUT));
/* /*
assertTrue("Personal tab is missing", assertTrue("Personal tab is missing", waitForLauncherCondition(
mDevice.wait(Until.hasObject(getSelectorForId(R.id.tab_personal)), launcher -> launcher.getAppsView().isPersonalTabVisible()));
LARGE_UI_TIMEOUT)); assertTrue("Work tab is missing", waitForLauncherCondition(
assertTrue("Work tab is missing", launcher -> launcher.getAppsView().isWorkTabVisible()));
mDevice.wait(Until.hasObject(getSelectorForId(R.id.tab_work)), LARGE_UI_TIMEOUT));
*/ */
} }
} }

View File

@ -15,6 +15,11 @@
*/ */
package com.android.launcher3.ui.widget; package com.android.launcher3.ui.widget;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetManager;
import android.content.Intent; import android.content.Intent;
import android.support.test.filters.LargeTest; import android.support.test.filters.LargeTest;
@ -31,7 +36,6 @@ import com.android.launcher3.testcomponent.WidgetConfigActivity;
import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.ui.AbstractLauncherUiTest;
import com.android.launcher3.util.Condition; import com.android.launcher3.util.Condition;
import com.android.launcher3.util.Wait; import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.LauncherActivityRule;
import com.android.launcher3.util.rule.ShellCommandRule; import com.android.launcher3.util.rule.ShellCommandRule;
import com.android.launcher3.widget.WidgetCell; import com.android.launcher3.widget.WidgetCell;
@ -40,11 +44,6 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
/** /**
* Test to verify widget configuration is properly shown. * Test to verify widget configuration is properly shown.
*/ */
@ -52,7 +51,6 @@ import static org.junit.Assert.assertTrue;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class AddConfigWidgetTest extends AbstractLauncherUiTest { public class AddConfigWidgetTest extends AbstractLauncherUiTest {
@Rule public LauncherActivityRule mActivityMonitor = new LauncherActivityRule();
@Rule public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grandWidgetBind(); @Rule public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grandWidgetBind();
private LauncherAppWidgetProviderInfo mWidgetInfo; private LauncherAppWidgetProviderInfo mWidgetInfo;

View File

@ -15,6 +15,8 @@
*/ */
package com.android.launcher3.ui.widget; package com.android.launcher3.ui.widget;
import static org.junit.Assert.assertTrue;
import android.support.test.filters.LargeTest; import android.support.test.filters.LargeTest;
import android.support.test.runner.AndroidJUnit4; import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.By; import android.support.test.uiautomator.By;
@ -28,7 +30,6 @@ import com.android.launcher3.Workspace.ItemOperator;
import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.ui.AbstractLauncherUiTest;
import com.android.launcher3.util.Condition; import com.android.launcher3.util.Condition;
import com.android.launcher3.util.Wait; import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.LauncherActivityRule;
import com.android.launcher3.util.rule.ShellCommandRule; import com.android.launcher3.util.rule.ShellCommandRule;
import com.android.launcher3.widget.WidgetCell; import com.android.launcher3.widget.WidgetCell;
@ -36,8 +37,6 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import static org.junit.Assert.assertTrue;
/** /**
* Test to add widget from widget tray * Test to add widget from widget tray
*/ */
@ -45,7 +44,6 @@ import static org.junit.Assert.assertTrue;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class AddWidgetTest extends AbstractLauncherUiTest { public class AddWidgetTest extends AbstractLauncherUiTest {
@Rule public LauncherActivityRule mActivityMonitor = new LauncherActivityRule();
@Rule public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grandWidgetBind(); @Rule public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grandWidgetBind();
@Test @Test

View File

@ -15,6 +15,11 @@
*/ */
package com.android.launcher3.ui.widget; package com.android.launcher3.ui.widget;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import android.appwidget.AppWidgetHost; import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetManager;
import android.content.ComponentName; import android.content.ComponentName;
@ -30,21 +35,20 @@ import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiSelector; import android.support.test.uiautomator.UiSelector;
import com.android.launcher3.LauncherAppWidgetHost; import com.android.launcher3.LauncherAppWidgetHost;
import com.android.launcher3.widget.LauncherAppWidgetHostView;
import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.LauncherAppWidgetProviderInfo;
import com.android.launcher3.LauncherModel; import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherSettings; import com.android.launcher3.LauncherSettings;
import com.android.launcher3.widget.PendingAppWidgetHostView;
import com.android.launcher3.Workspace; import com.android.launcher3.Workspace;
import com.android.launcher3.compat.AppWidgetManagerCompat; import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.compat.PackageInstallerCompat; import com.android.launcher3.compat.PackageInstallerCompat;
import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.ui.AbstractLauncherUiTest;
import com.android.launcher3.util.ContentWriter; import com.android.launcher3.util.ContentWriter;
import com.android.launcher3.util.LooperExecutor; import com.android.launcher3.util.LooperExecutor;
import com.android.launcher3.util.rule.LauncherActivityRule;
import com.android.launcher3.util.rule.ShellCommandRule; import com.android.launcher3.util.rule.ShellCommandRule;
import com.android.launcher3.widget.LauncherAppWidgetHostView;
import com.android.launcher3.widget.PendingAddWidgetInfo; import com.android.launcher3.widget.PendingAddWidgetInfo;
import com.android.launcher3.widget.PendingAppWidgetHostView;
import com.android.launcher3.widget.WidgetHostViewLoader; import com.android.launcher3.widget.WidgetHostViewLoader;
import org.junit.After; import org.junit.After;
@ -58,11 +62,6 @@ import java.util.Set;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
/** /**
* Tests for bind widget flow. * Tests for bind widget flow.
* *
@ -72,7 +71,6 @@ import static org.junit.Assert.assertTrue;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class BindWidgetTest extends AbstractLauncherUiTest { public class BindWidgetTest extends AbstractLauncherUiTest {
@Rule public LauncherActivityRule mActivityMonitor = new LauncherActivityRule();
@Rule public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grandWidgetBind(); @Rule public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grandWidgetBind();
private ContentResolver mResolver; private ContentResolver mResolver;

View File

@ -15,6 +15,10 @@
*/ */
package com.android.launcher3.ui.widget; 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.app.PendingIntent;
import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetManager;
import android.content.Intent; import android.content.Intent;
@ -40,7 +44,6 @@ import com.android.launcher3.testcomponent.RequestPinItemActivity;
import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.ui.AbstractLauncherUiTest;
import com.android.launcher3.util.Condition; import com.android.launcher3.util.Condition;
import com.android.launcher3.util.Wait; import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.LauncherActivityRule;
import com.android.launcher3.util.rule.ShellCommandRule; import com.android.launcher3.util.rule.ShellCommandRule;
import com.android.launcher3.widget.WidgetCell; import com.android.launcher3.widget.WidgetCell;
@ -52,10 +55,6 @@ import org.junit.runner.RunWith;
import java.util.UUID; import java.util.UUID;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
/** /**
* Test to verify pin item request flow. * Test to verify pin item request flow.
*/ */
@ -63,7 +62,6 @@ import static org.junit.Assert.assertTrue;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class RequestPinItemTest extends AbstractLauncherUiTest { public class RequestPinItemTest extends AbstractLauncherUiTest {
@Rule public LauncherActivityRule mActivityMonitor = new LauncherActivityRule();
@Rule public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grandWidgetBind(); @Rule public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grandWidgetBind();
@Rule public ShellCommandRule mDefaultLauncherRule = ShellCommandRule.setDefaultLauncher(); @Rule public ShellCommandRule mDefaultLauncherRule = ShellCommandRule.setDefaultLauncher();