diff --git a/tests/src/com/android/launcher3/util/rule/FailureWatcher.java b/tests/src/com/android/launcher3/util/rule/FailureWatcher.java index 4b867a7623..cdda0f0dcc 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 androidx.test.uiautomator.UiDevice; 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 @@ import java.io.IOException; 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 @@ public class FailureWatcher extends TestWatcher { 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; - } - } - }; - } }