Logging for artifacts not being created

Bug: 196820244
Test: presubmit
Change-Id: I8bcaa0a87d54adc122a71755746912112c4b83e1
This commit is contained in:
vadimt 2021-08-18 19:10:13 -07:00
parent 89d3f7d12a
commit b29f63af3c
1 changed files with 5 additions and 0 deletions

View File

@ -30,6 +30,7 @@ public class FailureWatcher extends TestWatcher {
public FailureWatcher(UiDevice device, LauncherInstrumentation launcher) { public FailureWatcher(UiDevice device, LauncherInstrumentation launcher) {
mDevice = device; mDevice = device;
mLauncher = launcher; mLauncher = launcher;
Log.d("b/196820244", "FailureWatcher.ctor", new Exception());
} }
@Override @Override
@ -44,7 +45,9 @@ public class FailureWatcher extends TestWatcher {
@Override @Override
public void evaluate() throws Throwable { public void evaluate() throws Throwable {
try { try {
Log.d("b/196820244", "Before evaluate");
FailureWatcher.super.apply(base, description).evaluate(); FailureWatcher.super.apply(base, description).evaluate();
Log.d("b/196820244", "After evaluate");
} finally { } finally {
if (mLauncher.hadNontestEvents()) { if (mLauncher.hadNontestEvents()) {
throw new AssertionError( throw new AssertionError(
@ -64,7 +67,9 @@ public class FailureWatcher extends TestWatcher {
} }
public static void onError(UiDevice device, Description description, Throwable e) { public static void onError(UiDevice device, Description description, Throwable e) {
Log.d("b/196820244", "onError 1");
if (device == null) return; if (device == null) return;
Log.d("b/196820244", "onError 2");
final File parentFile = getInstrumentation().getTargetContext().getFilesDir(); final File parentFile = getInstrumentation().getTargetContext().getFilesDir();
final File sceenshot = new File(parentFile, final File sceenshot = new File(parentFile,
"TestScreenshot-" + description.getMethodName() + ".png"); "TestScreenshot-" + description.getMethodName() + ".png");