Search in sources :

Example 1 with UiDevice

use of android.support.test.uiautomator.UiDevice in project android_frameworks_base by ResurrectionRemix.

the class FilesJankPerfTest method setUpInLoop.

public void setUpInLoop() {
    final UiDevice device = UiDevice.getInstance(getInstrumentation());
    final Context context = getInstrumentation().getTargetContext();
    mRootsListBot = new RootsListBot(device, context, BOT_TIMEOUT);
    mDirListBot = new DirectoryListBot(device, context, BOT_TIMEOUT);
    final Intent intent = new Intent(context, FilesActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mActivity = getInstrumentation().startActivitySync(intent);
}
Also used : Context(android.content.Context) UiDevice(android.support.test.uiautomator.UiDevice) RootsListBot(com.android.documentsui.bots.RootsListBot) Intent(android.content.Intent) DirectoryListBot(com.android.documentsui.bots.DirectoryListBot)

Example 2 with UiDevice

use of android.support.test.uiautomator.UiDevice in project android_frameworks_base by ResurrectionRemix.

the class Utils method rotateDevice.

public static void rotateDevice(Instrumentation instrumentation, int rotationMode) {
    try {
        UiDevice device = UiDevice.getInstance(instrumentation);
        long startTime = System.currentTimeMillis();
        switch(rotationMode) {
            case ROTATION_MODE_NATURAL:
                device.setOrientationNatural();
                break;
            case ROTATION_MODE_LEFT:
                device.setOrientationLeft();
                break;
            case ROTATION_MODE_RIGHT:
                device.setOrientationRight();
                break;
            default:
                throw new RuntimeException("Unsupported rotation mode: " + rotationMode);
        }
        long toSleep = ROTATION_ANIMATION_TIME_FULL_SCREEN_MS - (System.currentTimeMillis() - startTime);
        if (toSleep > 0) {
            SystemClock.sleep(toSleep);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : UiDevice(android.support.test.uiautomator.UiDevice)

Example 3 with UiDevice

use of android.support.test.uiautomator.UiDevice in project android_frameworks_base by DirtyUnicorns.

the class Utils method rotateDevice.

public static void rotateDevice(Instrumentation instrumentation, int rotationMode) {
    try {
        UiDevice device = UiDevice.getInstance(instrumentation);
        long startTime = System.currentTimeMillis();
        switch(rotationMode) {
            case ROTATION_MODE_NATURAL:
                device.setOrientationNatural();
                break;
            case ROTATION_MODE_LEFT:
                device.setOrientationLeft();
                break;
            case ROTATION_MODE_RIGHT:
                device.setOrientationRight();
                break;
            default:
                throw new RuntimeException("Unsupported rotation mode: " + rotationMode);
        }
        long toSleep = ROTATION_ANIMATION_TIME_FULL_SCREEN_MS - (System.currentTimeMillis() - startTime);
        if (toSleep > 0) {
            SystemClock.sleep(toSleep);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : UiDevice(android.support.test.uiautomator.UiDevice)

Example 4 with UiDevice

use of android.support.test.uiautomator.UiDevice in project android_frameworks_base by DirtyUnicorns.

the class FilesJankPerfTest method setUpInLoop.

public void setUpInLoop() {
    final UiDevice device = UiDevice.getInstance(getInstrumentation());
    final Context context = getInstrumentation().getTargetContext();
    mRootsListBot = new RootsListBot(device, context, BOT_TIMEOUT);
    mDirListBot = new DirectoryListBot(device, context, BOT_TIMEOUT);
    final Intent intent = new Intent(context, FilesActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mActivity = getInstrumentation().startActivitySync(intent);
}
Also used : Context(android.content.Context) UiDevice(android.support.test.uiautomator.UiDevice) RootsListBot(com.android.documentsui.bots.RootsListBot) Intent(android.content.Intent) DirectoryListBot(com.android.documentsui.bots.DirectoryListBot)

Example 5 with UiDevice

use of android.support.test.uiautomator.UiDevice in project platform_frameworks_base by android.

the class FilesJankPerfTest method setUpInLoop.

public void setUpInLoop() {
    final UiDevice device = UiDevice.getInstance(getInstrumentation());
    final Context context = getInstrumentation().getTargetContext();
    mRootsListBot = new RootsListBot(device, context, BOT_TIMEOUT);
    mDirListBot = new DirectoryListBot(device, context, BOT_TIMEOUT);
    final Intent intent = new Intent(context, FilesActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mActivity = getInstrumentation().startActivitySync(intent);
}
Also used : Context(android.content.Context) UiDevice(android.support.test.uiautomator.UiDevice) RootsListBot(com.android.documentsui.bots.RootsListBot) Intent(android.content.Intent) DirectoryListBot(com.android.documentsui.bots.DirectoryListBot)

Aggregations

UiDevice (android.support.test.uiautomator.UiDevice)25 Test (org.junit.Test)8 Intent (android.content.Intent)6 SmallTest (android.support.test.filters.SmallTest)6 Context (android.content.Context)5 UiObject2 (android.support.test.uiautomator.UiObject2)5 DirectoryListBot (com.android.documentsui.bots.DirectoryListBot)5 RootsListBot (com.android.documentsui.bots.RootsListBot)5 UiObject (android.support.test.uiautomator.UiObject)4 UiSelector (android.support.test.uiautomator.UiSelector)4 UiObjectNotFoundException (android.support.test.uiautomator.UiObjectNotFoundException)3 Activity (android.app.Activity)1 Bundle (android.os.Bundle)1 CancellationSignal (android.os.CancellationSignal)1 ParcelFileDescriptor (android.os.ParcelFileDescriptor)1 RemoteException (android.os.RemoteException)1 PrintAttributes (android.print.PrintAttributes)1 PrintDocumentAdapter (android.print.PrintDocumentAdapter)1 PrintJob (android.print.PrintJob)1 PrintManager (android.print.PrintManager)1