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

Commit ffcaf651 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add unit test to verify adding windowId to surface"

parents e97c2947 7b47d143
Loading
Loading
Loading
Loading
+20 −0
Original line number Original line Diff line number Diff line
@@ -705,6 +705,26 @@ public class AccessibilityWindowManagerTest {
        assertTrue(displayList.equals(mExpectedDisplayList));
        assertTrue(displayList.equals(mExpectedDisplayList));
    }
    }


    @Test
    public void setAccessibilityWindowIdToSurfaceMetadata()
            throws RemoteException {
        final IWindow token = addAccessibilityInteractionConnection(Display.DEFAULT_DISPLAY,
                true, USER_SYSTEM_ID);
        int windowId = -1;
        for (int i = 0; i < mA11yWindowTokens.size(); i++) {
            if (mA11yWindowTokens.valueAt(i).equals(token)) {
                windowId = mA11yWindowTokens.keyAt(i);
            }
        }
        assertNotEquals("Returned token is not found in mA11yWindowTokens", -1, windowId);
        verify(mMockWindowManagerInternal, times(1)).setAccessibilityIdToSurfaceMetadata(
                token.asBinder(), windowId);

        mA11yWindowManager.removeAccessibilityInteractionConnection(token);
        verify(mMockWindowManagerInternal, times(1)).setAccessibilityIdToSurfaceMetadata(
                token.asBinder(), -1);
    }

    private void startTrackingPerDisplay(int displayId) throws RemoteException {
    private void startTrackingPerDisplay(int displayId) throws RemoteException {
        ArrayList<WindowInfo> windowInfosForDisplay = new ArrayList<>();
        ArrayList<WindowInfo> windowInfosForDisplay = new ArrayList<>();
        // Adds RemoteAccessibilityConnection into AccessibilityWindowManager, and copy
        // Adds RemoteAccessibilityConnection into AccessibilityWindowManager, and copy