diff options
author | Himanshu Dagar <dagarhimanshu@google.com> | 2022-02-11 14:45:51 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2022-02-11 14:45:51 +0000 |
commit | e8088250f9fd57d39ee98802ed9710ba9b28f2b1 (patch) | |
tree | 896e7a60924ba79e3ef2fb07c30efb69efa65cfa | |
parent | 26e964a42a8c37a5acbd1cec6bdb690d8cd6e181 (diff) | |
parent | 0d194000e1720d2ee0f54ce646ec44af4c932c98 (diff) | |
download | cts-e8088250f9fd57d39ee98802ed9710ba9b28f2b1.tar.gz |
Merge "AppCloning test-suite creation along with the migration of CTS tests" into sc-mainline-prod
-rw-r--r-- | hostsidetests/appcloning/Android.bp | 38 | ||||
-rw-r--r-- | hostsidetests/appcloning/AndroidTestAppCloning.xml (renamed from hostsidetests/scopedstorage/AndroidTestAppCloning.xml) | 32 | ||||
-rw-r--r-- | hostsidetests/appcloning/OWNERS | 6 | ||||
-rw-r--r-- | hostsidetests/appcloning/TEST_MAPPING | 7 | ||||
-rw-r--r-- | hostsidetests/appcloning/hostside/src/com/android/cts/appcloning/AppCloningHostTest.java (renamed from hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/AppCloningHostTest.java) | 36 | ||||
-rw-r--r-- | hostsidetests/appcloning/hostside/src/com/android/cts/appcloning/BaseHostTestCase.java | 108 | ||||
-rw-r--r-- | hostsidetests/appcloning/test-apps/AppCloningTestApp/Android.bp | 31 | ||||
-rw-r--r-- | hostsidetests/appcloning/test-apps/AppCloningTestApp/AndroidManifest.xml | 32 | ||||
-rw-r--r-- | hostsidetests/appcloning/test-apps/AppCloningTestApp/src/com/android/cts/appcloningtestapp/AppCloningDeviceTest.java | 25 | ||||
-rw-r--r-- | hostsidetests/scopedstorage/Android.bp | 171 |
10 files changed, 416 insertions, 70 deletions
diff --git a/hostsidetests/appcloning/Android.bp b/hostsidetests/appcloning/Android.bp new file mode 100644 index 00000000000..f1ecc4be33b --- /dev/null +++ b/hostsidetests/appcloning/Android.bp @@ -0,0 +1,38 @@ +// Copyright (C) 2022 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +java_test_host { + name: "CtsAppCloningHostTest", + srcs: [ + "hostside/src/**/AppCloningHostTest.java", + "hostside/src/**/BaseHostTestCase.java", + ], + libs: [ + "cts-tradefed", + "tradefed", + "testng", + ], + // tag the module as cts a test artifact + test_suites: [ + "general-tests", + "mts-mediaprovider", + "cts", + ], + test_config: "AndroidTestAppCloning.xml", + data: [":CtsAppCloningTestApp"], +} diff --git a/hostsidetests/scopedstorage/AndroidTestAppCloning.xml b/hostsidetests/appcloning/AndroidTestAppCloning.xml index 03802f23886..8c882eb773a 100644 --- a/hostsidetests/scopedstorage/AndroidTestAppCloning.xml +++ b/hostsidetests/appcloning/AndroidTestAppCloning.xml @@ -1,29 +1,29 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2021 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. ---> +<!-- + ~ Copyright (C) 2022 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. + --> <configuration description="Test for App cloning support with clone user profiles"> <option name="test-suite-tag" value="cts" /> <option name="config-descriptor:metadata" key="component" value="framework" /> <option name="config-descriptor:metadata" key="parameter" value="instant_app" /> <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" /> - <!-- TODO(b/169101565): change to secondary_user when fixed --> <!-- Clone user profile is meant to exist only alongside a real system user. It does not exist for a headless system user, or a secondary user --> <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" /> <test class="com.android.tradefed.testtype.HostTest" > - <option name="class" value="android.scopedstorage.cts.host.AppCloningHostTest" /> + <option name="class" value="com.android.cts.appcloning.AppCloningHostTest" /> </test> <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController"> diff --git a/hostsidetests/appcloning/OWNERS b/hostsidetests/appcloning/OWNERS new file mode 100644 index 00000000000..7cc93143726 --- /dev/null +++ b/hostsidetests/appcloning/OWNERS @@ -0,0 +1,6 @@ +# Bug component: 1029024 +saumyap@google.com +maco@google.com +dagarhimanshu@google.com +sarup@google.com +sailendrabathi@google.com
\ No newline at end of file diff --git a/hostsidetests/appcloning/TEST_MAPPING b/hostsidetests/appcloning/TEST_MAPPING new file mode 100644 index 00000000000..f512df95a6c --- /dev/null +++ b/hostsidetests/appcloning/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "presubmit": [ + { + "name": "CtsAppCloningHostTest" + } + ] +}
\ No newline at end of file diff --git a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/AppCloningHostTest.java b/hostsidetests/appcloning/hostside/src/com/android/cts/appcloning/AppCloningHostTest.java index 9522731fe5d..ce7356c5966 100644 --- a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/AppCloningHostTest.java +++ b/hostsidetests/appcloning/hostside/src/com/android/cts/appcloning/AppCloningHostTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.scopedstorage.cts.host; +package com.android.cts.appcloning; import static com.google.common.truth.Truth.assertThat; @@ -34,36 +34,39 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import java.util.ArrayList; -import java.util.List; - /** * Runs the AppCloning tests. */ @RunWith(DeviceJUnit4ClassRunner.class) @AppModeFull public class AppCloningHostTest extends BaseHostTestCase { - private static final String APP_A = "CtsScopedStorageTestAppA.apk"; - private static final String APP_A_PACKAGE = "android.scopedstorage.cts.testapp.A.withres"; + + private static final String APP_A = "CtsAppCloningTestApp.apk"; + private static final String APP_A_PACKAGE = "com.android.cts.appcloningtestapp"; + private static final String CONTENT_PROVIDER_URL = "content://android.tradefed.contentprovider"; private static final int CLONE_PROFILE_DIRECTORY_CREATION_TIMEOUT_MS = 20000; + private String mCloneUserId; private ContentProviderHandler mContentProviderHandler; - @Before public void setup() throws Exception { assumeFalse("Device is in headless system user mode", isHeadlessSystemUserMode()); assumeTrue(isAtLeastS()); assumeFalse("Device uses sdcardfs", usesSdcardFs()); + // create clone user String output = executeShellCommand( "pm create-user --profileOf 0 --user-type android.os.usertype.profile.CLONE " + "testUser"); - mCloneUserId = output.substring(output.lastIndexOf(' ') + 1).replaceAll("[^0-9]", ""); + mCloneUserId = output.substring(output.lastIndexOf(' ') + 1).replaceAll("[^0-9]", + ""); assertThat(mCloneUserId).isNotEmpty(); + CommandResult out = executeShellV2Command("am start-user -w %s", mCloneUserId); assertThat(out.getStderr()).isEmpty(); + mContentProviderHandler = new ContentProviderHandler(getDevice()); mContentProviderHandler.setUp(); } @@ -74,6 +77,8 @@ public class AppCloningHostTest extends BaseHostTestCase { if (mContentProviderHandler != null) { mContentProviderHandler.tearDown(); } + + // remove the clone user executeShellCommand("pm remove-user %s", mCloneUserId); } @@ -92,7 +97,8 @@ public class AppCloningHostTest extends BaseHostTestCase { eventually(() -> { // Wait for finish. assertThat(isSuccessful( - runContentProviderCommand("query", mCloneUserId, "/sdcard", ""))).isTrue(); + runContentProviderCommand("query", mCloneUserId, + "/sdcard", ""))).isTrue(); }, CLONE_PROFILE_DIRECTORY_CREATION_TIMEOUT_MS); // Create a file on the clone user storage @@ -101,16 +107,19 @@ public class AppCloningHostTest extends BaseHostTestCase { eventually(() -> { // Wait for finish. assertThat(isSuccessful( - runContentProviderCommand("write", mCloneUserId, "/sdcard/testFile.txt", + runContentProviderCommand("write", mCloneUserId, + "/sdcard/testFile.txt", "< /sdcard/testFile.txt"))).isTrue(); }, CLONE_PROFILE_DIRECTORY_CREATION_TIMEOUT_MS); // Check that the above created file exists on the clone user storage - out = runContentProviderCommand("query", mCloneUserId, "/sdcard/testFile.txt", ""); + out = runContentProviderCommand("query", mCloneUserId, + "/sdcard/testFile.txt", ""); assertThat(isSuccessful(out)).isTrue(); // Cleanup the created file - out = runContentProviderCommand("delete", mCloneUserId, "/sdcard/testFile.txt", ""); + out = runContentProviderCommand("delete", mCloneUserId, + "/sdcard/testFile.txt", ""); assertThat(isSuccessful(out)).isTrue(); } @@ -136,7 +145,6 @@ public class AppCloningHostTest extends BaseHostTestCase { } private boolean usesSdcardFs() throws Exception { - List<String> mounts = new ArrayList<>(); CommandResult out = executeShellV2Command("cat /proc/mounts"); assertThat(isSuccessful(out)).isTrue(); for (String line : out.getStdout().split("\n")) { @@ -147,6 +155,4 @@ public class AppCloningHostTest extends BaseHostTestCase { } return false; } - - } diff --git a/hostsidetests/appcloning/hostside/src/com/android/cts/appcloning/BaseHostTestCase.java b/hostsidetests/appcloning/hostside/src/com/android/cts/appcloning/BaseHostTestCase.java new file mode 100644 index 00000000000..3d301f1b7ca --- /dev/null +++ b/hostsidetests/appcloning/hostside/src/com/android/cts/appcloning/BaseHostTestCase.java @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2022 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.cts.appcloning; + +import com.android.tradefed.device.DeviceNotAvailableException; +import com.android.tradefed.device.ITestDevice; +import com.android.tradefed.device.NativeDevice; +import com.android.tradefed.log.LogUtil.CLog; +import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test; +import com.android.tradefed.util.CommandResult; +import com.android.tradefed.util.CommandStatus; + + +abstract class BaseHostTestCase extends BaseHostJUnit4Test { + private int mCurrentUserId = NativeDevice.INVALID_USER_ID; + private static final String ERROR_MESSAGE_TAG = "[ERROR]"; + + protected String executeShellCommand(String cmd, Object... args) throws Exception { + return getDevice().executeShellCommand(String.format(cmd, args)); + } + + protected CommandResult executeShellV2Command(String cmd, Object... args) throws Exception { + return getDevice().executeShellV2Command(String.format(cmd, args)); + } + + protected boolean isPackageInstalled(String packageName, String userId) throws Exception { + return getDevice().isPackageInstalled(packageName, userId); + } + + // TODO (b/174775905) remove after exposing the check from ITestDevice. + protected boolean isHeadlessSystemUserMode() throws DeviceNotAvailableException { + String result = getDevice() + .executeShellCommand("getprop ro.fw.mu.headless_system_user").trim(); + return "true".equalsIgnoreCase(result); + } + + protected boolean isAtLeastS() throws DeviceNotAvailableException { + return getDevice().getApiLevel() >= 31 /* BUILD.VERSION_CODES.S */; + } + + protected static void eventually(ThrowingRunnable r, long timeoutMillis) { + long start = System.currentTimeMillis(); + + while (true) { + try { + r.run(); + return; + } catch (Throwable e) { + if (System.currentTimeMillis() - start < timeoutMillis) { + try { + Thread.sleep(100); + } catch (InterruptedException ignored) { + throw new RuntimeException(e); + } + } else { + throw new RuntimeException(e); + } + } + } + } + + protected int getCurrentUserId() throws Exception { + setCurrentUserId(); + + return mCurrentUserId; + } + + protected boolean isSuccessful(CommandResult result) { + if (!CommandStatus.SUCCESS.equals(result.getStatus())) { + return false; + } + String stdout = result.getStdout(); + if (stdout.contains(ERROR_MESSAGE_TAG)) { + return false; + } + String stderr = result.getStderr(); + return (stderr == null || stderr.trim().isEmpty()); + } + + private void setCurrentUserId() throws Exception { + if (mCurrentUserId != NativeDevice.INVALID_USER_ID) return; + + ITestDevice device = getDevice(); + mCurrentUserId = device.getCurrentUser(); + CLog.i("Current user: %d"); + } + + protected interface ThrowingRunnable { + /** + * Similar to {@link Runnable#run} but has {@code throws Exception}. + */ + void run() throws Exception; + } +} diff --git a/hostsidetests/appcloning/test-apps/AppCloningTestApp/Android.bp b/hostsidetests/appcloning/test-apps/AppCloningTestApp/Android.bp new file mode 100644 index 00000000000..b3edfec5112 --- /dev/null +++ b/hostsidetests/appcloning/test-apps/AppCloningTestApp/Android.bp @@ -0,0 +1,31 @@ +// Copyright (C) 2022 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +android_test_helper_app { + name: "CtsAppCloningTestApp", + defaults: ["cts_defaults"], + static_libs: [ + "androidx.test.rules", + "truth-prebuilt", + "cts-install-lib", + ], + srcs: ["src/**/*.java"], + sdk_version: "test_current", + target_sdk_version: "current", + min_sdk_version: "30", +} diff --git a/hostsidetests/appcloning/test-apps/AppCloningTestApp/AndroidManifest.xml b/hostsidetests/appcloning/test-apps/AppCloningTestApp/AndroidManifest.xml new file mode 100644 index 00000000000..07d78a0ead2 --- /dev/null +++ b/hostsidetests/appcloning/test-apps/AppCloningTestApp/AndroidManifest.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2022 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. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.cts.appcloningtestapp" + android:versionCode="1" + android:versionName="1.0" > + + <uses-sdk android:minSdkVersion="30" /> + + <application> + <uses-library android:name="android.test.runner" /> + </application> + + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="com.android.cts.appcloningtestapp" /> + +</manifest>
\ No newline at end of file diff --git a/hostsidetests/appcloning/test-apps/AppCloningTestApp/src/com/android/cts/appcloningtestapp/AppCloningDeviceTest.java b/hostsidetests/appcloning/test-apps/AppCloningTestApp/src/com/android/cts/appcloningtestapp/AppCloningDeviceTest.java new file mode 100644 index 00000000000..46480f7cd78 --- /dev/null +++ b/hostsidetests/appcloning/test-apps/AppCloningTestApp/src/com/android/cts/appcloningtestapp/AppCloningDeviceTest.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2022 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.cts.appcloningtestapp; + +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class AppCloningDeviceTest { + private static final String TAG = "AppCloningDeviceTest"; +} diff --git a/hostsidetests/scopedstorage/Android.bp b/hostsidetests/scopedstorage/Android.bp index 689141f98e1..808a00d2c2a 100644 --- a/hostsidetests/scopedstorage/Android.bp +++ b/hostsidetests/scopedstorage/Android.bp @@ -25,8 +25,13 @@ android_test_helper_app { min_sdk_version: "30", srcs: ["ScopedStorageTestHelper/src/**/*.java"], // Tag as a CTS artifact - test_suites: ["general-tests", "mts-mediaprovider", "cts"], + test_suites: [ + "general-tests", + "mts-mediaprovider", + "cts", + ], } + android_test_helper_app { name: "CtsScopedStorageTestAppB", manifest: "ScopedStorageTestHelper/TestAppB.xml", @@ -36,8 +41,13 @@ android_test_helper_app { min_sdk_version: "30", srcs: ["ScopedStorageTestHelper/src/**/*.java"], // Tag as a CTS artifact - test_suites: ["general-tests", "mts-mediaprovider", "cts"], + test_suites: [ + "general-tests", + "mts-mediaprovider", + "cts", + ], } + android_test_helper_app { name: "CtsScopedStorageTestAppC", manifest: "ScopedStorageTestHelper/TestAppC.xml", @@ -47,8 +57,13 @@ android_test_helper_app { min_sdk_version: "30", srcs: ["ScopedStorageTestHelper/src/**/*.java"], // Tag as a CTS artifact - test_suites: ["general-tests", "mts-mediaprovider", "cts"], + test_suites: [ + "general-tests", + "mts-mediaprovider", + "cts", + ], } + android_test_helper_app { name: "CtsScopedStorageTestAppC30", manifest: "ScopedStorageTestHelper/TestAppC30.xml", @@ -58,8 +73,13 @@ android_test_helper_app { min_sdk_version: "30", srcs: ["ScopedStorageTestHelper/src/**/*.java"], // Tag as a CTS artifact - test_suites: ["general-tests", "mts", "cts"], + test_suites: [ + "general-tests", + "mts", + "cts", + ], } + android_test_helper_app { name: "CtsScopedStorageTestAppCLegacy", manifest: "ScopedStorageTestHelper/TestAppCLegacy.xml", @@ -69,8 +89,13 @@ android_test_helper_app { min_sdk_version: "28", srcs: ["ScopedStorageTestHelper/src/**/*.java"], // Tag as a CTS artifact - test_suites: ["general-tests", "mts-mediaprovider", "cts"], + test_suites: [ + "general-tests", + "mts-mediaprovider", + "cts", + ], } + android_test_helper_app { name: "CtsScopedStorageTestAppDLegacy", manifest: "ScopedStorageTestHelper/TestAppDLegacy.xml", @@ -80,7 +105,11 @@ android_test_helper_app { min_sdk_version: "28", srcs: ["ScopedStorageTestHelper/src/**/*.java"], // Tag as a CTS artifact - test_suites: ["general-tests", "mts-mediaprovider", "cts"], + test_suites: [ + "general-tests", + "mts-mediaprovider", + "cts", + ], } android_test_helper_app { @@ -92,8 +121,13 @@ android_test_helper_app { min_sdk_version: "30", srcs: ["ScopedStorageTestHelper/src/**/*.java"], // Tag as a CTS artifact - test_suites: ["general-tests", "mts-mediaprovider", "cts"], + test_suites: [ + "general-tests", + "mts-mediaprovider", + "cts", + ], } + android_test_helper_app { name: "CtsScopedStorageTestAppFileManagerBypassDB", manifest: "ScopedStorageTestHelper/TestAppFileManagerBypassDB.xml", @@ -103,8 +137,13 @@ android_test_helper_app { min_sdk_version: "30", srcs: ["ScopedStorageTestHelper/src/**/*.java"], // Tag as a CTS artifact - test_suites: ["general-tests", "mts", "cts"], + test_suites: [ + "general-tests", + "mts", + "cts", + ], } + android_test_helper_app { name: "CtsScopedStorageTestAppSystemGalleryBypassDB", manifest: "ScopedStorageTestHelper/TestAppSystemGalleryBypassDB.xml", @@ -114,8 +153,13 @@ android_test_helper_app { min_sdk_version: "30", srcs: ["ScopedStorageTestHelper/src/**/*.java"], // Tag as a CTS artifact - test_suites: ["general-tests", "mts", "cts"], + test_suites: [ + "general-tests", + "mts", + "cts", + ], } + android_test_helper_app { name: "CtsScopedStorageTestAppSystemGallery30BypassDB", manifest: "ScopedStorageTestHelper/TestAppSystemGallery30BypassDB.xml", @@ -125,7 +169,11 @@ android_test_helper_app { min_sdk_version: "30", srcs: ["ScopedStorageTestHelper/src/**/*.java"], // Tag as a CTS artifact - test_suites: ["general-tests", "mts", "cts"], + test_suites: [ + "general-tests", + "mts", + "cts", + ], } android_test_helper_app { @@ -150,9 +198,16 @@ android_test { name: "ScopedStorageTest", manifest: "AndroidManifest.xml", srcs: ["src/**/*.java"], - static_libs: ["truth-prebuilt", "cts-scopedstorage-lib"], + static_libs: [ + "truth-prebuilt", + "cts-scopedstorage-lib", + ], compile_multilib: "both", - test_suites: ["general-tests", "mts-mediaprovider", "cts"], + test_suites: [ + "general-tests", + "mts-mediaprovider", + "cts", + ], sdk_version: "test_current", target_sdk_version: "31", min_sdk_version: "30", @@ -161,40 +216,67 @@ android_test { ":CtsScopedStorageTestAppB", ":CtsScopedStorageTestAppC", ":CtsScopedStorageTestAppCLegacy", - ] + ], } android_test { name: "LegacyStorageTest", manifest: "legacy/AndroidManifest.xml", srcs: ["legacy/src/**/*.java"], - static_libs: ["truth-prebuilt", "cts-scopedstorage-lib"], + static_libs: [ + "truth-prebuilt", + "cts-scopedstorage-lib", + ], compile_multilib: "both", - test_suites: ["general-tests", "mts-mediaprovider", "cts"], + test_suites: [ + "general-tests", + "mts-mediaprovider", + "cts", + ], sdk_version: "test_current", target_sdk_version: "29", min_sdk_version: "30", java_resources: [ ":CtsScopedStorageTestAppA", - ] + ], } java_test_host { name: "CtsScopedStorageCoreHostTest", - srcs: [ + srcs: [ "host/src/android/scopedstorage/cts/host/ScopedStorageCoreHostTest.java", - "host/src/android/scopedstorage/cts/host/BaseHostTestCase.java" + "host/src/android/scopedstorage/cts/host/BaseHostTestCase.java", + ], + libs: [ + "cts-tradefed", + "tradefed", + "testng", + ], + test_suites: [ + "general-tests", + "mts-mediaprovider", + "cts", ], - libs: ["cts-tradefed", "tradefed", "testng"], - test_suites: ["general-tests", "mts-mediaprovider", "cts"], test_config: "CoreTest.xml", } java_test_host { name: "CtsScopedStorageHostTest", srcs: ["host/src/**/*.java"], - libs: ["cts-tradefed", "tradefed", "testng"], - test_suites: ["general-tests", "mts-mediaprovider", "cts"], + libs: [ + "cts-tradefed", + "tradefed", + "testng", + ], + static_libs: [ + "modules-utils-build-testing", + "compatibility-host-util", + ], + test_suites: [ + "general-tests", + "mts-mediaprovider", + "cts", + ], test_config: "AndroidTest.xml", data: [ ":CtsLegacyStorageTestAppRequestLegacy", @@ -205,20 +287,20 @@ java_test_host { java_test_host { name: "CtsScopedStoragePublicVolumeHostTest", srcs: ["host/src/**/*.java"], - libs: ["cts-tradefed", "tradefed", "testng"], - test_suites: ["general-tests", "mts-mediaprovider"], - test_config: "PublicVolumeTest.xml", -} - -java_test_host { - name: "CtsAppCloningHostTest", - srcs: [ - "host/src/android/scopedstorage/cts/host/AppCloningHostTest.java", - "host/src/android/scopedstorage/cts/host/BaseHostTestCase.java" + libs: [ + "cts-tradefed", + "tradefed", + "testng", + ], + static_libs: [ + "modules-utils-build-testing", + "compatibility-host-util", + ], + test_suites: [ + "general-tests", + "mts-mediaprovider", ], - libs: ["cts-tradefed", "tradefed", "testng"], - test_suites: ["general-tests", "mts-mediaprovider", "cts"], - test_config: "AndroidTestAppCloning.xml", + test_config: "PublicVolumeTest.xml", } android_test { @@ -226,13 +308,24 @@ android_test { manifest: "device/AndroidManifest.xml", test_config: "device/AndroidTest.xml", srcs: ["device/**/*.java"], - static_libs: ["truth-prebuilt", "cts-scopedstorage-lib",], + static_libs: [ + "truth-prebuilt", + "cts-scopedstorage-lib", + ], compile_multilib: "both", - test_suites: ["general-tests", "mts-mediaprovider", "cts"], + test_suites: [ + "general-tests", + "mts-mediaprovider", + "cts", + ], sdk_version: "test_current", target_sdk_version: "31", min_sdk_version: "30", - libs: ["android.test.base", "android.test.mock", "android.test.runner",], + libs: [ + "android.test.base", + "android.test.mock", + "android.test.runner", + ], java_resources: [ ":CtsScopedStorageTestAppA", ":CtsScopedStorageTestAppB", @@ -244,5 +337,5 @@ android_test { ":CtsScopedStorageTestAppFileManagerBypassDB", ":CtsScopedStorageTestAppSystemGalleryBypassDB", ":CtsScopedStorageTestAppSystemGallery30BypassDB", - ] + ], } |