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

Commit 973f0b16 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Write dumpOnFailure to app files" into main

parents 9150ec5c febf3030
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
  -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.android.inputmethod.imetests">
          package="com.android.inputmethodservice">

    <!-- Permissions required for granting and logging -->
    <uses-permission android:name="android.permission.LOG_COMPAT_CHANGE"/>
@@ -33,7 +33,7 @@
    </application>

    <!-- The "targetPackage" reference the instruments APK package, which is the SimpleTestIme.apk,
    while the test package is "com.android.inputmethod.imetests" (FrameworksImeTests.apk).-->
    while the test package is "com.android.inputmethodservice" (FrameworksImeTests.apk).-->
    <instrumentation
        android:name="androidx.test.runner.AndroidJUnitRunner"
        android:targetPackage="com.android.apps.inputmethod.simpleime"
+4 −3
Original line number Diff line number Diff line
@@ -34,14 +34,15 @@
    <option name="test-tag" value="FrameworksImeTests" />

    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
        <option name="package" value="com.android.inputmethod.imetests" />
        <option name="package" value="com.android.inputmethodservice" />
        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
        <option name="hidden-api-checks" value="false"/>
    </test>

    <!-- Collect the files in the dump directory for debugging -->
    <!-- Collect output of DumpOnFailure -->
    <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
        <option name="directory-keys" value="/sdcard/FrameworksImeTests/" />
        <option name="directory-keys" value="/data/user/0/com.android.apps.inputmethod.simpleime/files" />
        <option name="collect-on-run-ended-only" value="true" />
        <option name="clean-up" value="true" />
    </metrics_collector>
</configuration>
+10 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import android.os.RemoteException;
import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
import android.provider.Settings;
import android.server.wm.DumpOnFailure;
import android.server.wm.WindowManagerStateHelper;
import android.util.Log;
import android.view.View;
@@ -123,6 +124,9 @@ public class InputMethodServiceTest {
    @Rule
    public final TestName mName = new TestName();

    @Rule
    public final DumpOnFailure mDumpOnFailure = new DumpOnFailure();

    private Instrumentation mInstrumentation;
    private UiDevice mUiDevice;
    private InputMethodManager mImm;
@@ -1284,8 +1288,13 @@ public class InputMethodServiceTest {

    @NonNull
    private UiObject2 getUiObject(@NonNull BySelector bySelector) {
        final var preScreenshot = mInstrumentation.getUiAutomation().takeScreenshot();
        mDumpOnFailure.dumpOnFailure("pre-getUiObject", preScreenshot);
        final var uiObject = mUiDevice.wait(Until.findObject(bySelector), TIMEOUT_MS);
        assertWithMessage("UiObject with " + bySelector + " was found").that(uiObject).isNotNull();
        mInstrumentation.waitForIdleSync();
        final var postScreenshot = mInstrumentation.getUiAutomation().takeScreenshot();
        mDumpOnFailure.dumpOnFailure("post-getUiObject", postScreenshot);
        assertWithMessage("UiObject with " + bySelector + " was found").that(uiObject).isNull();
        return uiObject;
    }