From 5bde3f8573c4a6a922ad171ea1eb7493690a524b Mon Sep 17 00:00:00 2001 From: Hui Kang Date: Tue, 23 May 2023 13:33:00 -0700 Subject: [PATCH 1/2] [4/7]Add PlatinumTest annotation to tests These tests are in the audited platinum suite (go/platinum-audit-flake) Test: make Bug: 283409062 Change-Id: Id438fde00b2a6e31694bef125d20637af514b9da --- .../src/com/android/quickstep/TaplTestsQuickstep.java | 11 +++++++++++ .../com/android/launcher3/ui/TaplTestsLauncher3.java | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index 77c76d9c77..d5136dded9 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -26,6 +26,7 @@ import static org.junit.Assume.assumeFalse; import static org.junit.Assume.assumeTrue; import android.content.Intent; +import android.platform.test.annotations.PlatinumTest; import androidx.test.filters.LargeTest; import androidx.test.platform.app.InstrumentationRegistry; @@ -99,6 +100,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @Test @NavigationModeSwitch @PortraitLandscape + @PlatinumTest(focusArea = "launcher") public void testWorkspaceSwitchToAllApps() { assertNotNull("switchToAllApps() returned null", mLauncher.getWorkspace().switchToAllApps()); @@ -108,6 +110,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @Test @PortraitLandscape + @PlatinumTest(focusArea = "launcher") public void testOverview() throws Exception { startTestAppsWithCheck(); // mLauncher.pressHome() also tests an important case of pressing home while in background. @@ -175,6 +178,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @NavigationModeSwitch @PortraitLandscape @ScreenRecord // b/195673272 + @PlatinumTest(focusArea = "launcher") public void testOverviewActions() throws Exception { // Experimenting for b/165029151: final Overview overview = mLauncher.goHome().switchToOverview(); @@ -209,6 +213,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @NavigationModeSwitch @PortraitLandscape @ScreenRecord // b/238461765 + @PlatinumTest(focusArea = "launcher") public void testSwitchToOverview() throws Exception { startTestAppsWithCheck(); assertNotNull("Workspace.switchToOverview() returned null", @@ -221,6 +226,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @Test @NavigationModeSwitch @PortraitLandscape + @PlatinumTest(focusArea = "launcher") public void testBackground() throws Exception { startAppFast(CALCULATOR_APP_PACKAGE); final LaunchedAppState launchedAppState = getAndAssertLaunchedApp(); @@ -275,6 +281,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @Test @NavigationModeSwitch @PortraitLandscape + @PlatinumTest(focusArea = "launcher") public void testQuickSwitchFromApp() throws Exception { startTestActivity(2); startTestActivity(3); @@ -304,6 +311,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @Test @ScreenRecord // b/242163205 + @PlatinumTest(focusArea = "launcher") public void testQuickSwitchToPreviousAppForTablet() throws Exception { assumeTrue(mLauncher.isTablet()); startTestActivity(2); @@ -335,6 +343,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @Test @NavigationModeSwitch @PortraitLandscape + @PlatinumTest(focusArea = "launcher") public void testQuickSwitchFromHome() throws Exception { startTestActivity(2); mLauncher.goHome().quickSwitchToPreviousApp(); @@ -346,6 +355,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @Test @PortraitLandscape @NavigationModeSwitch + @PlatinumTest(focusArea = "launcher") public void testPressBack() throws Exception { InstrumentationRegistry.getInstrumentation().getUiAutomation().adoptShellPermissionIdentity( READ_DEVICE_CONFIG_PERMISSION); @@ -364,6 +374,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @Test @PortraitLandscape @TaskbarModeSwitch(mode = PERSISTENT) + @PlatinumTest(focusArea = "launcher") public void testOverviewForTablet() throws Exception { assumeTrue(mLauncher.isTablet()); diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java index 9d9fdc9c9f..04a32b9c4a 100644 --- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java @@ -32,6 +32,7 @@ import android.content.Intent; import android.graphics.Point; import android.os.SystemClock; import android.platform.test.annotations.IwTest; +import android.platform.test.annotations.PlatinumTest; import android.util.Log; import androidx.test.filters.FlakyTest; @@ -350,6 +351,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { @Test @PortraitLandscape + @PlatinumTest(focusArea = "launcher") public void testLaunchMenuItem() throws Exception { final AllApps allApps = mLauncher.getWorkspace().switchToAllApps(); allApps.freeze(); @@ -394,6 +396,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { @Test @PortraitLandscape + @PlatinumTest(focusArea = "launcher") public void testDragShortcut() throws Throwable { // 1. Open all apps and wait for load complete. // 2. Find the app and long press it to show shortcuts. @@ -423,6 +426,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { @PortraitLandscape @ScreenRecord @Ignore // b/233075289 + @PlatinumTest(focusArea = "launcher") public void testDragToFolder() { // TODO: add the use case to drag an icon to an existing folder. Currently it either fails // on tablets or phones due to difference in resolution. @@ -469,6 +473,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { @Test @PortraitLandscape + @PlatinumTest(focusArea = "launcher") public void testDragAndCancelAppIcon() { final HomeAppIcon homeAppIcon = createShortcutInCenterIfNotExist(GMAIL_APP_NAME); Point positionBeforeDrag = @@ -511,6 +516,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { @Ignore("b/256615483") @Test @PortraitLandscape + @PlatinumTest(focusArea = "launcher") public void testUninstallFromWorkspace() throws Exception { installDummyAppAndWaitForUIUpdate(); try { @@ -524,6 +530,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { @Test @ScreenRecord // b/258071914 @PortraitLandscape + @PlatinumTest(focusArea = "launcher") public void testUninstallFromAllApps() throws Exception { installDummyAppAndWaitForUIUpdate(); try { @@ -539,6 +546,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { @Test @PortraitLandscape + @PlatinumTest(focusArea = "launcher") public void testDragAppIconToWorkspaceCell() throws Exception { long startTime, endTime, elapsedTime; Point[] targets = getCornersAndCenterPositions(); @@ -574,6 +582,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { @Test @ScreenRecord // b/241821721 + @PlatinumTest(focusArea = "launcher") public void getIconsPosition_afterIconRemoved_notContained() throws IOException { Point[] gridPositions = getCornersAndCenterPositions(); createShortcutIfNotExist(STORE_APP_NAME, gridPositions[0]); @@ -600,6 +609,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { @Test @PortraitLandscape + @PlatinumTest(focusArea = "launcher") public void testDragShortcutToWorkspaceCell() throws Exception { Point[] targets = getCornersAndCenterPositions(); From 0928ab08116d313c187450000a1c577388b24199 Mon Sep 17 00:00:00 2001 From: Hui Kang Date: Tue, 23 May 2023 18:01:14 -0700 Subject: [PATCH 2/2] [3/7]Add PlatinumTest annotation to tests These tests already have IwTest annotation. The IwTest tests will be merged with platinum tests using the PlatinumTest annotation. The IwTest annotation will be deprecated and removed. Test: make Bug: 283409062 Change-Id: Idee826a228070bdad26e9520c7b59c4df970f717 --- tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java | 2 ++ tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java index 04a32b9c4a..9676cb3e2a 100644 --- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java @@ -238,6 +238,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { false /* tapRight */); } + @PlatinumTest(focusArea = "launcher") @IwTest(focusArea = "launcher") @Test @ScreenRecord // b/202433017 @@ -372,6 +373,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { } } + @PlatinumTest(focusArea = "launcher") @IwTest(focusArea = "launcher") @Test @PortraitLandscape diff --git a/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java index 78a006e11e..6d858e06e7 100644 --- a/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java +++ b/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import android.platform.test.annotations.IwTest; +import android.platform.test.annotations.PlatinumTest; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; @@ -48,6 +49,7 @@ public class AddWidgetTest extends AbstractLauncherUiTest { @Rule public ShellCommandRule mGrantWidgetRule = ShellCommandRule.grantWidgetBind(); + @PlatinumTest(focusArea = "launcher") @IwTest(focusArea="launcher") @Test @PortraitLandscape