Loading tests/src/com/android/launcher3/ui/TaplTestsLauncher3Test.java +3 −1 Original line number Diff line number Diff line Loading @@ -21,8 +21,9 @@ import static org.junit.Assert.assertNotNull; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import com.android.launcher3.Launcher; import com.android.launcher3.util.rule.ScreenRecordRule.KeepRecordOnSuccess; import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import org.junit.Test; import org.junit.runner.RunWith; Loading @@ -31,6 +32,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class TaplTestsLauncher3Test extends AbstractLauncherUiTest<Launcher> { @KeepRecordOnSuccess @ScreenRecord // b/322823478 @Test public void testDevicePressMenu() throws Exception { Loading tests/src/com/android/launcher3/ui/TaplWorkProfileTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import com.android.launcher3.allapps.WorkPausedCard; import com.android.launcher3.allapps.WorkProfileManager; import com.android.launcher3.tapl.LauncherInstrumentation; import com.android.launcher3.util.TestUtil; import com.android.launcher3.util.rule.ScreenRecordRule.KeepRecordOnSuccess; import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import com.android.launcher3.util.rule.TestStabilityRule.Stability; Loading Loading @@ -196,6 +197,7 @@ public class TaplWorkProfileTest extends AbstractLauncherUiTest<Launcher> { } @KeepRecordOnSuccess @ScreenRecord // b/322823478 @Test public void testEdu() { Loading tests/src/com/android/launcher3/util/rule/ScreenRecordRule.java +14 −1 Original line number Diff line number Diff line Loading @@ -49,6 +49,9 @@ public class ScreenRecordRule implements TestRule { return base; } final Boolean keepRecordOnSuccess = description.getAnnotation(KeepRecordOnSuccess.class) != null; return new Statement() { @Override public void evaluate() throws Throwable { Loading @@ -70,7 +73,7 @@ public class ScreenRecordRule implements TestRule { device.executeShellCommand("kill -INT " + screenRecordPid); Log.e(TAG, "Screenrecord captured at: " + outputFile); output.close(); if (success) { if (success && !keepRecordOnSuccess) { automation.executeShellCommand("rm " + outputFile); } } Loading @@ -85,4 +88,14 @@ public class ScreenRecordRule implements TestRule { @Target(ElementType.METHOD) public @interface ScreenRecord { } /** * Interface to indicate that we should keep the screen record even if the test succeeds, use * sparingly since it uses a lof of memory. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface KeepRecordOnSuccess { } } Loading
tests/src/com/android/launcher3/ui/TaplTestsLauncher3Test.java +3 −1 Original line number Diff line number Diff line Loading @@ -21,8 +21,9 @@ import static org.junit.Assert.assertNotNull; import androidx.test.filters.LargeTest; import androidx.test.runner.AndroidJUnit4; import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import com.android.launcher3.Launcher; import com.android.launcher3.util.rule.ScreenRecordRule.KeepRecordOnSuccess; import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import org.junit.Test; import org.junit.runner.RunWith; Loading @@ -31,6 +32,7 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class TaplTestsLauncher3Test extends AbstractLauncherUiTest<Launcher> { @KeepRecordOnSuccess @ScreenRecord // b/322823478 @Test public void testDevicePressMenu() throws Exception { Loading
tests/src/com/android/launcher3/ui/TaplWorkProfileTest.java +2 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import com.android.launcher3.allapps.WorkPausedCard; import com.android.launcher3.allapps.WorkProfileManager; import com.android.launcher3.tapl.LauncherInstrumentation; import com.android.launcher3.util.TestUtil; import com.android.launcher3.util.rule.ScreenRecordRule.KeepRecordOnSuccess; import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import com.android.launcher3.util.rule.TestStabilityRule.Stability; Loading Loading @@ -196,6 +197,7 @@ public class TaplWorkProfileTest extends AbstractLauncherUiTest<Launcher> { } @KeepRecordOnSuccess @ScreenRecord // b/322823478 @Test public void testEdu() { Loading
tests/src/com/android/launcher3/util/rule/ScreenRecordRule.java +14 −1 Original line number Diff line number Diff line Loading @@ -49,6 +49,9 @@ public class ScreenRecordRule implements TestRule { return base; } final Boolean keepRecordOnSuccess = description.getAnnotation(KeepRecordOnSuccess.class) != null; return new Statement() { @Override public void evaluate() throws Throwable { Loading @@ -70,7 +73,7 @@ public class ScreenRecordRule implements TestRule { device.executeShellCommand("kill -INT " + screenRecordPid); Log.e(TAG, "Screenrecord captured at: " + outputFile); output.close(); if (success) { if (success && !keepRecordOnSuccess) { automation.executeShellCommand("rm " + outputFile); } } Loading @@ -85,4 +88,14 @@ public class ScreenRecordRule implements TestRule { @Target(ElementType.METHOD) public @interface ScreenRecord { } /** * Interface to indicate that we should keep the screen record even if the test succeeds, use * sparingly since it uses a lof of memory. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface KeepRecordOnSuccess { } }