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/widget/TaplWidgetPickerTest.java",
67        "src/com/android/launcher3/ui/workspace/TaplWorkspaceTest.java",
68    ],
69}
70
71// Library with all the dependencies for building quickstep
72android_library {
73    name: "Launcher3TestLib",
74    srcs: [],
75    asset_dirs: ["assets"],
76    resource_dirs: ["res"],
77    static_libs: [
78        "flag-junit-base",
79        "launcher-aosp-tapl",
80        "androidx.test.core",
81        "androidx.test.runner",
82        "androidx.test.rules",
83        "androidx.test.ext.junit",
84        "androidx.test.espresso.core",
85        "androidx.test.espresso.contrib",
86        "androidx.test.espresso.intents",
87        "androidx.test.uiautomator_uiautomator",
88        "mockito-kotlin2",
89        "mockito-target-extended-minus-junit4",
90        "launcher_log_protos_lite",
91        "truth",
92        "kotlinx_coroutines_test",
93        "platform-test-rules",
94        "testables",
95        "com_android_launcher3_flags_lib",
96        "com_android_wm_shell_flags_lib",
97        "android.appwidget.flags-aconfig-java",
98    ],
99    manifest: "AndroidManifest-common.xml",
100    platform_apis: true,
101    // TODO(b/319712088): re-enable use_resource_processor
102    use_resource_processor: false,
103}
104
105android_library {
106    name: "Launcher3TestResources",
107    resource_dirs: ["res"],
108    asset_dirs: ["assets"],
109    // TODO(b/319712088): re-enable use_resource_processor
110    use_resource_processor: false,
111}
112
113android_test {
114    name: "Launcher3Tests",
115    srcs: [
116        ":launcher-tests-src",
117        ":launcher-non-quickstep-tests-src",
118    ],
119    static_libs: [
120        "Launcher3TestLib",
121        "com_android_launcher3_flags_lib",
122    ],
123    libs: [
124        "android.test.base",
125        "android.test.runner",
126        "android.test.mock",
127    ],
128    // Libraries used by mockito inline extended
129    jni_libs: [
130        "libdexmakerjvmtiagent",
131        "libstaticjvmtiagent",
132    ],
133    use_embedded_native_libs: false,
134    compile_multilib: "both",
135    instrumentation_for: "Launcher3",
136    manifest: "AndroidManifest.xml",
137    platform_apis: true,
138    test_config: "Launcher3Tests.xml",
139    data: [":Launcher3"],
140    test_suites: ["general-tests"],
141}
142
143// Shared between tests and launcher
144android_library {
145    name: "launcher-testing-shared",
146    srcs: [
147        "multivalentTests/shared/com/android/launcher3/testing/shared/**/*.java",
148        "multivalentTests/shared/com/android/launcher3/testing/shared/**/*.kt",
149    ],
150    resource_dirs: [],
151    manifest: "multivalentTests/shared/AndroidManifest.xml",
152    sdk_version: "current",
153    min_sdk_version: min_launcher3_sdk_version,
154}
155
156filegroup {
157    name: "launcher-testing-helpers",
158    srcs: [
159        "src/**/*.java",
160        "src/**/*.kt",
161        "multivalentTests/src/**/*.java",
162        "multivalentTests/src/**/*.kt",
163        "src/com/android/launcher3/ui/AbstractLauncherUiTest.java",
164        "tapl/com/android/launcher3/tapl/*.java",
165        "tapl/com/android/launcher3/tapl/*.kt",
166    ],
167    exclude_srcs: [
168        // Test classes
169        "src/**/*Test.java",
170        "src/**/*Test.kt",
171        "multivalentTests/src/**/*Test.java",
172        "multivalentTests/src/**/*Test.kt",
173    ],
174}
175
176android_robolectric_test {
177    enabled: true,
178    name: "Launcher3RoboTests",
179    srcs: [
180        ":launcher3-robo-src",
181
182        // Test util classes
183        ":launcher-testing-helpers",
184        ":launcher-testing-shared",
185    ],
186    exclude_srcs: [
187        //"src/com/android/launcher3/util/CellContentDimensionsTest.kt", // Failing - b/316553889
188
189        // requires modification to work with inline mock maker
190        "src/com/android/launcher3/util/rule/StaticMockitoRule.java",
191    ],
192    java_resource_dirs: ["config"],
193    static_libs: [
194        "flag-junit-base",
195        "flag-junit",
196        "com_android_launcher3_flags_lib",
197        "com_android_wm_shell_flags_lib",
198        "androidx.test.uiautomator_uiautomator",
199        "androidx.core_core-animation-testing",
200        "androidx.test.ext.junit",
201        "androidx.test.espresso.core",
202        "androidx.test.espresso.contrib",
203        "androidx.test.espresso.intents",
204        "androidx.test.rules",
205        "uiautomator-helpers",
206        "inline-mockito-robolectric-prebuilt",
207        "mockito-kotlin-nodeps",
208        "platform-parametric-runner-lib",
209        "platform-test-rules-deviceless",
210        "testables",
211        "Launcher3TestResources",
212        "SystemUISharedLib",
213        "launcher-testing-shared",
214        "android.appwidget.flags-aconfig-java",
215    ],
216    libs: [
217        "android.test.runner",
218        "android.test.base",
219        "android.test.mock",
220        "truth",
221    ],
222    instrumentation_for: "Launcher3",
223    upstream: true,
224    strict_mode: false,
225}
226