Index: base/test/android/javatests/src/org/chromium/base/test/BaseJUnit4ClassRunner.java |
diff --git a/base/test/android/javatests/src/org/chromium/base/test/BaseJUnit4ClassRunner.java b/base/test/android/javatests/src/org/chromium/base/test/BaseJUnit4ClassRunner.java |
index 123545294772b3b0c7c667946ef031d1110dde25..080654f8bb00a9c3d1fea22f26aeae3ea3d72150 100644 |
--- a/base/test/android/javatests/src/org/chromium/base/test/BaseJUnit4ClassRunner.java |
+++ b/base/test/android/javatests/src/org/chromium/base/test/BaseJUnit4ClassRunner.java |
@@ -12,6 +12,7 @@ import android.support.test.internal.util.AndroidRunnerParams; |
import org.junit.runner.notification.RunNotifier; |
import org.junit.runners.model.FrameworkMethod; |
import org.junit.runners.model.InitializationError; |
+import org.junit.runners.model.Statement; |
import org.chromium.base.CollectionUtil; |
import org.chromium.base.test.BaseTestResult.PreTestHook; |
@@ -156,4 +157,12 @@ public class BaseJUnit4ClassRunner extends AndroidJUnit4ClassRunner { |
} |
return false; |
} |
+ |
+ /* |
+ * Overriding this method to take screenshot of failure before tear down functions are run. |
+ */ |
+ @Override |
+ protected Statement withAfters(FrameworkMethod method, Object test, Statement base) { |
+ return super.withAfters(method, test, new ScreenshotOnFailureStatement(base)); |
+ } |
} |