Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(993)

Unified Diff: base/test/android/javatests/src/org/chromium/base/test/ScreenshotOnFailureStatement.java

Issue 2954183002: Attempt to prevent screenshot failures from preventing original failure stack. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/android/javatests/src/org/chromium/base/test/ScreenshotOnFailureStatement.java
diff --git a/base/test/android/javatests/src/org/chromium/base/test/ScreenshotOnFailureStatement.java b/base/test/android/javatests/src/org/chromium/base/test/ScreenshotOnFailureStatement.java
index ac60fd556361c5c2e878fb2d80f46ef065118bea..397e8abf13799b955511155fee513bfabb92a0e0 100644
--- a/base/test/android/javatests/src/org/chromium/base/test/ScreenshotOnFailureStatement.java
+++ b/base/test/android/javatests/src/org/chromium/base/test/ScreenshotOnFailureStatement.java
@@ -52,7 +52,14 @@ public class ScreenshotOnFailureStatement extends Statement {
return;
}
- UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
+ UiDevice uiDevice = null;
+ try {
+ uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
+ } catch (RuntimeException ex) {
+ Log.d(TAG, "Failed to initialize UiDevice", ex);
+ return;
+ }
+
File screenshotFile = new File(screenshotFilePath);
File screenshotDir = screenshotFile.getParentFile();
if (screenshotDir == null) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698