summaryrefslogtreecommitdiff
path: root/tests/shared
diff options
context:
space:
mode:
author Steve Elliott <steell@google.com> 2024-03-28 13:45:29 -0400
committer Steve Elliott <steell@google.com> 2024-03-28 15:42:30 -0400
commit9c6a03ac16a40a75cf57b175e622c98c27c7d08e (patch)
tree1b9de791eb22e6d9350346fee684473728d46cdd /tests/shared
parent38a6a7637ed22bed196ede400ff72fea5407b17b (diff)
Introduce Kosmos DI for unit testing
Bug: 302691505 Flag: ACONFIG android.service.chooser.chooser_payload_toggling DEVELOPMENT Test: atest IntentResolver-tests-unit Change-Id: I47bd50ceb8aa39fdd4c37de0032e6b925ce88145
Diffstat (limited to 'tests/shared')
-rw-r--r--tests/shared/Android.bp1
-rw-r--r--tests/shared/src/com/android/intentresolver/CoroutinesKosmos.kt22
-rw-r--r--tests/shared/src/com/android/intentresolver/FrameworkMocksKosmos.kt25
-rw-r--r--tests/shared/src/com/android/intentresolver/contentpreview/MimetypeClassifierKosmos.kt21
-rw-r--r--tests/shared/src/com/android/intentresolver/contentpreview/UriMetadataReaderKosmos.kt28
-rw-r--r--tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/data/repository/PayloadToggleRepoKosmos.kt25
-rw-r--r--tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/cursor/CursorResolverKosmos.kt33
-rw-r--r--tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/intent/PendingIntentSenderKosmos.kt22
-rw-r--r--tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/intent/TargetIntentModifierKosmos.kt22
-rw-r--r--tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/interactor/PayloadToggleInteractorKosmos.kt120
-rw-r--r--tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/update/SelectionChangeCallbackKosmos.kt35
-rw-r--r--tests/shared/src/com/android/intentresolver/inject/ActivityModelKosmos.kt26
-rw-r--r--tests/shared/src/com/android/intentresolver/inject/ChooserServiceFlagsKosmos.kt24
-rw-r--r--tests/shared/src/com/android/intentresolver/logging/EventLogKosmos.kt23
-rw-r--r--tests/shared/src/com/android/intentresolver/v2/data/model/FakeChooserRequest.kt26
-rw-r--r--tests/shared/src/com/android/intentresolver/v2/data/repository/V2RepositoryKosmos.kt25
16 files changed, 478 insertions, 0 deletions
diff --git a/tests/shared/Android.bp b/tests/shared/Android.bp
index 249bf38f..7f5d605a 100644
--- a/tests/shared/Android.bp
+++ b/tests/shared/Android.bp
@@ -31,6 +31,7 @@ java_library {
static_libs: [
"hamcrest",
"IntentResolver-core",
+ "kosmos",
"mockito-kotlin2",
"mockito-target-minus-junit4",
"truth",
diff --git a/tests/shared/src/com/android/intentresolver/CoroutinesKosmos.kt b/tests/shared/src/com/android/intentresolver/CoroutinesKosmos.kt
new file mode 100644
index 00000000..eacefdc0
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/CoroutinesKosmos.kt
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2024 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.intentresolver
+
+import com.android.systemui.kosmos.Kosmos
+import kotlinx.coroutines.CoroutineDispatcher
+
+var Kosmos.backgroundDispatcher: CoroutineDispatcher by Kosmos.Fixture()
diff --git a/tests/shared/src/com/android/intentresolver/FrameworkMocksKosmos.kt b/tests/shared/src/com/android/intentresolver/FrameworkMocksKosmos.kt
new file mode 100644
index 00000000..d578fb66
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/FrameworkMocksKosmos.kt
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2024 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.intentresolver
+
+import android.content.ContentResolver
+import android.content.pm.PackageManager
+import com.android.systemui.kosmos.Kosmos
+
+var Kosmos.contentResolver by Kosmos.Fixture { mock<ContentResolver> {} }
+var Kosmos.contentInterface by Kosmos.Fixture { contentResolver }
+var Kosmos.packageManager by Kosmos.Fixture { mock<PackageManager> {} }
diff --git a/tests/shared/src/com/android/intentresolver/contentpreview/MimetypeClassifierKosmos.kt b/tests/shared/src/com/android/intentresolver/contentpreview/MimetypeClassifierKosmos.kt
new file mode 100644
index 00000000..4f979f54
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/contentpreview/MimetypeClassifierKosmos.kt
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2024 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.intentresolver.contentpreview
+
+import com.android.systemui.kosmos.Kosmos
+
+var Kosmos.mimetypeClassifier: MimeTypeClassifier by Kosmos.Fixture { DefaultMimeTypeClassifier }
diff --git a/tests/shared/src/com/android/intentresolver/contentpreview/UriMetadataReaderKosmos.kt b/tests/shared/src/com/android/intentresolver/contentpreview/UriMetadataReaderKosmos.kt
new file mode 100644
index 00000000..bdee477d
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/contentpreview/UriMetadataReaderKosmos.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2024 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.intentresolver.contentpreview
+
+import com.android.intentresolver.contentInterface
+import com.android.systemui.kosmos.Kosmos
+
+var Kosmos.uriMetadataReader: UriMetadataReader by Kosmos.Fixture { uriMetadataReaderImpl }
+val Kosmos.uriMetadataReaderImpl
+ get() =
+ UriMetadataReaderImpl(
+ contentInterface,
+ mimetypeClassifier,
+ )
diff --git a/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/data/repository/PayloadToggleRepoKosmos.kt b/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/data/repository/PayloadToggleRepoKosmos.kt
new file mode 100644
index 00000000..894ef163
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/data/repository/PayloadToggleRepoKosmos.kt
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2024 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.intentresolver.contentpreview.payloadtoggle.data.repository
+
+import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.kosmos.Kosmos.Fixture
+
+val Kosmos.activityResultRepository by Fixture { ActivityResultRepository() }
+val Kosmos.cursorPreviewsRepository by Fixture { CursorPreviewsRepository() }
+val Kosmos.pendingSelectionCallbackRepository by Fixture { PendingSelectionCallbackRepository() }
+val Kosmos.previewSelectionsRepository by Fixture { PreviewSelectionsRepository() }
diff --git a/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/cursor/CursorResolverKosmos.kt b/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/cursor/CursorResolverKosmos.kt
new file mode 100644
index 00000000..10b89c71
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/cursor/CursorResolverKosmos.kt
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2024 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.intentresolver.contentpreview.payloadtoggle.domain.cursor
+
+import android.net.Uri
+import com.android.intentresolver.contentResolver
+import com.android.intentresolver.inject.additionalContentUri
+import com.android.intentresolver.inject.chooserIntent
+import com.android.systemui.kosmos.Kosmos
+
+var Kosmos.payloadToggleCursorResolver: CursorResolver<Uri?> by
+ Kosmos.Fixture { payloadToggleCursorResolverImpl }
+val Kosmos.payloadToggleCursorResolverImpl
+ get() =
+ PayloadToggleCursorResolver(
+ contentResolver,
+ additionalContentUri,
+ chooserIntent,
+ )
diff --git a/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/intent/PendingIntentSenderKosmos.kt b/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/intent/PendingIntentSenderKosmos.kt
new file mode 100644
index 00000000..f022373d
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/intent/PendingIntentSenderKosmos.kt
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2024 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.intentresolver.contentpreview.payloadtoggle.domain.intent
+
+import com.android.intentresolver.mock
+import com.android.systemui.kosmos.Kosmos
+
+var Kosmos.pendingIntentSender by Kosmos.Fixture { mock<PendingIntentSender> {} }
diff --git a/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/intent/TargetIntentModifierKosmos.kt b/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/intent/TargetIntentModifierKosmos.kt
new file mode 100644
index 00000000..29e11a15
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/intent/TargetIntentModifierKosmos.kt
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2024 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.intentresolver.contentpreview.payloadtoggle.domain.intent
+
+import com.android.intentresolver.contentpreview.payloadtoggle.shared.model.PreviewModel
+import com.android.systemui.kosmos.Kosmos
+
+var Kosmos.targetIntentModifier: TargetIntentModifier<PreviewModel> by Kosmos.Fixture()
diff --git a/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/interactor/PayloadToggleInteractorKosmos.kt b/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/interactor/PayloadToggleInteractorKosmos.kt
new file mode 100644
index 00000000..9e34acff
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/interactor/PayloadToggleInteractorKosmos.kt
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2024 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.intentresolver.contentpreview.payloadtoggle.domain.interactor
+
+import com.android.intentresolver.backgroundDispatcher
+import com.android.intentresolver.contentResolver
+import com.android.intentresolver.contentpreview.HeadlineGenerator
+import com.android.intentresolver.contentpreview.ImageLoader
+import com.android.intentresolver.contentpreview.payloadtoggle.data.repository.activityResultRepository
+import com.android.intentresolver.contentpreview.payloadtoggle.data.repository.cursorPreviewsRepository
+import com.android.intentresolver.contentpreview.payloadtoggle.data.repository.pendingSelectionCallbackRepository
+import com.android.intentresolver.contentpreview.payloadtoggle.data.repository.previewSelectionsRepository
+import com.android.intentresolver.contentpreview.payloadtoggle.domain.cursor.payloadToggleCursorResolver
+import com.android.intentresolver.contentpreview.payloadtoggle.domain.intent.pendingIntentSender
+import com.android.intentresolver.contentpreview.payloadtoggle.domain.intent.targetIntentModifier
+import com.android.intentresolver.contentpreview.payloadtoggle.domain.update.selectionChangeCallback
+import com.android.intentresolver.contentpreview.uriMetadataReader
+import com.android.intentresolver.inject.contentUris
+import com.android.intentresolver.logging.eventLog
+import com.android.intentresolver.packageManager
+import com.android.intentresolver.v2.data.repository.chooserRequestRepository
+import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.kosmos.Kosmos.Fixture
+
+var Kosmos.focusedItemIndex: Int by Fixture { 0 }
+var Kosmos.pageSize: Int by Fixture { 16 }
+var Kosmos.maxLoadedPages: Int by Fixture { 3 }
+
+val Kosmos.chooserRequestInteractor
+ get() = ChooserRequestInteractor(chooserRequestRepository)
+
+val Kosmos.cursorPreviewsInteractor
+ get() =
+ CursorPreviewsInteractor(
+ interactor = setCursorPreviewsInteractor,
+ focusedItemIdx = focusedItemIndex,
+ uriMetadataReader = uriMetadataReader,
+ pageSize = pageSize,
+ maxLoadedPages = maxLoadedPages,
+ )
+
+val Kosmos.customActionsInteractor
+ get() =
+ CustomActionsInteractor(
+ activityResultRepo = activityResultRepository,
+ bgDispatcher = backgroundDispatcher,
+ contentResolver = contentResolver,
+ eventLog = eventLog,
+ packageManager = packageManager,
+ chooserRequestInteractor = chooserRequestInteractor,
+ )
+
+val Kosmos.fetchPreviewsInteractor
+ get() =
+ FetchPreviewsInteractor(
+ setCursorPreviews = setCursorPreviewsInteractor,
+ selectionRepository = previewSelectionsRepository,
+ cursorInteractor = cursorPreviewsInteractor,
+ focusedItemIdx = focusedItemIndex,
+ selectedItems = contentUris,
+ uriMetadataReader = uriMetadataReader,
+ cursorResolver = payloadToggleCursorResolver,
+ )
+
+val Kosmos.processTargetIntentUpdatesInteractor
+ get() =
+ ProcessTargetIntentUpdatesInteractor(
+ selectionCallback = selectionChangeCallback,
+ repository = pendingSelectionCallbackRepository,
+ chooserRequestInteractor = updateChooserRequestInteractor,
+ )
+
+val Kosmos.selectablePreviewsInteractor
+ get() =
+ SelectablePreviewsInteractor(
+ previewsRepo = cursorPreviewsRepository,
+ selectionInteractor = selectionInteractor,
+ )
+
+val Kosmos.selectionInteractor
+ get() =
+ SelectionInteractor(
+ selectionsRepo = previewSelectionsRepository,
+ targetIntentModifier = targetIntentModifier,
+ updateTargetIntentInteractor = updateTargetIntentInteractor,
+ )
+
+val Kosmos.setCursorPreviewsInteractor
+ get() = SetCursorPreviewsInteractor(previewsRepo = cursorPreviewsRepository)
+
+val Kosmos.updateChooserRequestInteractor
+ get() =
+ UpdateChooserRequestInteractor(
+ chooserRequestRepository,
+ pendingIntentSender,
+ )
+
+val Kosmos.updateTargetIntentInteractor
+ get() =
+ UpdateTargetIntentInteractor(
+ repository = pendingSelectionCallbackRepository,
+ chooserRequestInteractor = updateChooserRequestInteractor,
+ )
+
+var Kosmos.payloadToggleImageLoader: ImageLoader by Fixture()
+var Kosmos.headlineGenerator: HeadlineGenerator by Fixture()
diff --git a/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/update/SelectionChangeCallbackKosmos.kt b/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/update/SelectionChangeCallbackKosmos.kt
new file mode 100644
index 00000000..548b1f37
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/contentpreview/payloadtoggle/domain/update/SelectionChangeCallbackKosmos.kt
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2024 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.intentresolver.contentpreview.payloadtoggle.domain.update
+
+import com.android.intentresolver.contentInterface
+import com.android.intentresolver.inject.additionalContentUri
+import com.android.intentresolver.inject.chooserIntent
+import com.android.intentresolver.inject.chooserServiceFlags
+import com.android.systemui.kosmos.Kosmos
+
+val Kosmos.selectionChangeCallbackImpl by
+ Kosmos.Fixture {
+ SelectionChangeCallbackImpl(
+ additionalContentUri,
+ chooserIntent,
+ contentInterface,
+ chooserServiceFlags,
+ )
+ }
+var Kosmos.selectionChangeCallback: SelectionChangeCallback by
+ Kosmos.Fixture { selectionChangeCallbackImpl }
diff --git a/tests/shared/src/com/android/intentresolver/inject/ActivityModelKosmos.kt b/tests/shared/src/com/android/intentresolver/inject/ActivityModelKosmos.kt
new file mode 100644
index 00000000..9944163b
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/inject/ActivityModelKosmos.kt
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2024 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.intentresolver.inject
+
+import android.content.Intent
+import android.net.Uri
+import com.android.systemui.kosmos.Kosmos
+
+var Kosmos.contentUris: List<Uri> by Kosmos.Fixture { emptyList() }
+var Kosmos.additionalContentUri: Uri by
+ Kosmos.Fixture { Uri.fromParts("scheme", "ssp", "fragment") }
+var Kosmos.chooserIntent: Intent by Kosmos.Fixture { Intent() }
diff --git a/tests/shared/src/com/android/intentresolver/inject/ChooserServiceFlagsKosmos.kt b/tests/shared/src/com/android/intentresolver/inject/ChooserServiceFlagsKosmos.kt
new file mode 100644
index 00000000..51dad82a
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/inject/ChooserServiceFlagsKosmos.kt
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2024 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.intentresolver.inject
+
+import android.service.chooser.FeatureFlagsImpl
+import com.android.systemui.kosmos.Kosmos
+
+var Kosmos.chooserServiceFlags: ChooserServiceFlags by Kosmos.Fixture { chooserServiceFlagsImpl }
+val chooserServiceFlagsImpl: FeatureFlagsImpl
+ get() = FeatureFlagsImpl()
diff --git a/tests/shared/src/com/android/intentresolver/logging/EventLogKosmos.kt b/tests/shared/src/com/android/intentresolver/logging/EventLogKosmos.kt
new file mode 100644
index 00000000..5bf3ddee
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/logging/EventLogKosmos.kt
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2024 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.intentresolver.logging
+
+import com.android.internal.logging.InstanceId
+import com.android.systemui.kosmos.Kosmos
+
+var Kosmos.eventLog by Kosmos.Fixture { fakeEventLog }
+var Kosmos.fakeEventLog by Kosmos.Fixture { FakeEventLog(InstanceId.fakeInstanceId(0)) }
diff --git a/tests/shared/src/com/android/intentresolver/v2/data/model/FakeChooserRequest.kt b/tests/shared/src/com/android/intentresolver/v2/data/model/FakeChooserRequest.kt
new file mode 100644
index 00000000..e697a13d
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/v2/data/model/FakeChooserRequest.kt
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2024 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.intentresolver.v2.data.model
+
+import android.content.Intent
+import android.net.Uri
+
+fun fakeChooserRequest(
+ intent: Intent = Intent(),
+ packageName: String = "pkg",
+ referrer: Uri? = null,
+) = ChooserRequest(intent, packageName, referrer)
diff --git a/tests/shared/src/com/android/intentresolver/v2/data/repository/V2RepositoryKosmos.kt b/tests/shared/src/com/android/intentresolver/v2/data/repository/V2RepositoryKosmos.kt
new file mode 100644
index 00000000..ec6b2dec
--- /dev/null
+++ b/tests/shared/src/com/android/intentresolver/v2/data/repository/V2RepositoryKosmos.kt
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2024 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.intentresolver.v2.data.repository
+
+import com.android.intentresolver.v2.data.model.fakeChooserRequest
+import com.android.systemui.kosmos.Kosmos
+import com.android.systemui.kosmos.Kosmos.Fixture
+
+var Kosmos.chooserRequestRepository by Fixture {
+ ChooserRequestRepository(fakeChooserRequest(), emptyList())
+}