diff options
| author | 2024-09-02 17:27:33 +0000 | |
|---|---|---|
| committer | 2024-09-02 17:27:33 +0000 | |
| commit | 99a580a033b3f820d271a4d49df0717ca2ed86f8 (patch) | |
| tree | bc3b7c0259a4810594b590effba336481e27c050 | |
| parent | 053b9e661124da08cdddaf6b29282f4cf6876684 (diff) | |
| parent | c6b07c87d162b944eb259b356f61964de1e167f8 (diff) | |
Merge "Add scope and dispatcher for UnconfinedTestDispatcher in kosmos." into main
3 files changed, 13 insertions, 0 deletions
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/GeneralKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/GeneralKosmos.kt index b34681ac0bdc..f8df7074142d 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/GeneralKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/kosmos/GeneralKosmos.kt @@ -5,9 +5,12 @@ import com.android.systemui.kosmos.Kosmos.Fixture import kotlin.coroutines.CoroutineContext import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.TestScope +import kotlinx.coroutines.test.UnconfinedTestDispatcher var Kosmos.testDispatcher by Fixture { StandardTestDispatcher() } +var Kosmos.unconfinedTestDispatcher by Fixture { UnconfinedTestDispatcher() } var Kosmos.testScope by Fixture { TestScope(testDispatcher) } +var Kosmos.unconfinedTestScope by Fixture { TestScope(unconfinedTestDispatcher) } var Kosmos.applicationCoroutineScope by Fixture { testScope.backgroundScope } var Kosmos.testCase: SysuiTestCase by Fixture() var Kosmos.backgroundCoroutineContext: CoroutineContext by Fixture { diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/util/settings/FakeGlobalSettingsKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/util/settings/FakeGlobalSettingsKosmos.kt index 35fa2af7639f..73d423cc3e7a 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/util/settings/FakeGlobalSettingsKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/util/settings/FakeGlobalSettingsKosmos.kt @@ -19,5 +19,10 @@ package com.android.systemui.util.settings import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.kosmos.testDispatcher +import com.android.systemui.kosmos.unconfinedTestDispatcher val Kosmos.fakeGlobalSettings: FakeGlobalSettings by Fixture { FakeGlobalSettings(testDispatcher) } + +val Kosmos.unconfinedDispatcherFakeGlobalSettings: FakeGlobalSettings by Fixture { + FakeGlobalSettings(unconfinedTestDispatcher) +} diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/util/settings/FakeSettingsKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/util/settings/FakeSettingsKosmos.kt index 76ef20253078..e1daf9bdc773 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/util/settings/FakeSettingsKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/util/settings/FakeSettingsKosmos.kt @@ -19,8 +19,13 @@ package com.android.systemui.util.settings import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.kosmos.testDispatcher +import com.android.systemui.kosmos.unconfinedTestDispatcher import com.android.systemui.settings.userTracker val Kosmos.fakeSettings: FakeSettings by Fixture { FakeSettings(testDispatcher) { userTracker.userId } } + +val Kosmos.unconfinedDispatcherFakeSettings: FakeSettings by Fixture { + FakeSettings(unconfinedTestDispatcher) { userTracker.userId } +} |