use of android.support.test.uiautomator.UiObject2 in project android_frameworks_base by AOSPA.
the class UiBot method findMenuWithName.
UiObject2 findMenuWithName(String label) {
List<UiObject2> menuItems = mDevice.findObjects(By.clazz("android.widget.LinearLayout"));
Iterator<UiObject2> it = menuItems.iterator();
UiObject2 menuItem = null;
while (it.hasNext()) {
menuItem = it.next();
UiObject2 text = menuItem.findObject(By.text(label));
if (text != null) {
break;
}
}
return menuItem;
}
use of android.support.test.uiautomator.UiObject2 in project android_frameworks_base by AOSPA.
the class BaseBot method assertHasFocus.
/**
* Asserts that the specified view or one of its descendents has focus.
*/
protected void assertHasFocus(String resourceName) {
UiObject2 candidate = mDevice.findObject(By.res(resourceName));
assertNotNull("Expected " + resourceName + " to have focus, but it didn't.", candidate.findObject(By.focused(true)));
}
use of android.support.test.uiautomator.UiObject2 in project android_frameworks_base by ResurrectionRemix.
the class Utils method waitForActivity.
private static UiObject2 waitForActivity(Instrumentation instrumentation, BySelector selector) {
UiDevice device = UiDevice.getInstance(instrumentation);
UiObject2 window = device.wait(Until.findObject(selector), WAIT_FOR_ACTIVITY_TIMEOUT);
if (window == null) {
throw new RuntimeException(selector.toString() + " has not been started.");
}
// Get root object.
while (window.getParent() != null) {
window = window.getParent();
}
return window;
}
use of android.support.test.uiautomator.UiObject2 in project weex-example by KalicyZhou.
the class BenchmarkTest method testFlingFPS.
@Repeat(TIMES)
@Test
@SdkSuppress(minSdkVersion = 23)
public void testFlingFPS() {
UiObject2 uiObject2 = loadPageForFPS();
if (uiObject2 != null) {
uiObject2.fling(Direction.DOWN, FLING_SPEED);
uiObject2.fling(Direction.DOWN, FLING_SPEED);
uiObject2.fling(Direction.DOWN, FLING_SPEED);
uiObject2.fling(Direction.DOWN, FLING_SPEED);
processGfxInfo(flingFrameSeconds);
}
}
use of android.support.test.uiautomator.UiObject2 in project weex-example by KalicyZhou.
the class BenchmarkTest method testScrollFPS.
@Repeat(TIMES)
@Test
@SdkSuppress(minSdkVersion = 23)
public void testScrollFPS() {
UiObject2 uiObject2 = loadPageForFPS();
if (uiObject2 != null) {
uiObject2.scroll(Direction.DOWN, 6, SCROLL_SPEED);
processGfxInfo(scrollFrameSeconds);
}
}
Aggregations