From 65f6c628edb9da56f8c693e2263b0e1cc1ca44b3 Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 15 May 2019 12:14:15 -0700 Subject: [PATCH] Including accessibility hierarchy for all TAPL fails Change-Id: I3357f33b3749bb9799b1b72af4c0084cd2e5dbca --- .../launcher3/tapl/LauncherInstrumentation.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index ec62188950..d3f1460048 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -58,6 +58,7 @@ import com.android.systemui.shared.system.QuickStepContract; import org.junit.Assert; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.lang.ref.WeakReference; import java.util.Deque; @@ -214,7 +215,22 @@ public final class LauncherInstrumentation { }; } + private void dumpViewHierarchy() { + final ByteArrayOutputStream stream = new ByteArrayOutputStream(); + try { + mDevice.dumpWindowHierarchy(stream); + stream.flush(); + stream.close(); + for (String line : stream.toString().split("\\r?\\n")) { + Log.e(TAG, line.trim()); + } + } catch (IOException e) { + Log.e(TAG, "error dumping XML to logcat", e); + } + } + private void fail(String message) { + dumpViewHierarchy(); Assert.fail("http://go/tapl : " + getContextDescription() + message); }