android-test
android-test copied to clipboard
Only drain main looper when it is paused.
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.