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

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

Merge "Dump accessibility hierarchy on test failure" into sc-v2-dev

parents ec4be03d cf1c28ef
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -61,13 +61,23 @@ public class FailureWatcher extends TestWatcher {
            out.putNextEntry(new ZipEntry("visible_windows.zip"));
            dumpCommand("cmd window dump-visible-window-views", out);
            out.closeEntry();
        } catch (IOException ex) { }
        } catch (IOException ex) {
        }

        Log.e(TAG, "Failed test " + description.getMethodName()
                + ",\nscreenshot will be saved to " + sceenshot
                + ",\nUI dump at: " + hierarchy
                + " (use go/web-hv to open the dump file)", e);
        device.takeScreenshot(sceenshot);

        // Dump accessibility hierarchy
        final File accessibilityHierarchyFile = new File(parentFile,
                "AccessibilityHierarchy-" + description.getMethodName() + ".uix");
        try {
            device.dumpWindowHierarchy(accessibilityHierarchyFile);
        } catch (IOException ex) {
            Log.e(TAG, "Failed to save accessibility hierarchy", ex);
        }
    }

    private static void dumpStringCommand(String cmd, OutputStream out) throws IOException {