diff options
10 files changed, 283 insertions, 4 deletions
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/BatteryMeterViewControllerKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/BatteryMeterViewControllerKosmos.kt new file mode 100644 index 000000000000..f3bccb126f62 --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/BatteryMeterViewControllerKosmos.kt @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.battery + +import android.os.Handler +import android.test.mock.MockContentResolver +import com.android.systemui.flags.fake +import com.android.systemui.flags.featureFlagsClassic +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.settings.userTracker +import com.android.systemui.statusbar.policy.batteryController +import com.android.systemui.statusbar.policy.configurationController +import com.android.systemui.tuner.tunerService +import org.mockito.kotlin.mock + +val Kosmos.batteryMeterViewControllerFactory: BatteryMeterViewController.Factory by +Kosmos.Fixture { + BatteryMeterViewController.Factory( + userTracker, + configurationController, + tunerService, + mock<Handler>(), + MockContentResolver(), + featureFlagsClassic.fake, + batteryController + ) +}
\ No newline at end of file diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelKosmos.kt index cfc2075c1352..08de73be1128 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/ui/viewmodel/ShadeHeaderViewModelKosmos.kt @@ -17,7 +17,7 @@ package com.android.systemui.shade.ui.viewmodel import android.content.applicationContext -import com.android.systemui.battery.BatteryMeterViewController +import com.android.systemui.battery.batteryMeterViewControllerFactory import com.android.systemui.broadcast.broadcastDispatcher import com.android.systemui.kosmos.Kosmos import com.android.systemui.plugins.activityStarter @@ -28,7 +28,7 @@ import com.android.systemui.shade.domain.interactor.shadeInteractor import com.android.systemui.shade.domain.interactor.shadeModeInteractor import com.android.systemui.statusbar.notification.icon.ui.viewbinder.NotificationIconContainerStatusBarViewBinder import com.android.systemui.statusbar.phone.ui.StatusBarIconController -import com.android.systemui.statusbar.phone.ui.TintedIconManager +import com.android.systemui.statusbar.phone.ui.tintedIconManagerFactory import com.android.systemui.statusbar.pipeline.mobile.domain.interactor.mobileIconsInteractor import com.android.systemui.statusbar.pipeline.mobile.ui.viewmodel.mobileIconsViewModel import org.mockito.kotlin.mock @@ -45,8 +45,8 @@ val Kosmos.shadeHeaderViewModel: ShadeHeaderViewModel by mobileIconsViewModel = mobileIconsViewModel, privacyChipInteractor = privacyChipInteractor, clockInteractor = shadeHeaderClockInteractor, - tintedIconManagerFactory = mock<TintedIconManager.Factory>(), - batteryMeterViewControllerFactory = mock<BatteryMeterViewController.Factory>(), + tintedIconManagerFactory = tintedIconManagerFactory, + batteryMeterViewControllerFactory = batteryMeterViewControllerFactory, statusBarIconController = mock<StatusBarIconController>(), notificationIconContainerStatusBarViewBinder = mock<NotificationIconContainerStatusBarViewBinder>(), diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderKosmos.kt new file mode 100644 index 000000000000..18d65206767e --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/connectivity/ui/MobileContextProviderKosmos.kt @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.connectivity.ui + +import com.android.systemui.kosmos.Kosmos +import org.mockito.kotlin.mock + +// NOTE: `mobileContextProvider` is a mock instance. +val Kosmos.mobileContextProvider by +Kosmos.Fixture { + mock<MobileContextProvider>() +}
\ No newline at end of file diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerKosmos.kt new file mode 100644 index 000000000000..0a387f860a5b --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ui/StatusBarIconControllerKosmos.kt @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.phone.ui + +import com.android.systemui.kosmos.Kosmos +import org.mockito.kotlin.mock + +// NOTE: `statusBarIconController` is a mock instance. +val Kosmos.statusBarIconController by Kosmos.Fixture { + mock<StatusBarIconControllerImpl>() +}
\ No newline at end of file diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ui/TintedIconManagerKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ui/TintedIconManagerKosmos.kt new file mode 100644 index 000000000000..8e13b624f5fa --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ui/TintedIconManagerKosmos.kt @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.phone.ui + +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.statusbar.connectivity.ui.mobileContextProvider +import com.android.systemui.statusbar.pipeline.mobile.ui.mobileUiAdapter +import com.android.systemui.statusbar.pipeline.wifi.ui.wifiUiAdapter + +val Kosmos.tintedIconManagerFactory by +Kosmos.Fixture { + TintedIconManager.Factory( + wifiUiAdapter, + mobileUiAdapter, + mobileContextProvider, + ) +}
\ No newline at end of file diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/airplane/ui/viewmodel/AirplaneModeViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/airplane/ui/viewmodel/AirplaneModeViewModelKosmos.kt new file mode 100644 index 000000000000..50895459cda0 --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/airplane/ui/viewmodel/AirplaneModeViewModelKosmos.kt @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.pipeline.airplane.ui.viewmodel + +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.kosmos.backgroundScope +import com.android.systemui.log.table.logcatTableLogBuffer +import com.android.systemui.statusbar.pipeline.airplane.domain.interactor.airplaneModeInteractor + +val Kosmos.airplaneModeViewModel by Kosmos.Fixture { + AirplaneModeViewModelImpl( + airplaneModeInteractor, + logcatTableLogBuffer(this, "AirplaneModeTableLogBuffer"), + backgroundScope, + ) +} diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileUiAdapterKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileUiAdapterKosmos.kt new file mode 100644 index 000000000000..a87d3b0538fd --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileUiAdapterKosmos.kt @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.pipeline.mobile.ui + +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.kosmos.applicationCoroutineScope +import com.android.systemui.statusbar.phone.ui.statusBarIconController +import com.android.systemui.statusbar.pipeline.mobile.ui.viewmodel.mobileIconsViewModel + +val Kosmos.mobileUiAdapter by + Kosmos.Fixture { + MobileUiAdapter( + statusBarIconController, + mobileIconsViewModel, + mobileViewLogger, + applicationCoroutineScope, + ) + } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerKosmos.kt new file mode 100644 index 000000000000..206ecd332c37 --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/mobile/ui/MobileViewLoggerKosmos.kt @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.pipeline.mobile.ui + +import com.android.systemui.kosmos.Kosmos +import org.mockito.kotlin.mock + +// NOTE: `mobileViewLogger` is a mock instance. +val Kosmos.mobileViewLogger by Kosmos.Fixture { mock<MobileViewLogger>() } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/wifi/ui/WifiUiAdapterKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/wifi/ui/WifiUiAdapterKosmos.kt new file mode 100644 index 000000000000..4e3c3caa2428 --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/wifi/ui/WifiUiAdapterKosmos.kt @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.pipeline.wifi.ui + +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.statusbar.phone.ui.statusBarIconController +import com.android.systemui.statusbar.pipeline.wifi.ui.viewmodel.wifiViewModel + +val Kosmos.wifiUiAdapter by +Kosmos.Fixture { + WifiUiAdapter( + statusBarIconController, + wifiViewModel, + ) +} diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelKosmos.kt new file mode 100644 index 000000000000..15057cd5bd0c --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/pipeline/wifi/ui/viewmodel/WifiViewModelKosmos.kt @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.pipeline.wifi.ui.viewmodel + +import android.content.applicationContext +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.kosmos.applicationCoroutineScope +import com.android.systemui.log.table.logcatTableLogBuffer +import com.android.systemui.statusbar.pipeline.airplane.ui.viewmodel.airplaneModeViewModel +import com.android.systemui.statusbar.pipeline.shared.ConnectivityConstants +import com.android.systemui.statusbar.pipeline.wifi.domain.interactor.wifiInteractor +import com.android.systemui.statusbar.pipeline.wifi.shared.WifiConstants +import kotlinx.coroutines.flow.MutableStateFlow +import org.mockito.kotlin.mock + +val Kosmos.wifiViewModel by + Kosmos.Fixture { + WifiViewModel( + airplaneModeViewModel, + { MutableStateFlow(false) }, + mock<ConnectivityConstants>(), + applicationContext, + logcatTableLogBuffer(this, "WifiViewModelTest"), + wifiInteractor, + applicationCoroutineScope, + mock<WifiConstants>(), + ) + } |