mirror of
https://github.com/samsonjs/media.git
synced 2026-04-04 11:05:47 +00:00
Interrupt the test thread for uncaught errors
This makes assertion errors in code running on the Looper less easy to miss. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=184294290
This commit is contained in:
parent
451721d4a7
commit
0b2497799f
1 changed files with 8 additions and 1 deletions
|
|
@ -117,7 +117,14 @@ public final class RobolectricUtil {
|
|||
}
|
||||
}
|
||||
if (!isRemoved) {
|
||||
target.dispatchMessage(pendingMessage.message);
|
||||
try {
|
||||
target.dispatchMessage(pendingMessage.message);
|
||||
} catch (Throwable t) {
|
||||
// Interrupt the main thread to terminate the test. Robolectric's HandlerThread will
|
||||
// print the rethrown error to standard output.
|
||||
Looper.getMainLooper().getThread().interrupt();
|
||||
throw t;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Util.SDK_INT >= 21) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue