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

Commit ff97716a authored by Chris Li's avatar Chris Li
Browse files

Fix flaky WindowTokenClientControllerTest

Create a new instance for testing instead of using the app's real
instance.

The failure only happens once and likely to be an isolated one. Likely to be a side effect of using the application's real instance.

Fix: 293161156
Test: atest FrameworksCoreTests:WindowTokenClientControllerTest
Change-Id: I77f0e34066c61f1f5aaf95551e6d58cf96d112b4
parent 6927452e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -73,6 +73,12 @@ public class WindowTokenClientController {
        }
    }

    /** Creates a new instance for test only. */
    @VisibleForTesting
    public static WindowTokenClientController createInstanceForTesting() {
        return new WindowTokenClientController();
    }

    private WindowTokenClientController() {}

    /**
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public class WindowTokenClientControllerTest {
        mOriginalWindowManagerService = WindowManagerGlobal.getWindowManagerService();
        WindowManagerGlobal.overrideWindowManagerServiceForTesting(mWindowManagerService);
        doReturn(mClientToken).when(mWindowTokenClient).asBinder();
        mController = spy(WindowTokenClientController.getInstance());
        mController = spy(WindowTokenClientController.createInstanceForTesting());
    }

    @After