Not trying to disable running tests after a failed finalizer
Turns out there is no good way to know that an exception comes from a
finalizer.
Change-Id: I0cb2c518d0b7dc20ad7734ed46ba6af1b8a9d36e
diff --git a/tests/src/com/android/launcher3/util/rule/FailureWatcher.java b/tests/src/com/android/launcher3/util/rule/FailureWatcher.java
index 4b867a7..cdda0f0 100644
--- a/tests/src/com/android/launcher3/util/rule/FailureWatcher.java
+++ b/tests/src/com/android/launcher3/util/rule/FailureWatcher.java
@@ -8,7 +8,6 @@
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -16,7 +15,6 @@
public class FailureWatcher extends TestWatcher {
private static final String TAG = "FailureWatcher";
- private static boolean sHadFailedTestDeinitialization;
final private UiDevice mDevice;
public FailureWatcher(UiDevice device) {
@@ -62,35 +60,4 @@
device.takeScreenshot(new File(pathname));
}
-
- @Override
- public Statement apply(Statement base, Description description) {
- return new Statement() {
-
- @Override
- public void evaluate() throws Throwable {
- if (sHadFailedTestDeinitialization) {
- Log.d(TAG, "Skipping due to a recent test deinitialization failure: " +
- description.getDisplayName());
- return;
- }
-
- try {
- FailureWatcher.super.apply(base, description).evaluate();
- } catch (Throwable e) {
- final String stackTrace = Log.getStackTraceString(e);
- if (!stackTrace.contains(
- "androidx.test.internal.runner.junit4.statement.RunBefores.evaluate")) {
- // Test failed to deinitialize. Since the global state is probably
- // corrupted, won't execute other tests.
- Log.d(TAG,
- "Detected an exception from test finalizer, will skip further "
- + "tests: " + stackTrace);
- sHadFailedTestDeinitialization = true;
- }
- throw e;
- }
- }
- };
- }
}