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

Commit c5c590d2 authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

Fix BackProgressAnimatorTest flake

Bug: 387459439
Test: BackProgressAnimatorTest
Flag: EXEMPT test-only bugfix
Change-Id: I7d900dcc705558d4b4b9299c2fcdbbc189df1386
parent 6a3bd422
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -187,14 +187,14 @@ public class BackProgressAnimatorTest {
        mTargetProgressCalled.await(1, TimeUnit.SECONDS);
        assertNotNull(mReceivedBackEvent);

        // Trigger back invoked animation
        CountDownLatch finishCallbackCalled = new CountDownLatch(1);
        InstrumentationRegistry.getInstrumentation().runOnMainSync(
                () -> mProgressAnimator.onBackInvoked(finishCallbackCalled::countDown));

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

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