Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block UiController#loopMainThreadUntilIdle on registered idling resources being idle. #7148

Merged
merged 1 commit into from Mar 22, 2022

Conversation

copybara-service[bot]
Copy link

Block UiController#loopMainThreadUntilIdle on registered idling resources being idle.

When using the paused looper collect the registered idling resources and wait for them to become idle before returning from loopMainThreadUntilIdle. Because Robolectric runs on the same thread as the main looper we need to continually loop the main looper until all idling resources transition to idle state.

To do this we'll first drain the looper of currently scheduled tasks and then collect all of the idling resources that are not reporting idle. While this list is not empty (we need to loop as one idling resource becoming idle may cause another idling resource to become not idle, we need to observe them all idle at once) wait on the message queue to receive new messages up to the error timeout.

Issue: #4807

…ources being idle.

When using the paused looper collect the registered idling resources and wait for them to become idle before returning from `loopMainThreadUntilIdle`. Because Robolectric runs on the same thread as the main looper we need to continually loop the main looper until all idling resources transition to idle state.

To do this we'll first drain the looper of currently scheduled tasks and then collect all of the idling resources that are not reporting idle. While this list is not empty (we need to loop as one idling resource becoming idle may cause another idling resource to become not idle, we need to observe them all idle at once) wait on the message queue to receive new messages up to the error timeout.

Issue: #4807
PiperOrigin-RevId: 436334339
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant