Fix AccessibilityManagerServiceTest

AccessibilityServiceConnection would send a message, and notify all
IAccessibilityServiceClient in the main thread. The message may not
be sent immediately. Using waitForIdleSync before verify to ensure
the target method is invoked.

Bug: 150345707
Test: atest FrameworksServicesTests:com.android.server.accessibility
Test: atest --rerun-until-failure 100 \
      AccessibilityManagerServiceTest#testOnSystemActionsChanged
Change-Id: I6a796772e00f55d6523e1f12703c17b0fd931f9c
This commit is contained in:
Jackal Guo
2020-02-27 14:43:29 +08:00
parent abe2fed8b0
commit e40dc61e87

View File

@@ -189,6 +189,7 @@ public class AccessibilityManagerServiceTest extends AndroidTestCase {
public void testOnSystemActionsChanged() throws Exception {
setupAccessibilityServiceConnection();
mA11yms.notifySystemActionsChangedLocked(mUserState);
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
verify(mMockServiceClient).onSystemActionsChanged();
}
}