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
This commit is contained in:
@@ -73,6 +73,12 @@ public class WindowTokenClientController {
|
||||
}
|
||||
}
|
||||
|
||||
/** Creates a new instance for test only. */
|
||||
@VisibleForTesting
|
||||
public static WindowTokenClientController createInstanceForTesting() {
|
||||
return new WindowTokenClientController();
|
||||
}
|
||||
|
||||
private WindowTokenClientController() {}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user