diff options
| author | 2023-09-27 20:45:18 +0000 | |
|---|---|---|
| committer | 2023-09-27 20:45:18 +0000 | |
| commit | 640d6153e80442abd4c6b46487085b51c59674fe (patch) | |
| tree | 628536f61902e6e16dd5f58d31c73352c5a68ff8 | |
| parent | d02dcb662adcc8f60300e389a3e0edd0a4f08b66 (diff) | |
| parent | 2fc89880a761250dddeed37b1faed038e2fb3ea3 (diff) | |
Merge "Destroy tiles created in tests" into udc-qpr-dev am: 2fc89880a7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24867847
Change-Id: Ieadb4222728326cc58ecd51588a7dc221f800c66
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
3 files changed, 25 insertions, 3 deletions
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DeviceControlsTileTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DeviceControlsTileTest.kt index 1346069d3c25..333eaf9555fd 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DeviceControlsTileTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DeviceControlsTileTest.kt @@ -172,6 +172,9 @@ class DeviceControlsTileTest : SysuiTestCase() { @Test fun testNotAvailableControls() { featureEnabled = false + + // Destroy previous tile + tile.destroy() tile = createTile() assertThat(tile.isAvailable).isFalse() diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DreamTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DreamTileTest.java index f231c6e56096..6696129437a2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DreamTileTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DreamTileTest.java @@ -226,6 +226,10 @@ public class DreamTileTest extends SysuiTestCase { assertTrue(supportedTileOnlySystemUser.isAvailable()); when(mUserTracker.getUserInfo()).thenReturn(nonMainUserInfo); assertFalse(supportedTileOnlySystemUser.isAvailable()); + + destroyTile(unsupportedTile); + destroyTile(supportedTileAllUsers); + destroyTile(supportedTileOnlySystemUser); } @Test @@ -250,6 +254,8 @@ public class DreamTileTest extends SysuiTestCase { mTestableLooper.processAllMessages(); assertEquals(QSTileImpl.ResourceIcon.get(R.drawable.ic_qs_screen_saver_undocked), dockedTile.getState().icon); + + destroyTile(dockedTile); } private void setScreensaverEnabled(boolean enabled) { @@ -257,6 +263,11 @@ public class DreamTileTest extends SysuiTestCase { DEFAULT_USER); } + private void destroyTile(QSTileImpl<?> tile) { + tile.destroy(); + mTestableLooper.processAllMessages(); + } + private DreamTile constructTileForTest(boolean dreamSupported, boolean dreamOnlyEnabledForSystemUser) { return new DreamTile( diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/RotationLockTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/RotationLockTileTest.java index 41545fc2abfd..eff7138f66f9 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/RotationLockTileTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/RotationLockTileTest.java @@ -216,7 +216,7 @@ public class RotationLockTileTest extends SysuiTestCase { public void testSecondaryString_rotationResolverDisabled_isEmpty() { mTestableResources.addOverride(com.android.internal.R.bool.config_allowRotationResolver, false); - mLockTile = new RotationLockTile( + RotationLockTile otherTile = new RotationLockTile( mHost, mUiEventLogger, mTestableLooper.getLooper(), @@ -232,10 +232,12 @@ public class RotationLockTileTest extends SysuiTestCase { new FakeSettings() ); - mLockTile.refreshState(); + otherTile.refreshState(); mTestableLooper.processAllMessages(); - assertEquals("", mLockTile.getState().secondaryLabel.toString()); + assertEquals("", otherTile.getState().secondaryLabel.toString()); + + destroyTile(otherTile); } @Test @@ -258,6 +260,12 @@ public class RotationLockTileTest extends SysuiTestCase { assertEquals(state.icon, QSTileImpl.ResourceIcon.get(R.drawable.qs_auto_rotate_icon_on)); } + + private void destroyTile(QSTileImpl<?> tile) { + tile.destroy(); + mTestableLooper.processAllMessages(); + } + private void enableAutoRotation() { when(mRotationPolicyWrapper.isRotationLocked()).thenReturn(false); } |