Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa01b2e7 authored by Schneider Victor-tulias's avatar Schneider Victor-tulias
Browse files

Separate TaplStartLauncherViaGestureTests test cases to prevent timeouts

Flag: EXEMPT test fix
Fixes: 348476703
Test: TaplStartLauncherViaGestureTests
Change-Id: I083bbf67b3079fce8fed3a3d6b4ea477e4fef300
parent acc4a81a
Loading
Loading
Loading
Loading
+42 −11
Original line number Diff line number Diff line
@@ -31,6 +31,10 @@ public class TaplStartLauncherViaGestureTests extends AbstractQuickStepTest {

    static final int STRESS_REPEAT_COUNT = 10;

    private enum TestCase {
        TO_HOME, TO_OVERVIEW,
    }

    @Override
    @Before
    public void setUp() throws Exception {
@@ -41,28 +45,55 @@ public class TaplStartLauncherViaGestureTests extends AbstractQuickStepTest {
    }

    @Test
    @NavigationModeSwitch
    @NavigationModeSwitch(mode = NavigationModeSwitchRule.Mode.THREE_BUTTON)
    public void testStressPressHome() {
        for (int i = 0; i < STRESS_REPEAT_COUNT; ++i) {
            // Destroy Launcher activity.
            closeLauncherActivity();
        runTest(TestCase.TO_HOME);
    }

            // The test action.
            mLauncher.goHome();
    @Test
    @NavigationModeSwitch(mode = NavigationModeSwitchRule.Mode.ZERO_BUTTON)
    public void testStressSwipeHome() {
        runTest(TestCase.TO_HOME);
    }

    @Test
    @NavigationModeSwitch(mode = NavigationModeSwitchRule.Mode.THREE_BUTTON)
    public void testStressPressOverview() {
        runTest(TestCase.TO_OVERVIEW);
    }

    @Test
    @NavigationModeSwitch
    @NavigationModeSwitch(mode = NavigationModeSwitchRule.Mode.ZERO_BUTTON)
    public void testStressSwipeToOverview() {
        runTest(TestCase.TO_OVERVIEW);
    }

    private void runTest(TestCase testCase) {
        for (int i = 0; i < STRESS_REPEAT_COUNT; ++i) {
            // Destroy Launcher activity.
            closeLauncherActivity();

            // The test action.
            switch (testCase) {
                case TO_OVERVIEW:
                    mLauncher.getLaunchedAppState().switchToOverview();
                    break;
                case TO_HOME:
                    mLauncher.goHome();
                    break;
                default:
                    throw new IllegalStateException("Cannot run test case: " + testCase);
            }
        }
        switch (testCase) {
            case TO_OVERVIEW:
                closeLauncherActivity();
                mLauncher.goHome();
                break;
            case TO_HOME:
            default:
                // No-Op
                break;
        }
    }
}