diff options
| author | 2023-11-15 14:31:07 +0000 | |
|---|---|---|
| committer | 2023-11-15 14:31:07 +0000 | |
| commit | ec75adacfe4ece057f670028f00b6daab931449a (patch) | |
| tree | 2696fd07ddea0a349c883d5b6ab74d5d70bb76ba | |
| parent | 6c8491b713d7e69d494c18a94a2a6146e740ad6e (diff) | |
| parent | 744c30cb093fbe9a1ed94e81612cd0cc7121d76a (diff) | |
Merge "Add flag rule to AutoTileManagerTest" into main
4 files changed, 6 insertions, 18 deletions
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java index 3b07913de7c5..5245b224fa5b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java @@ -27,7 +27,6 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; @@ -41,7 +40,6 @@ import android.database.ContentObserver; import android.os.Handler; import android.os.Looper; import android.os.UserHandle; -import android.platform.test.flag.junit.SetFlagsRule; import android.testing.AndroidTestingRunner; import android.util.SparseArray; import android.view.View; @@ -82,7 +80,6 @@ import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.util.time.FakeSystemClock; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; @@ -107,10 +104,6 @@ public class QSTileHostTest extends SysuiTestCase { ComponentName.unflattenFromString("TEST_PKG/.TEST_CLS"); private static final String CUSTOM_TILE_SPEC = CustomTile.toSpec(CUSTOM_TILE); private static final String SETTING = QSHost.TILES_SETTING; - - @Rule - public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); - @Mock private PluginManager mPluginManager; @Mock diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/domain/interactor/CurrentTilesInteractorImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/domain/interactor/CurrentTilesInteractorImplTest.kt index 355ca816e789..8c896a6a1709 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/domain/interactor/CurrentTilesInteractorImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/domain/interactor/CurrentTilesInteractorImplTest.kt @@ -21,7 +21,6 @@ import android.content.Context import android.content.Intent import android.content.pm.UserInfo import android.os.UserHandle -import android.platform.test.flag.junit.SetFlagsRule import android.service.quicksettings.Tile import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest @@ -62,7 +61,6 @@ import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentMatchers.anyString @@ -77,8 +75,6 @@ import org.mockito.MockitoAnnotations @OptIn(ExperimentalCoroutinesApi::class) class CurrentTilesInteractorImplTest : SysuiTestCase() { - @Rule @JvmField val setFlagsRule = SetFlagsRule() - private val tileSpecRepository: TileSpecRepository = FakeTileSpecRepository() private val userRepository = FakeUserRepository() private val installedTilesPackageRepository = FakeInstalledTilesComponentRepository() @@ -109,7 +105,7 @@ class CurrentTilesInteractorImplTest : SysuiTestCase() { fun setup() { MockitoAnnotations.initMocks(this) - setFlagsRule.enableFlags(FLAG_QS_NEW_PIPELINE) + mSetFlagsRule.enableFlags(FLAG_QS_NEW_PIPELINE) // TODO(b/299909337): Add test checking the new factory is used when the flag is on featureFlags.set(Flags.QS_PIPELINE_NEW_TILES, true) diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/shared/QSPipelineFlagsRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/shared/QSPipelineFlagsRepositoryTest.kt index 62ca965a81dd..2e637084e6dc 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/shared/QSPipelineFlagsRepositoryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/pipeline/shared/QSPipelineFlagsRepositoryTest.kt @@ -1,13 +1,11 @@ package com.android.systemui.qs.pipeline.shared -import android.platform.test.flag.junit.SetFlagsRule import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.flags.FakeFeatureFlagsClassic import com.google.common.truth.Truth.assertThat -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @@ -15,22 +13,20 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class QSPipelineFlagsRepositoryTest : SysuiTestCase() { - @Rule @JvmField val setFlagsRule = SetFlagsRule() - private val fakeFeatureFlagsClassic = FakeFeatureFlagsClassic() private val underTest = QSPipelineFlagsRepository(fakeFeatureFlagsClassic) @Test fun pipelineFlagDisabled() { - setFlagsRule.disableFlags(Flags.FLAG_QS_NEW_PIPELINE) + mSetFlagsRule.disableFlags(Flags.FLAG_QS_NEW_PIPELINE) assertThat(underTest.pipelineEnabled).isFalse() } @Test fun pipelineFlagEnabled() { - setFlagsRule.enableFlags(Flags.FLAG_QS_NEW_PIPELINE) + mSetFlagsRule.enableFlags(Flags.FLAG_QS_NEW_PIPELINE) assertThat(underTest.pipelineEnabled).isTrue() } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/AutoTileManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/AutoTileManagerTest.java index 1d8a3461e546..84cd518cf85a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/AutoTileManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/AutoTileManagerTest.java @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.phone; +import static com.android.systemui.Flags.FLAG_QS_NEW_PIPELINE; import static com.android.systemui.qs.dagger.QSFlagsModule.RBC_AVAILABLE; import static com.android.systemui.statusbar.phone.AutoTileManager.DEVICE_CONTROLS; @@ -135,6 +136,8 @@ public class AutoTileManagerTest extends SysuiTestCase { MockitoAnnotations.initMocks(this); mSecureSettings = new FakeSettings(); + mSetFlagsRule.disableFlags(FLAG_QS_NEW_PIPELINE); + mContext.getOrCreateTestableResources().addOverride( R.array.config_quickSettingsAutoAdd, new String[] { |