• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.wallpaper
17 
18 import com.android.wallpaper.effects.EffectsController
19 import com.android.wallpaper.effects.FakeEffectsController
20 import com.android.wallpaper.module.DefaultRecentWallpaperManager
21 import com.android.wallpaper.module.Injector
22 import com.android.wallpaper.module.PartnerProvider
23 import com.android.wallpaper.module.RecentWallpaperManager
24 import com.android.wallpaper.module.WallpaperPreferences
25 import com.android.wallpaper.module.logging.TestUserEventLogger
26 import com.android.wallpaper.module.logging.UserEventLogger
27 import com.android.wallpaper.modules.WallpaperPicker2AppModule
28 import com.android.wallpaper.network.Requester
29 import com.android.wallpaper.picker.category.client.DefaultWallpaperCategoryClient
30 import com.android.wallpaper.picker.category.domain.interactor.CategoryInteractor
31 import com.android.wallpaper.picker.category.domain.interactor.CuratedPhotosInteractor
32 import com.android.wallpaper.picker.category.domain.interactor.OnDeviceWallpapersInteractor
33 import com.android.wallpaper.picker.category.domain.interactor.ThirdPartyCategoryInteractor
34 import com.android.wallpaper.picker.category.ui.view.providers.IndividualPickerFactory
35 import com.android.wallpaper.picker.category.ui.view.providers.implementation.DefaultIndividualPickerFactory
36 import com.android.wallpaper.picker.category.wrapper.WallpaperCategoryWrapper
37 import com.android.wallpaper.picker.common.preview.ui.binder.DefaultWorkspaceCallbackBinder
38 import com.android.wallpaper.picker.common.preview.ui.binder.WorkspaceCallbackBinder
39 import com.android.wallpaper.picker.customization.ui.binder.CustomizationOptionsBinder
40 import com.android.wallpaper.picker.customization.ui.binder.DefaultCustomizationOptionsBinder
41 import com.android.wallpaper.picker.customization.ui.binder.DefaultToolbarBinder
42 import com.android.wallpaper.picker.customization.ui.binder.ToolbarBinder
43 import com.android.wallpaper.picker.preview.ui.util.DefaultImageEffectDialogUtil
44 import com.android.wallpaper.picker.preview.ui.util.ImageEffectDialogUtil
45 import com.android.wallpaper.testing.FakeCategoryInteractor
46 import com.android.wallpaper.testing.FakeCuratedPhotosInteractorImpl
47 import com.android.wallpaper.testing.FakeDefaultPhotosErrorConvertor
48 import com.android.wallpaper.testing.FakeDefaultRequester
49 import com.android.wallpaper.testing.FakeDefaultWallpaperCategoryClient
50 import com.android.wallpaper.testing.FakeDefaultWallpaperModelFactory
51 import com.android.wallpaper.testing.FakeOnDeviceWallpapersInteractor
52 import com.android.wallpaper.testing.FakeThirdPartyCategoryInteractor
53 import com.android.wallpaper.testing.FakeWallpaperCategoryWrapper
54 import com.android.wallpaper.testing.TestInjector
55 import com.android.wallpaper.testing.TestPartnerProvider
56 import com.android.wallpaper.testing.TestWallpaperPreferences
57 import com.android.wallpaper.util.converter.PhotosErrorConvertor
58 import com.android.wallpaper.util.converter.WallpaperModelFactory
59 import dagger.Binds
60 import dagger.Module
61 import dagger.hilt.components.SingletonComponent
62 import dagger.hilt.testing.TestInstallIn
63 import javax.inject.Singleton
64 
65 @Module
66 @TestInstallIn(
67     components = [SingletonComponent::class],
68     replaces = [WallpaperPicker2AppModule::class],
69 )
70 abstract class WallpaperPicker2TestModule {
71 
72     @Binds
73     @Singleton
bindCustomizationOptionsBindernull74     abstract fun bindCustomizationOptionsBinder(
75         impl: DefaultCustomizationOptionsBinder
76     ): CustomizationOptionsBinder
77 
78     @Binds
79     @Singleton
80     abstract fun bindDefaultWallpaperCategoryClient(
81         impl: FakeDefaultWallpaperCategoryClient
82     ): DefaultWallpaperCategoryClient
83 
84     @Binds
85     @Singleton
86     abstract fun bindEffectsController(impl: FakeEffectsController): EffectsController
87 
88     @Binds
89     @Singleton
90     abstract fun bindIndividualPickerFactoryFragment(
91         impl: DefaultIndividualPickerFactory
92     ): IndividualPickerFactory
93 
94     @Binds
95     @Singleton
96     abstract fun bindCategoryInteractor(impl: FakeCategoryInteractor): CategoryInteractor
97 
98     @Binds
99     @Singleton
100     abstract fun bindCuratedPhotosInteractor(
101         impl: FakeCuratedPhotosInteractorImpl
102     ): CuratedPhotosInteractor
103 
104     @Binds
105     @Singleton
106     abstract fun bindDefaultPhotosErrorConvertor(
107         impl: FakeDefaultPhotosErrorConvertor
108     ): PhotosErrorConvertor
109 
110     @Binds
111     @Singleton
112     abstract fun bindImageEffectDialogUtil(
113         impl: DefaultImageEffectDialogUtil
114     ): ImageEffectDialogUtil
115 
116     @Binds @Singleton abstract fun bindInjector(impl: TestInjector): Injector
117 
118     @Binds
119     @Singleton
120     abstract fun bindOnDeviceWallpapersInteractor(
121         impl: FakeOnDeviceWallpapersInteractor
122     ): OnDeviceWallpapersInteractor
123 
124     @Binds @Singleton abstract fun bindPartnerProvider(impl: TestPartnerProvider): PartnerProvider
125 
126     @Binds @Singleton abstract fun bindRequester(impl: FakeDefaultRequester): Requester
127 
128     @Binds
129     @Singleton
130     abstract fun bindThirdPartyCategoryInteractor(
131         impl: FakeThirdPartyCategoryInteractor
132     ): ThirdPartyCategoryInteractor
133 
134     @Binds @Singleton abstract fun bindToolbarBinder(impl: DefaultToolbarBinder): ToolbarBinder
135 
136     @Binds @Singleton abstract fun bindUserEventLogger(impl: TestUserEventLogger): UserEventLogger
137 
138     @Binds
139     @Singleton
140     abstract fun bindWallpaperCategoryWrapper(
141         impl: FakeWallpaperCategoryWrapper
142     ): WallpaperCategoryWrapper
143 
144     @Binds
145     @Singleton
146     abstract fun bindWallpaperModelFactory(
147         impl: FakeDefaultWallpaperModelFactory
148     ): WallpaperModelFactory
149 
150     @Binds
151     @Singleton
152     abstract fun bindWallpaperPreferences(impl: TestWallpaperPreferences): WallpaperPreferences
153 
154     @Binds
155     @Singleton
156     abstract fun bindWorkspaceCallbackBinder(
157         impl: DefaultWorkspaceCallbackBinder
158     ): WorkspaceCallbackBinder
159 
160     @Binds
161     @Singleton
162     abstract fun bindRecentWallpaperManager(
163         impl: DefaultRecentWallpaperManager
164     ): RecentWallpaperManager
165 }
166