android-test icon indicating copy to clipboard operation
android-test copied to clipboard

Only drain main looper when it is paused.

Open copybara-service[bot] opened this issue 1 year ago • 0 comments

Only drain main looper when it is paused.

ControlledLooper.drainMainThreadUntilIdle was created so Robolectric can manually execute tasks when main looper is paused.

Now with the introduction of INSTRUMENTATION_TEST looper mode with a free running looper, it doesn't make sense to always idle the main looper, and could lead to deviation of behavior between a test run with Robolectric INSTRUMENTATION_TEST mode and real android.

This commit changes drainMainThreadUntilIdle so its a no-op if main looper is not paused.

copybara-service[bot] avatar Dec 07 '24 05:12 copybara-service[bot]