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

Commit 1dbb0e45 authored by Austin Borger's avatar Austin Borger Committed by Automerger Merge Worker
Browse files

Merge "De-flake testSystemDrivenInsetsAnimationLoggingListener_onReady" into...

Merge "De-flake testSystemDrivenInsetsAnimationLoggingListener_onReady" into tm-qpr-dev am: a44bc9ca

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23815334



Change-Id: I3bd961cf3bd5930ce784a9cd6715c51019e6e61c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 15d80074 a44bc9ca
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -237,17 +237,22 @@ public class InsetsControllerTest {

    @Test
    public void testSystemDrivenInsetsAnimationLoggingListener_onReady() {
        var loggingListener = mock(WindowInsetsAnimationControlListener.class);

        prepareControls();
        // only the original thread that created view hierarchy can touch its views
        InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
            WindowInsetsAnimationControlListener loggingListener =
                    mock(WindowInsetsAnimationControlListener.class);
            mController.setSystemDrivenInsetsAnimationLoggingListener(loggingListener);
            mController.getSourceConsumer(ITYPE_IME).onWindowFocusGained(true);
            // since there is no focused view, forcefully make IME visible.
            mController.show(Type.ime(), true /* fromIme */);
            verify(loggingListener).onReady(notNull(), anyInt());
            mController.show(WindowInsets.Type.ime(), true /* fromIme */);
            // When using the animation thread, this must not invoke onReady()
            mViewRoot.getView().getViewTreeObserver().dispatchOnPreDraw();
        });
        // Wait for onReady() being dispatched on the animation thread.
        InsetsAnimationThread.get().getThreadHandler().runWithScissors(() -> {}, 500);

        verify(loggingListener).onReady(notNull(), anyInt());
    }

    @Test