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

Commit 303654d9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix BackProgressAnimatorTest flake" into main

parents 848ed09b c5c590d2
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -187,14 +187,14 @@ public class BackProgressAnimatorTest {
        mTargetProgressCalled.await(1, TimeUnit.SECONDS);
        mTargetProgressCalled.await(1, TimeUnit.SECONDS);
        assertNotNull(mReceivedBackEvent);
        assertNotNull(mReceivedBackEvent);


        // Trigger back invoked animation
        CountDownLatch finishCallbackCalled = new CountDownLatch(1);
        CountDownLatch finishCallbackCalled = new CountDownLatch(1);
        InstrumentationRegistry.getInstrumentation().runOnMainSync(
        // Trigger back invoked animation and remove onBackInvoked finishCallback (while progress
                () -> mProgressAnimator.onBackInvoked(finishCallbackCalled::countDown));
        // is still animating to 1)

        InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
        // remove onBackCancelled finishCallback (while progress is still animating to 0)
                    mProgressAnimator.onBackInvoked(finishCallbackCalled::countDown);
        InstrumentationRegistry.getInstrumentation().runOnMainSync(
                    mProgressAnimator.removeOnBackInvokedFinishCallback();
                () -> mProgressAnimator.removeOnBackInvokedFinishCallback());
                }
        );


        // call reset (which triggers the finishCallback invocation, if one is present)
        // call reset (which triggers the finishCallback invocation, if one is present)
        InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> mProgressAnimator.reset());
        InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> mProgressAnimator.reset());