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

Commit 38ac73a0 authored by Sunny Goyal's avatar Sunny Goyal Committed by android-build-merger
Browse files

Using UiSelector instead of BySelector

am: ead4ab96

* commit 'ead4ab96':
  Using UiSelector instead of BySelector
parents b84046da ead4ab96
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -4,9 +4,9 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Rect;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.Until;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiSelector;
import android.test.InstrumentationTestCase;

/**
@@ -73,15 +73,17 @@ public class RotationPreferenceTest extends InstrumentationTestCase {
                .setPackage(mTargetPackage)
                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        getInstrumentation().getContext().startActivity(homeIntent);
        mDevice.wait(Until.hasObject(By.pkg(mTargetPackage).depth(0)), 3000);
        mDevice.findObject(new UiSelector().packageName(mTargetPackage)).waitForExists(6000);
    }

    private void setRotationEnabled(boolean enabled) {
        mPrefs.edit().putBoolean(Utilities.ALLOW_ROTATION_PREFERENCE_KEY, enabled).commit();
    }

    private Rect getHotseatBounds() {
        mDevice.wait(Until.hasObject(By.res(mTargetPackage, "hotseat")), 3000);
        return mDevice.findObject(By.res(mTargetPackage, "hotseat")).getVisibleBounds();
    private Rect getHotseatBounds() throws Exception {
        UiObject hotseat = mDevice.findObject(
                new UiSelector().resourceId(mTargetPackage + ":id/hotseat"));
        hotseat.waitForExists(6000);
        return hotseat.getVisibleBounds();
    }
}