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

Commit 2884e6bb authored by Nataniel Borges's avatar Nataniel Borges Committed by Android (Google) Code Review
Browse files

Merge "Add meaningful exception when the device is in an unknown state"

parents 98806575 fd683f71
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.server.wm.flicker.helpers;

import static android.os.SystemClock.sleep;

import static org.junit.Assert.assertNotNull;

import android.app.Instrumentation;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
@@ -35,6 +37,8 @@ public class ImeAppHelper extends FlickerAppHelper {

    public void clickEditTextWidget(UiDevice device) {
        UiObject2 editText = device.findObject(By.res(getPackage(), "plain_text_input"));
        assertNotNull("Text field not found, this usually happens when the device was left "
                + "in an unknown state (e.g. in split screen)", editText);
        editText.click();
        sleep(500);
    }
+6 −7
Original line number Diff line number Diff line
@@ -16,13 +16,14 @@

package com.android.server.wm.flicker.helpers;

import static com.android.server.wm.flicker.helpers.AutomationUtils.getPipWindowSelector;
import static com.android.server.wm.flicker.helpers.AutomationUtils.hasPipWindow;

import static org.junit.Assert.assertNotNull;

import android.app.Instrumentation;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.Until;

public class PipAppHelper extends FlickerAppHelper {

@@ -32,12 +33,10 @@ public class PipAppHelper extends FlickerAppHelper {

    public void clickEnterPipButton(UiDevice device) {
        UiObject2 enterPipButton = device.findObject(By.res(getPackage(), "enter_pip"));
        assertNotNull("Pip button not found, this usually happens when the device was left "
                + "in an unknown state (e.g. in split screen)", enterPipButton);
        enterPipButton.click();
        UiObject2 pipWindow = device.wait(Until.findObject(getPipWindowSelector()), sFindTimeout);

        if (pipWindow == null) {
            throw new RuntimeException("Unable to find PIP window");
        }
        hasPipWindow(device);
    }

    public void closePipWindow(UiDevice device) {