Merge "Add more functionality for some picker fakes" into main
diff --git a/tests/common/src/com/android/customization/testing/TestCustomizationInjector.kt b/tests/common/src/com/android/customization/testing/TestCustomizationInjector.kt
index a474212..3d52f86 100644
--- a/tests/common/src/com/android/customization/testing/TestCustomizationInjector.kt
+++ b/tests/common/src/com/android/customization/testing/TestCustomizationInjector.kt
@@ -22,7 +22,9 @@
import com.android.wallpaper.picker.category.wrapper.WallpaperCategoryWrapper
import com.android.wallpaper.picker.customization.data.repository.WallpaperColorsRepository
import com.android.wallpaper.picker.customization.domain.interactor.WallpaperInteractor
+import com.android.wallpaper.testing.FakeCurrentWallpaperInfoFactory
import com.android.wallpaper.testing.FakeWallpaperClient
+import com.android.wallpaper.testing.FakeWallpaperRefresher
import com.android.wallpaper.testing.TestInjector
import com.android.wallpaper.testing.TestPackageStatusNotifier
import com.android.wallpaper.util.DisplayUtils
@@ -43,7 +45,9 @@
injectedWallpaperInteractor: WallpaperInteractor,
prefs: WallpaperPreferences,
private val fakeWallpaperCategoryWrapper: WallpaperCategoryWrapper,
- private val testStatusNotifier: TestPackageStatusNotifier,
+ testStatusNotifier: TestPackageStatusNotifier,
+ currentWallpaperInfoFactory: FakeCurrentWallpaperInfoFactory,
+ wallpaperRefresher: FakeWallpaperRefresher,
) :
TestInjector(
themesUserEventLogger,
@@ -56,6 +60,8 @@
prefs,
fakeWallpaperCategoryWrapper,
testStatusNotifier,
+ currentWallpaperInfoFactory,
+ wallpaperRefresher,
),
CustomizationInjector {
/////////////////
diff --git a/tests/robotests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt b/tests/robotests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
index 36a723c..da8ed5f 100644
--- a/tests/robotests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
+++ b/tests/robotests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
@@ -35,7 +35,6 @@
import com.android.wallpaper.module.InjectorProvider
import com.android.wallpaper.module.NetworkStatusNotifier
import com.android.wallpaper.module.PartnerProvider
-import com.android.wallpaper.module.WallpaperPreferences
import com.android.wallpaper.network.Requester
import com.android.wallpaper.picker.category.wrapper.WallpaperCategoryWrapper
import com.android.wallpaper.picker.common.icon.ui.viewmodel.Icon
@@ -43,8 +42,9 @@
import com.android.wallpaper.picker.customization.data.repository.WallpaperRepository
import com.android.wallpaper.picker.customization.domain.interactor.WallpaperInteractor
import com.android.wallpaper.picker.option.ui.viewmodel.OptionItemViewModel
+import com.android.wallpaper.testing.FakeCurrentWallpaperInfoFactory
import com.android.wallpaper.testing.FakeWallpaperClient
-import com.android.wallpaper.testing.TestCurrentWallpaperInfoFactory
+import com.android.wallpaper.testing.FakeWallpaperRefresher
import com.android.wallpaper.testing.TestInjector
import com.android.wallpaper.testing.TestPackageStatusNotifier
import com.android.wallpaper.testing.TestWallpaperPreferences
@@ -90,6 +90,9 @@
testScope = TestScope(testDispatcher)
Dispatchers.setMain(testDispatcher)
client = FakeCustomizationProviderClient()
+ val prefs = TestWallpaperPreferences()
+ val refresher = FakeWallpaperRefresher(prefs)
+ val wallpaperInfoFactory = FakeCurrentWallpaperInfoFactory(refresher)
quickAffordanceInteractor =
KeyguardQuickAffordancePickerInteractor(
@@ -107,7 +110,7 @@
WallpaperRepository(
scope = testScope.backgroundScope,
client = FakeWallpaperClient(),
- wallpaperPreferences = TestWallpaperPreferences(),
+ wallpaperPreferences = prefs,
backgroundDispatcher = testDispatcher,
)
)
@@ -121,9 +124,11 @@
mock(PartnerProvider::class.java),
FakeWallpaperClient(),
wallpaperInteractor,
- mock(WallpaperPreferences::class.java),
+ prefs,
mock(WallpaperCategoryWrapper::class.java),
testPackageStatusNotifier,
+ wallpaperInfoFactory,
+ refresher,
)
)
underTest =
@@ -131,7 +136,7 @@
context = context,
quickAffordanceInteractor = quickAffordanceInteractor,
wallpaperInteractor = wallpaperInteractor,
- wallpaperInfoFactory = TestCurrentWallpaperInfoFactory(context),
+ wallpaperInfoFactory = wallpaperInfoFactory,
logger = logger,
)
.create(KeyguardQuickAffordancePickerViewModel::class.java)