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

Commit 1644a438 authored by Chavi Weingarten's avatar Chavi Weingarten
Browse files

Dump window state when test fails

Test: SurfaceControlViewHostTests
Bug: 313674425
Change-Id: I47a1f157f4e2075701ae714705dca21f79e1a3f9
parent 57a83348
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ public class SurfaceControlViewHostTests {

        wasVisible = waitForWindowVisible(mView2);
        if (!wasVisible) {
            dumpWindowsOnScreen(TAG, "requestFocusWithMultipleWindows");
            dumpWindowsOnScreen(TAG, "requestFocusWithMultipleWindows-not visible");
        }
        assertTrue("Failed to wait for view2", wasVisible);

@@ -145,11 +145,21 @@ public class SurfaceControlViewHostTests {

        WindowManagerGlobal.getWindowSession().grantEmbeddedWindowFocus(window,
                mScvh1.getInputTransferToken(), true);
        assertTrue("Failed to gain focus for view1", waitForWindowFocus(mView1, true));

        boolean gainedFocus = waitForWindowFocus(mView1, true);
        if (!gainedFocus) {
            dumpWindowsOnScreen(TAG, "requestFocusWithMultipleWindows-view1 not focus");
        }
        assertTrue("Failed to gain focus for view1", gainedFocus);

        WindowManagerGlobal.getWindowSession().grantEmbeddedWindowFocus(window,
                mScvh2.getInputTransferToken(), true);
        assertTrue("Failed to gain focus for view2", waitForWindowFocus(mView2, true));

        gainedFocus = waitForWindowFocus(mView2, true);
        if (!gainedFocus) {
            dumpWindowsOnScreen(TAG, "requestFocusWithMultipleWindows-view2 not focus");
        }
        assertTrue("Failed to gain focus for view2", gainedFocus);
    }

    private static class TestWindowlessWindowManager extends WindowlessWindowManager {