1// Copyright (C) 2021 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    // See: http://go/android-license-faq
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20// Source code used for test
21filegroup {
22    name: "launcher-tests-src",
23    srcs: [
24        "src/**/*.java",
25        "src/**/*.kt",
26        "multivalentTests/src/**/*.java",
27        "multivalentTests/src/**/*.kt",
28    ],
29    exclude_srcs: [
30        ":launcher-non-quickstep-tests-src",
31    ],
32}
33
34filegroup {
35    name: "launcher3-robo-src",
36    // multivalentTests directory is a shared folder for not only robolectric converted test
37    // classes but also shared helper classes.
38    srcs: [
39        "multivalentTests/src/**/*.java",
40        "multivalentTests/src/**/*.kt",
41        "src_deviceless/**/*.java",
42        "src_deviceless/**/*.kt",
43    ],
44}
45
46// Source code used for non-quickstep tests
47filegroup {
48    name: "launcher-non-quickstep-tests-src",
49    srcs: [
50        "src/com/android/launcher3/nonquickstep/**/*.java",
51        "src/com/android/launcher3/nonquickstep/**/*.kt",
52    ],
53}
54
55// Source code used for oop test helpers
56filegroup {
57    name: "launcher-oop-tests-src",
58    srcs: [
59        ":launcher-testing-helpers",
60        "src/com/android/launcher3/allapps/TaplOpenCloseAllAppsTest.java",
61        "src/com/android/launcher3/allapps/TaplAllAppsIconsWorkingTest.java",
62        "src/com/android/launcher3/appiconmenu/TaplAppIconMenuTest.java",
63        "src/com/android/launcher3/dragging/TaplDragTest.java",
64        "src/com/android/launcher3/dragging/TaplUninstallRemoveTest.java",
65        "src/com/android/launcher3/ui/TaplTestsLauncher3Test.java",
66        "src/com/android/launcher3/ui/workspace/TaplWorkspaceTest.java",
67    ],
68}
69
70// Library with all the dependencies for building quickstep
71android_library {
72    name: "Launcher3TestLib",
73    defaults: [
74        "launcher_compose_tests_defaults",
75    ],
76    srcs: [],
77    asset_dirs: ["assets"],
78    resource_dirs: ["res"],
79    static_libs: [
80        "flag-junit-base",
81        "launcher-aosp-tapl",
82        "androidx.test.core",
83        "androidx.test.runner",
84        "androidx.test.rules",
85        "androidx.test.ext.junit",
86        "androidx.test.espresso.core",
87        "androidx.test.espresso.contrib",
88        "androidx.test.espresso.intents",
89        "androidx.test.uiautomator_uiautomator",
90        "mockito-kotlin2",
91        "mockito-target-extended-minus-junit4",
92        "launcher_log_protos_lite",
93        "truth",
94        "kotlinx_coroutines_test",
95        "platform-test-rules",
96        "testables",
97        "com_android_launcher3_flags_lib",
98        "com_android_wm_shell_flags_lib",
99        "android.appwidget.flags-aconfig-java",
100        "platform-parametric-runner-lib",
101        "kotlin-reflect",
102    ],
103    manifest: "AndroidManifest-common.xml",
104    platform_apis: true,
105    // TODO(b/319712088): re-enable use_resource_processor
106    use_resource_processor: false,
107}
108
109android_library {
110    name: "Launcher3TestResources",
111    resource_dirs: ["res"],
112    asset_dirs: ["assets"],
113    // TODO(b/319712088): re-enable use_resource_processor
114    use_resource_processor: false,
115    static_libs: [
116        "kotlin-reflect",
117    ],
118}
119
120android_test {
121    name: "Launcher3Tests",
122    defaults: [
123        "launcher_compose_tests_defaults",
124    ],
125    srcs: [
126        ":launcher-tests-src",
127        ":launcher-non-quickstep-tests-src",
128    ],
129    static_libs: [
130        "Launcher3TestLib",
131        "com_android_launcher3_flags_lib",
132    ],
133    libs: [
134        "android.test.base.stubs.system",
135        "android.test.runner.stubs.system",
136        "android.test.mock.stubs.system",
137    ],
138    // Libraries used by mockito inline extended
139    jni_libs: [
140        "libdexmakerjvmtiagent",
141        "libstaticjvmtiagent",
142    ],
143    use_embedded_native_libs: false,
144    compile_multilib: "both",
145    instrumentation_for: "Launcher3",
146    manifest: "AndroidManifest.xml",
147    platform_apis: true,
148    test_config: "Launcher3Tests.xml",
149    data: [":Launcher3"],
150    plugins: ["dagger2-compiler"],
151    test_suites: ["general-tests"],
152}
153
154// Shared between tests and launcher
155android_library {
156    name: "launcher-testing-shared",
157    srcs: [
158        "multivalentTests/shared/com/android/launcher3/testing/shared/**/*.java",
159        "multivalentTests/shared/com/android/launcher3/testing/shared/**/*.kt",
160    ],
161    resource_dirs: [],
162    manifest: "multivalentTests/shared/AndroidManifest.xml",
163    sdk_version: "current",
164    min_sdk_version: min_launcher3_sdk_version,
165}
166
167filegroup {
168    name: "launcher-testing-helpers-robo",
169    srcs: [
170        "src/**/*.java",
171        "src/**/*.kt",
172        "multivalentTests/src/**/*.java",
173        "multivalentTests/src/**/*.kt",
174        "src/com/android/launcher3/ui/AbstractLauncherUiTest.java",
175        "src/com/android/launcher3/ui/BaseLauncherTaplTest.java",
176        "tapl/com/android/launcher3/tapl/*.java",
177        "tapl/com/android/launcher3/tapl/*.kt",
178    ],
179    exclude_srcs: [
180        // Test classes
181        "src/**/*Test.java",
182        "src/**/*Test.kt",
183        "src/**/RoboApiWrapper.kt",
184        "multivalentTests/src/**/*Test.java",
185        "multivalentTests/src/**/*Test.kt",
186    ],
187}
188
189filegroup {
190    name: "launcher-testing-helpers",
191    srcs: [
192        ":launcher-testing-helpers-robo",
193        "src/**/RoboApiWrapper.kt",
194    ],
195}
196
197android_robolectric_test {
198    enabled: true,
199    name: "Launcher3RoboTests",
200    srcs: [
201        ":launcher3-robo-src",
202        ":launcher-testing-helpers-robo",
203    ],
204    exclude_srcs: [
205        //"src/com/android/launcher3/util/CellContentDimensionsTest.kt", // Failing - b/316553889
206
207        // requires modification to work with inline mock maker
208        "src/com/android/launcher3/util/rule/StaticMockitoRule.java",
209    ],
210    java_resource_dirs: ["config"],
211    static_libs: [
212        "flag-junit-base",
213        "flag-junit",
214        "com_android_launcher3_flags_lib",
215        "com_android_wm_shell_flags_lib",
216        "androidx.test.uiautomator_uiautomator",
217        "androidx.core_core-animation-testing",
218        "androidx.test.ext.junit",
219        "androidx.test.espresso.core",
220        "androidx.test.espresso.contrib",
221        "androidx.test.espresso.intents",
222        "androidx.test.rules",
223        "uiautomator-helpers",
224        "inline-mockito-robolectric-prebuilt",
225        "mockito-kotlin-nodeps",
226        "platform-parametric-runner-lib",
227        "platform-test-rules-deviceless",
228        "testables",
229        "Launcher3TestResources",
230        "SystemUISharedLib",
231        "launcher-testing-shared",
232        "android.appwidget.flags-aconfig-java",
233    ],
234    libs: [
235        "android.test.runner.stubs.system",
236        "android.test.base.stubs.system",
237        "android.test.mock.stubs.system",
238        "truth",
239    ],
240    instrumentation_for: "Launcher3",
241    plugins: ["dagger2-compiler"],
242    upstream: true,
243    strict_mode: false,
244}
245