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

Commit a2d28fd9 authored by Winson Chung's avatar Winson Chung
Browse files

Also skip test setup for tv-specific tests if not on tv

Bug: 263449064
Test: atest WMShellUnitTests

Change-Id: Ice60ed32cbf5aa1ef073e175dc18c1e113240972
parent 9ebfbcae
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -76,7 +76,14 @@ public abstract class ShellTestCase {
     * only be run on TVs.
     * only be run on TVs.
     */
     */
    protected void assumeTelevision() {
    protected void assumeTelevision() {
        assumeTrue(mPm.hasSystemFeature(PackageManager.FEATURE_LEANBACK)
        assumeTrue(isTelevision());
                || mPm.hasSystemFeature(PackageManager.FEATURE_LEANBACK_ONLY));
    }

    /**
     * Returns whether this test device is a TV device.
     */
    protected boolean isTelevision() {
        return mPm.hasSystemFeature(PackageManager.FEATURE_LEANBACK)
                || mPm.hasSystemFeature(PackageManager.FEATURE_LEANBACK_ONLY);
    }
    }
}
}
+3 −0
Original line number Original line Diff line number Diff line
@@ -95,6 +95,9 @@ public class TvPipActionProviderTest extends ShellTestCase {


    @Before
    @Before
    public void setUp() {
    public void setUp() {
        if (!isTelevision()) {
            return;
        }
        MockitoAnnotations.initMocks(this);
        MockitoAnnotations.initMocks(this);
        mActionsProvider = new TvPipActionsProvider(mContext, mMockPipMediaController,
        mActionsProvider = new TvPipActionsProvider(mContext, mMockPipMediaController,
                mMockSystemActionsHandler);
                mMockSystemActionsHandler);
+3 −0
Original line number Original line Diff line number Diff line
@@ -84,6 +84,9 @@ class TvPipBoundsControllerTest : ShellTestCase() {


    @Before
    @Before
    fun setUp() {
    fun setUp() {
        if (!isTelevision) {
            return
        }
        MockitoAnnotations.initMocks(this)
        MockitoAnnotations.initMocks(this)
        time = 0L
        time = 0L
        inMenu = false
        inMenu = false
+3 −0
Original line number Original line Diff line number Diff line
@@ -48,6 +48,9 @@ public class TvPipGravityTest extends ShellTestCase {


    @Before
    @Before
    public void setUp() {
    public void setUp() {
        if (!isTelevision()) {
            return;
        }
        MockitoAnnotations.initMocks(this);
        MockitoAnnotations.initMocks(this);
        mTvPipBoundsState = new TvPipBoundsState(mContext);
        mTvPipBoundsState = new TvPipBoundsState(mContext);
        mTvPipBoundsAlgorithm = new TvPipBoundsAlgorithm(mContext, mTvPipBoundsState,
        mTvPipBoundsAlgorithm = new TvPipBoundsAlgorithm(mContext, mTvPipBoundsState,
+3 −0
Original line number Original line Diff line number Diff line
@@ -56,6 +56,9 @@ class TvPipKeepClearAlgorithmTest : ShellTestCase() {


    @Before
    @Before
    fun setup() {
    fun setup() {
        if (!isTelevision) {
            return
        }
        movementBounds = Rect(0, 0, SCREEN_SIZE.width, SCREEN_SIZE.height)
        movementBounds = Rect(0, 0, SCREEN_SIZE.width, SCREEN_SIZE.height)
        movementBounds.inset(SCREEN_EDGE_INSET, SCREEN_EDGE_INSET)
        movementBounds.inset(SCREEN_EDGE_INSET, SCREEN_EDGE_INSET)