use of android.support.test.uiautomator.UiObject in project android_frameworks_base by crdroidandroid.
the class BugreportReceiverTest method assertScreenshotButtonEnabled.
private void assertScreenshotButtonEnabled(boolean expectedEnabled) throws Exception {
UiObject screenshotButton = getScreenshotButton();
assertEquals("wrong state for screenshot button ", expectedEnabled, screenshotButton.isEnabled());
}
use of android.support.test.uiautomator.UiObject in project android_frameworks_base by crdroidandroid.
the class BugreportReceiverTest method takeScreenshot.
/**
* Takes a screenshot using the system notification.
*/
private void takeScreenshot() throws Exception {
UiObject screenshotButton = getScreenshotButton();
mUiBot.click(screenshotButton, "screenshot_button");
}
use of android.support.test.uiautomator.UiObject in project android_frameworks_base by crdroidandroid.
the class BugreportReceiverTest method testProgress_cancel.
public void testProgress_cancel() throws Exception {
resetProperties();
sendBugreportStarted(1000);
waitForScreenshotButtonEnabled(true);
final NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMinimumFractionDigits(2);
nf.setMaximumFractionDigits(2);
assertProgressNotification(NAME, 00.00f);
openProgressNotification(ID);
UiObject cancelButton = mUiBot.getVisibleObject(mContext.getString(com.android.internal.R.string.cancel).toUpperCase());
mUiBot.click(cancelButton, "cancel_button");
waitForService(false);
}
use of android.support.test.uiautomator.UiObject in project android_frameworks_base by crdroidandroid.
the class BugreportReceiverTest method waitForScreenshotButtonEnabled.
private UiObject waitForScreenshotButtonEnabled(boolean expectedEnabled) throws Exception {
UiObject screenshotButton = getScreenshotButton();
int maxAttempts = SAFE_SCREENSHOT_DELAY;
int i = 0;
do {
boolean enabled = screenshotButton.isEnabled();
if (enabled == expectedEnabled) {
return screenshotButton;
}
i++;
Log.v(TAG, "Sleeping for 1 second while waiting for screenshot.enable to be " + expectedEnabled + " (attempt " + i + ")");
Thread.sleep(DateUtils.SECOND_IN_MILLIS);
} while (i <= maxAttempts);
fail("screenshot.enable didn't change to " + expectedEnabled + " in " + maxAttempts + "s");
return screenshotButton;
}
use of android.support.test.uiautomator.UiObject in project android_frameworks_base by crdroidandroid.
the class UiBot method getVisibleObject.
/**
* Gets an object which is guaranteed to be present in the current UI.
*
* @param text Object's text as displayed by the UI.
*/
public UiObject getVisibleObject(String text) {
UiObject uiObject = mDevice.findObject(new UiSelector().text(text));
assertTrue("could not find object with text '" + text + "'", uiObject.exists());
return uiObject;
}
Aggregations