Merge "Moving the static initialization method from TaplTestsLauncher3 to AbstractLauncherUiTest" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
4a708997a1
@@ -25,7 +25,6 @@ import android.content.Intent;
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation;
|
||||
import com.android.launcher3.tapl.Taskbar;
|
||||
import com.android.launcher3.ui.AbstractLauncherUiTest;
|
||||
import com.android.launcher3.ui.TaplTestsLauncher3;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.LauncherLayoutBuilder;
|
||||
import com.android.launcher3.util.TestUtil;
|
||||
@@ -55,7 +54,7 @@ public class AbstractTaplTestsTaskbar extends AbstractQuickStepTest {
|
||||
"com.google.android.apps.nexuslauncher.tests",
|
||||
"com.android.launcher3.testcomponent.BaseTestingActivity");
|
||||
mLauncherLayout = TestUtil.setLauncherDefaultLayout(mTargetContext, layoutBuilder);
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
AbstractLauncherUiTest.initialize(this);
|
||||
startAppFast(CALCULATOR_APP_PACKAGE);
|
||||
mLauncher.enableBlockTimeout(true);
|
||||
mLauncher.showTaskbarIfHidden();
|
||||
|
||||
@@ -22,7 +22,7 @@ import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUB
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.launcher3.ui.TaplTestsLauncher3;
|
||||
import com.android.launcher3.ui.AbstractLauncherUiTest;
|
||||
import com.android.launcher3.util.rule.TestStabilityRule.Stability;
|
||||
import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class StartLauncherViaGestureTests extends AbstractQuickStepTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
AbstractLauncherUiTest.initialize(this);
|
||||
// b/143488140
|
||||
mLauncher.goHome();
|
||||
// Start an activity where the gestures start.
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.android.quickstep;
|
||||
|
||||
import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
|
||||
import static com.android.launcher3.ui.AbstractLauncherUiTest.initialize;
|
||||
import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
|
||||
import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import androidx.test.filters.LargeTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.launcher3.tapl.KeyboardQuickSwitch;
|
||||
import com.android.launcher3.ui.TaplTestsLauncher3;
|
||||
import com.android.launcher3.ui.AbstractLauncherUiTest;
|
||||
|
||||
import org.junit.Assume;
|
||||
import org.junit.Test;
|
||||
@@ -56,7 +56,7 @@ public class TaplTestsKeyboardQuickSwitch extends AbstractQuickStepTest {
|
||||
public void setUp() throws Exception {
|
||||
Assume.assumeTrue(mLauncher.isTablet());
|
||||
super.setUp();
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
AbstractLauncherUiTest.initialize(this);
|
||||
startAppFast(CALCULATOR_APP_PACKAGE);
|
||||
startTestActivity(2);
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel;
|
||||
import com.android.launcher3.tapl.Overview;
|
||||
import com.android.launcher3.tapl.OverviewActions;
|
||||
import com.android.launcher3.tapl.OverviewTask;
|
||||
import com.android.launcher3.ui.AbstractLauncherUiTest;
|
||||
import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
|
||||
import com.android.launcher3.ui.TaplTestsLauncher3;
|
||||
import com.android.launcher3.util.Wait;
|
||||
import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
|
||||
import com.android.launcher3.util.rule.TestStabilityRule;
|
||||
@@ -72,7 +72,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
AbstractLauncherUiTest.initialize(this);
|
||||
executeOnLauncher(launcher -> {
|
||||
RecentsView recentsView = launcher.getOverviewPanel();
|
||||
recentsView.getPagedViewOrientedState().forceAllowRotationForTesting(true);
|
||||
|
||||
@@ -32,15 +32,14 @@ import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import com.android.launcher3.tapl.Overview;
|
||||
import com.android.launcher3.tapl.Taskbar;
|
||||
import com.android.launcher3.tapl.TaskbarAppIcon;
|
||||
import com.android.launcher3.ui.AbstractLauncherUiTest;
|
||||
import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
|
||||
import com.android.launcher3.ui.TaplTestsLauncher3;
|
||||
import com.android.launcher3.util.rule.TestStabilityRule;
|
||||
import com.android.quickstep.TaskbarModeSwitchRule.TaskbarModeSwitch;
|
||||
import com.android.wm.shell.Flags;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -58,7 +57,7 @@ public class TaplTestsSplitscreen extends AbstractQuickStepTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
AbstractLauncherUiTest.initialize(this);
|
||||
|
||||
if (mLauncher.isTablet()) {
|
||||
mLauncher.enableBlockTimeout(true);
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.quickstep;
|
||||
import static com.android.quickstep.NavigationModeSwitchRule.Mode.ZERO_BUTTON;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assume.assumeFalse;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
@@ -32,8 +31,8 @@ import androidx.test.runner.AndroidJUnit4;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation.TrackpadGestureType;
|
||||
import com.android.launcher3.tapl.Workspace;
|
||||
import com.android.launcher3.ui.AbstractLauncherUiTest;
|
||||
import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
|
||||
import com.android.launcher3.ui.TaplTestsLauncher3;
|
||||
import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
|
||||
|
||||
import org.junit.After;
|
||||
@@ -51,7 +50,7 @@ public class TaplTestsTrackpad extends AbstractQuickStepTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
AbstractLauncherUiTest.initialize(this);
|
||||
}
|
||||
|
||||
@After
|
||||
|
||||
@@ -56,7 +56,7 @@ import com.android.launcher3.tapl.LaunchedAppState;
|
||||
import com.android.launcher3.testcomponent.ListViewService;
|
||||
import com.android.launcher3.testcomponent.ListViewService.SimpleViewsFactory;
|
||||
import com.android.launcher3.testcomponent.TestCommandReceiver;
|
||||
import com.android.launcher3.ui.TaplTestsLauncher3;
|
||||
import com.android.launcher3.ui.AbstractLauncherUiTest;
|
||||
import com.android.launcher3.ui.TestViewHelpers;
|
||||
import com.android.launcher3.util.Executors;
|
||||
import com.android.launcher3.widget.LauncherAppWidgetProviderInfo;
|
||||
@@ -102,7 +102,7 @@ public class ViewInflationDuringSwipeUp extends AbstractQuickStepTest {
|
||||
// is started only after starting another app.
|
||||
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
|
||||
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
AbstractLauncherUiTest.initialize(this);
|
||||
|
||||
mModel = LauncherAppState.getInstance(mTargetContext).getModel();
|
||||
Executors.MODEL_EXECUTOR.submit(mModel.getModelDbController()::createEmptyDB).get();
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.android.launcher3.allapps;
|
||||
|
||||
import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
|
||||
import static com.android.launcher3.ui.AbstractLauncherUiTest.initialize;
|
||||
import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
|
||||
import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
package com.android.launcher3.allapps;
|
||||
|
||||
import static com.android.launcher3.ui.TaplTestsLauncher3.expectFail;
|
||||
import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
|
||||
import static com.android.launcher3.ui.AbstractLauncherUiTest.initialize;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.android.launcher3.allapps;
|
||||
|
||||
import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
|
||||
import static com.android.launcher3.ui.AbstractLauncherUiTest.initialize;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
package com.android.launcher3.appiconmenu;
|
||||
|
||||
import static com.android.launcher3.util.TestConstants.AppNames.TEST_APP_NAME;
|
||||
import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
|
||||
import static com.android.launcher3.ui.AbstractLauncherUiTest.initialize;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@@ -38,7 +38,6 @@ import com.android.launcher3.celllayout.board.WidgetRect;
|
||||
import com.android.launcher3.tapl.Widget;
|
||||
import com.android.launcher3.tapl.WidgetResizeFrame;
|
||||
import com.android.launcher3.ui.AbstractLauncherUiTest;
|
||||
import com.android.launcher3.ui.TaplTestsLauncher3;
|
||||
import com.android.launcher3.util.ModelTestExtensions;
|
||||
import com.android.launcher3.util.rule.ShellCommandRule;
|
||||
|
||||
@@ -73,7 +72,7 @@ public class ReorderWidgets extends AbstractLauncherUiTest {
|
||||
@Before
|
||||
public void setup() throws Throwable {
|
||||
mWorkspaceBuilder = new TestWorkspaceBuilder(mTargetContext);
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
AbstractLauncherUiTest.initialize(this);
|
||||
}
|
||||
|
||||
@After
|
||||
|
||||
@@ -19,7 +19,7 @@ import static com.android.launcher3.util.TestConstants.AppNames.TEST_APP_NAME;
|
||||
import static com.android.launcher3.util.TestConstants.AppNames.GMAIL_APP_NAME;
|
||||
import static com.android.launcher3.util.TestConstants.AppNames.MAPS_APP_NAME;
|
||||
import static com.android.launcher3.util.TestConstants.AppNames.STORE_APP_NAME;
|
||||
import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
|
||||
import static com.android.launcher3.ui.AbstractLauncherUiTest.initialize;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
package com.android.launcher3.dragging;
|
||||
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.ICON_MISSING;
|
||||
import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
|
||||
import static com.android.launcher3.ui.AbstractLauncherUiTest.initialize;
|
||||
import static com.android.launcher3.util.TestConstants.AppNames.DUMMY_APP_NAME;
|
||||
import static com.android.launcher3.util.TestConstants.AppNames.GMAIL_APP_NAME;
|
||||
import static com.android.launcher3.util.TestConstants.AppNames.MAPS_APP_NAME;
|
||||
|
||||
@@ -220,6 +220,23 @@ public abstract class AbstractLauncherUiTest {
|
||||
@Rule
|
||||
public SetFlagsRule mSetFlagsRule = new SetFlagsRule(DEVICE_DEFAULT);
|
||||
|
||||
public static void initialize(AbstractLauncherUiTest test) throws Exception {
|
||||
initialize(test, false);
|
||||
}
|
||||
|
||||
public static void initialize(
|
||||
AbstractLauncherUiTest test, boolean clearWorkspace) throws Exception {
|
||||
test.reinitializeLauncherData(clearWorkspace);
|
||||
test.mDevice.pressHome();
|
||||
test.waitForLauncherCondition("Launcher didn't start", launcher -> launcher != null);
|
||||
test.waitForState("Launcher internal state didn't switch to Home",
|
||||
() -> LauncherState.NORMAL);
|
||||
test.waitForResumed("Launcher internal state is still Background");
|
||||
// Check that we switched to home.
|
||||
test.mLauncher.getWorkspace();
|
||||
AbstractLauncherUiTest.checkDetectedLeaks(test.mLauncher, true);
|
||||
}
|
||||
|
||||
protected void clearPackageData(String pkg) throws IOException, InterruptedException {
|
||||
final CountDownLatch count = new CountDownLatch(2);
|
||||
final SimpleBroadcastReceiver broadcastReceiver =
|
||||
|
||||
@@ -22,8 +22,6 @@ import static org.junit.Assert.assertTrue;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.launcher3.LauncherState;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -38,23 +36,6 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
|
||||
initialize(this);
|
||||
}
|
||||
|
||||
public static void initialize(AbstractLauncherUiTest test) throws Exception {
|
||||
initialize(test, false);
|
||||
}
|
||||
|
||||
public static void initialize(
|
||||
AbstractLauncherUiTest test, boolean clearWorkspace) throws Exception {
|
||||
test.reinitializeLauncherData(clearWorkspace);
|
||||
test.mDevice.pressHome();
|
||||
test.waitForLauncherCondition("Launcher didn't start", launcher -> launcher != null);
|
||||
test.waitForState("Launcher internal state didn't switch to Home",
|
||||
() -> LauncherState.NORMAL);
|
||||
test.waitForResumed("Launcher internal state is still Background");
|
||||
// Check that we switched to home.
|
||||
test.mLauncher.getWorkspace();
|
||||
AbstractLauncherUiTest.checkDetectedLeaks(test.mLauncher, true);
|
||||
}
|
||||
|
||||
// Please don't add negative test cases for methods that fail only after a long wait.
|
||||
public static void expectFail(String message, Runnable action) {
|
||||
boolean failed = false;
|
||||
|
||||
@@ -18,8 +18,6 @@ package com.android.launcher3.ui.widget;
|
||||
import static android.app.PendingIntent.FLAG_MUTABLE;
|
||||
import static android.app.PendingIntent.FLAG_ONE_SHOT;
|
||||
|
||||
import static com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
|
||||
@@ -44,7 +42,6 @@ import com.android.launcher3.testcomponent.AppWidgetNoConfig;
|
||||
import com.android.launcher3.testcomponent.AppWidgetWithConfig;
|
||||
import com.android.launcher3.testcomponent.RequestPinItemActivity;
|
||||
import com.android.launcher3.ui.AbstractLauncherUiTest;
|
||||
import com.android.launcher3.ui.TaplTestsLauncher3;
|
||||
import com.android.launcher3.util.LauncherBindableItemsContainer.ItemOperator;
|
||||
import com.android.launcher3.util.Wait;
|
||||
import com.android.launcher3.util.Wait.Condition;
|
||||
@@ -77,7 +74,7 @@ public class RequestPinItemTest extends AbstractLauncherUiTest {
|
||||
super.setUp();
|
||||
mCallbackAction = UUID.randomUUID().toString();
|
||||
mShortcutId = UUID.randomUUID().toString();
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
AbstractLauncherUiTest.initialize(this);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.android.launcher3.ui.widget;
|
||||
|
||||
import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
|
||||
import static com.android.launcher3.ui.AbstractLauncherUiTest.initialize;
|
||||
import static com.android.launcher3.util.rule.TestStabilityRule.LOCAL;
|
||||
import static com.android.launcher3.util.rule.TestStabilityRule.PLATFORM_POSTSUBMIT;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.android.launcher3.ui.workspace;
|
||||
|
||||
import static com.android.launcher3.ui.TaplTestsLauncher3.initialize;
|
||||
import static com.android.launcher3.ui.AbstractLauncherUiTest.initialize;
|
||||
import static com.android.launcher3.util.TestConstants.AppNames.CHROME_APP_NAME;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@@ -36,7 +36,6 @@ import com.android.launcher3.tapl.HomeAllApps;
|
||||
import com.android.launcher3.tapl.HomeAppIcon;
|
||||
import com.android.launcher3.tapl.HomeAppIconMenuItem;
|
||||
import com.android.launcher3.ui.AbstractLauncherUiTest;
|
||||
import com.android.launcher3.ui.TaplTestsLauncher3;
|
||||
import com.android.launcher3.util.Executors;
|
||||
|
||||
import org.junit.Test;
|
||||
@@ -58,7 +57,7 @@ public class ThemeIconsTest extends AbstractLauncherUiTest {
|
||||
@Test
|
||||
public void testIconWithoutTheme() throws Exception {
|
||||
setThemeEnabled(false);
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
AbstractLauncherUiTest.initialize(this);
|
||||
|
||||
HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
|
||||
allApps.freeze();
|
||||
@@ -76,7 +75,7 @@ public class ThemeIconsTest extends AbstractLauncherUiTest {
|
||||
@Test
|
||||
public void testShortcutIconWithoutTheme() throws Exception {
|
||||
setThemeEnabled(false);
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
AbstractLauncherUiTest.initialize(this);
|
||||
|
||||
HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
|
||||
allApps.freeze();
|
||||
@@ -95,7 +94,7 @@ public class ThemeIconsTest extends AbstractLauncherUiTest {
|
||||
@Test
|
||||
public void testIconWithTheme() throws Exception {
|
||||
setThemeEnabled(true);
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
AbstractLauncherUiTest.initialize(this);
|
||||
|
||||
HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
|
||||
allApps.freeze();
|
||||
@@ -113,7 +112,7 @@ public class ThemeIconsTest extends AbstractLauncherUiTest {
|
||||
@Test
|
||||
public void testShortcutIconWithTheme() throws Exception {
|
||||
setThemeEnabled(true);
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
AbstractLauncherUiTest.initialize(this);
|
||||
|
||||
HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
|
||||
allApps.freeze();
|
||||
|
||||
@@ -35,7 +35,6 @@ import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.tapl.Workspace;
|
||||
import com.android.launcher3.ui.AbstractLauncherUiTest;
|
||||
import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
|
||||
import com.android.launcher3.ui.TaplTestsLauncher3;
|
||||
import com.android.launcher3.util.LauncherLayoutBuilder;
|
||||
import com.android.launcher3.util.TestUtil;
|
||||
|
||||
@@ -74,7 +73,7 @@ public class TwoPanelWorkspaceTest extends AbstractLauncherUiTest {
|
||||
.atWorkspace(3, -1, 0).putApp(
|
||||
"com.android.vending", "com.android.vending.AssetBrowserActivity");
|
||||
mLauncherLayout = TestUtil.setLauncherDefaultLayout(mTargetContext, builder);
|
||||
TaplTestsLauncher3.initialize(this);
|
||||
AbstractLauncherUiTest.initialize(this);
|
||||
assumeTrue(mLauncher.isTwoPanels());
|
||||
|
||||
// Pre verifying the screens
|
||||
|
||||
Reference in New Issue
Block a user