diff options
| -rw-r--r-- | core/tests/coretests/src/android/os/HandlerThreadTest.java | 2 | ||||
| -rw-r--r-- | ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java | 15 |
2 files changed, 13 insertions, 4 deletions
diff --git a/core/tests/coretests/src/android/os/HandlerThreadTest.java b/core/tests/coretests/src/android/os/HandlerThreadTest.java index 1ad71da7c2d1..32378127d897 100644 --- a/core/tests/coretests/src/android/os/HandlerThreadTest.java +++ b/core/tests/coretests/src/android/os/HandlerThreadTest.java @@ -126,7 +126,7 @@ public class HandlerThreadTest { public void testUncaughtExceptionFails() throws Exception { // For the moment we can only test Ravenwood; on a physical device uncaught exceptions // are detected, but reported as test failures at a higher level where we can't inspect - Assume.assumeTrue(RavenwoodRule.isOnRavenwood()); + Assume.assumeTrue(false); // TODO: re-enable mThrown.expect(IllegalStateException.class); final HandlerThread thread = new HandlerThread("HandlerThreadTest"); diff --git a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java index 85fa65ac705c..7b5932b42b84 100644 --- a/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java +++ b/ravenwood/junit-impl-src/android/platform/test/ravenwood/RavenwoodRuleImpl.java @@ -58,6 +58,11 @@ public class RavenwoodRuleImpl { private static ScheduledFuture<?> sPendingTimeout; /** + * When enabled, attempt to detect uncaught exceptions from background threads. + */ + private static final boolean ENABLE_UNCAUGHT_EXCEPTION_DETECTION = false; + + /** * When set, an unhandled exception was discovered (typically on a background thread), and we * capture it here to ensure it's reported as a test failure. */ @@ -75,8 +80,10 @@ public class RavenwoodRuleImpl { } public static void init(RavenwoodRule rule) { - maybeThrowPendingUncaughtException(false); - Thread.setDefaultUncaughtExceptionHandler(sUncaughtExceptionHandler); + if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) { + maybeThrowPendingUncaughtException(false); + Thread.setDefaultUncaughtExceptionHandler(sUncaughtExceptionHandler); + } RuntimeInit.redirectLogStreams(); @@ -129,7 +136,9 @@ public class RavenwoodRuleImpl { android.os.Binder.reset$ravenwood(); android.os.Process.reset$ravenwood(); - maybeThrowPendingUncaughtException(true); + if (ENABLE_UNCAUGHT_EXCEPTION_DETECTION) { + maybeThrowPendingUncaughtException(true); + } } public static void logTestRunner(String label, Description description) { |