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

Commit c1f3e378 authored by Yunfan Chen's avatar Yunfan Chen
Browse files

Fixed flaky testTaskChangeCallbacks and promote three tests to presubmit

The testTaskChangeCallbacks was flaky because the callback onTaskRemoved
can be called after finishAndRemoveTask is called. However, the original
test will assert the callback was not called after calling the
finishAndRemoveTask and wait for the callback afterwards. To fix it,
only ensure the callback was not called before the finishAndRemoveTask
get called.

The other three tests are no longer flaky and promote them to
pre-submit.

Test: atest TaskStackChangedListenerTest
Bug: 123654474
Bug: 74078662
Change-Id: Ie064ae00a4b2493e5aa0f47e1418ce2d25b503de
parent 756bbab5
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ import android.util.SparseBooleanArray;
import android.view.IRecentsAnimationRunner;
import android.view.SurfaceControl;

import androidx.test.filters.FlakyTest;
import androidx.test.filters.SmallTest;

import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback;
@@ -113,7 +112,6 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
    }

    @Test
    @FlakyTest(bugId = 117117823)
    public void testIncludedApps_expectTargetAndVisible() {
        mWm.setRecentsAnimationController(mController);
        final AppWindowToken homeAppWindow = createAppWindowToken(mDisplayContent,
+1 −3
Original line number Diff line number Diff line
@@ -100,7 +100,6 @@ public class TaskStackChangedListenerTest {
    }

    @Test
    @FlakyTest(detail = "Promote to presubmit when shown to be stable.")
    public void testTaskDescriptionChanged() throws Exception {
        final Object[] params = new Object[2];
        final CountDownLatch latch = new CountDownLatch(1);
@@ -133,7 +132,6 @@ public class TaskStackChangedListenerTest {
    }

    @Test
    @FlakyTest(detail = "Promote to presubmit when shown to be stable.")
    public void testActivityRequestedOrientationChanged() throws Exception {
        final int[] params = new int[2];
        final CountDownLatch latch = new CountDownLatch(1);
@@ -214,6 +212,7 @@ public class TaskStackChangedListenerTest {

        // Test for onTaskRemovalStarted.
        assertEquals(1, taskRemovalStartedLatch.getCount());
        assertEquals(1, taskRemovedLatch.getCount());
        activity.finishAndRemoveTask();
        waitForCallback(taskRemovalStartedLatch);
        // onTaskRemovalStarted happens before the activity's window is removed.
@@ -221,7 +220,6 @@ public class TaskStackChangedListenerTest {
        assertEquals(id, params[0]);

        // Test for onTaskRemoved.
        assertEquals(1, taskRemovedLatch.getCount());
        waitForCallback(taskRemovedLatch);
        assertEquals(id, params[0]);
        waitForCallback(onDetachedFromWindowLatch);