Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a7929aff authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Logging for artifacts not being created" into sc-v2-dev

parents 829264a6 b29f63af
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -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");