summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/ShellTestCase.java11
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipActionProviderTest.java3
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipBoundsControllerTest.kt3
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipGravityTest.java3
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipKeepClearAlgorithmTest.kt3
5 files changed, 21 insertions, 2 deletions
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/ShellTestCase.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/ShellTestCase.java
index 71102f430cfb..51a20ee9d090 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/ShellTestCase.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/ShellTestCase.java
@@ -76,7 +76,14 @@ public abstract class ShellTestCase {
* only be run on TVs.
*/
protected void assumeTelevision() {
- assumeTrue(mPm.hasSystemFeature(PackageManager.FEATURE_LEANBACK)
- || mPm.hasSystemFeature(PackageManager.FEATURE_LEANBACK_ONLY));
+ assumeTrue(isTelevision());
+ }
+
+ /**
+ * Returns whether this test device is a TV device.
+ */
+ protected boolean isTelevision() {
+ return mPm.hasSystemFeature(PackageManager.FEATURE_LEANBACK)
+ || mPm.hasSystemFeature(PackageManager.FEATURE_LEANBACK_ONLY);
}
}
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipActionProviderTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipActionProviderTest.java
index 41f84560b342..e5b61ed2fd25 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipActionProviderTest.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipActionProviderTest.java
@@ -95,6 +95,9 @@ public class TvPipActionProviderTest extends ShellTestCase {
@Before
public void setUp() {
+ if (!isTelevision()) {
+ return;
+ }
MockitoAnnotations.initMocks(this);
mActionsProvider = new TvPipActionsProvider(mContext, mMockPipMediaController,
mMockSystemActionsHandler);
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipBoundsControllerTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipBoundsControllerTest.kt
index 7e85030f90da..7370ed71bbdd 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipBoundsControllerTest.kt
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipBoundsControllerTest.kt
@@ -84,6 +84,9 @@ class TvPipBoundsControllerTest : ShellTestCase() {
@Before
fun setUp() {
+ if (!isTelevision) {
+ return
+ }
MockitoAnnotations.initMocks(this)
time = 0L
inMenu = false
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipGravityTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipGravityTest.java
index ca2c693a5c8d..51f86b845a9f 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipGravityTest.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipGravityTest.java
@@ -48,6 +48,9 @@ public class TvPipGravityTest extends ShellTestCase {
@Before
public void setUp() {
+ if (!isTelevision()) {
+ return;
+ }
MockitoAnnotations.initMocks(this);
mTvPipBoundsState = new TvPipBoundsState(mContext);
mTvPipBoundsAlgorithm = new TvPipBoundsAlgorithm(mContext, mTvPipBoundsState,
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipKeepClearAlgorithmTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipKeepClearAlgorithmTest.kt
index 0390f3ecde9b..aedf65ddc269 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipKeepClearAlgorithmTest.kt
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/pip/tv/TvPipKeepClearAlgorithmTest.kt
@@ -56,6 +56,9 @@ class TvPipKeepClearAlgorithmTest : ShellTestCase() {
@Before
fun setup() {
+ if (!isTelevision) {
+ return
+ }
movementBounds = Rect(0, 0, SCREEN_SIZE.width, SCREEN_SIZE.height)
movementBounds.inset(SCREEN_EDGE_INSET, SCREEN_EDGE_INSET)