diff options
Diffstat (limited to 'tests/automotive')
69 files changed, 300 insertions, 1765 deletions
diff --git a/tests/automotive/functional/mediacenter/Android.bp b/tests/automotive/functional/mediacenter/Android.bp index ada76da2f..5e3b35cdc 100644 --- a/tests/automotive/functional/mediacenter/Android.bp +++ b/tests/automotive/functional/mediacenter/Android.bp @@ -22,6 +22,7 @@ android_test { static_libs: [ "androidx.test.runner", "androidx.test.rules", + "automotive-home-helper", "automotive-media-center-app-helper", "automotive-utility-helper", "app-helpers-auto-interfaces", diff --git a/tests/automotive/functional/mediacenter/src/android/platform/tests/OpenAppFromMediaCenterTest.java b/tests/automotive/functional/mediacenter/src/android/platform/tests/OpenAppFromMediaCenterTest.java new file mode 100644 index 000000000..ad183cfca --- /dev/null +++ b/tests/automotive/functional/mediacenter/src/android/platform/tests/OpenAppFromMediaCenterTest.java @@ -0,0 +1,100 @@ +/* + * 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. + */ + +package android.platform.tests; + +import static junit.framework.Assert.assertFalse; +import static junit.framework.Assert.assertTrue; + +import android.platform.helpers.AutoUtility; +import android.platform.helpers.IAutoHomeHelper; +import android.platform.helpers.IAutoMediaHelper; +import android.platform.helpers.HelperAccessor; +import android.platform.helpers.HomeHelperImpl; +import android.platform.test.option.StringOption; +import androidx.test.runner.AndroidJUnit4; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(AndroidJUnit4.class) +public class OpenAppFromMediaCenterTest { + private static final String BLUETOOTH_APP = "bluetooth-app"; + private static final String MEDIA_APPS = "media-apps"; + + private static final String DEFAULT_MEDIA_APP = "Bluetooth Audio"; + private static final String DEFAULT_LIST_OF_MEDIA_APPS = "Bluetooth Audio, Radio"; + + @ClassRule + public static StringOption mMediaDefaultApp = + new StringOption(BLUETOOTH_APP).setRequired(false); + @ClassRule + public static StringOption mMediaApps = new StringOption(MEDIA_APPS).setRequired(false); + + private HelperAccessor<IAutoMediaHelper> mMediaCenterHelper; + private HelperAccessor<IAutoHomeHelper> mAutoHomeHelper; + + public OpenAppFromMediaCenterTest() { + mMediaCenterHelper = new HelperAccessor<>(IAutoMediaHelper.class); + mAutoHomeHelper = new HelperAccessor<>(IAutoHomeHelper.class); + } + + @BeforeClass + public static void exitSuw() { + AutoUtility.exitSuw(); + } + + @Test + public void testOpenMediaAppFromMediaWidget() { + // Use preinstalled "Bluetooth Audio" app + mAutoHomeHelper.get().openMediaWidget(); + assertTrue("Not a media app", + mMediaCenterHelper.get().getMediaAppTitle().equals(getDefaultMediaAppName())); + } + + @Test + public void testMediaAppPresentInMediaGrid() { + mAutoHomeHelper.get().openMediaWidget(); + mMediaCenterHelper.get().openMediaAppMenuItems(); + assertTrue("Incorrect Media apps in Grid", + mMediaCenterHelper.get().areMediaAppsPresent(getExpectedMediaAppNames())); + } + + private String getDefaultMediaAppName() { + String mediaAppName = DEFAULT_MEDIA_APP; + if (mMediaDefaultApp != null + && mMediaDefaultApp.get() != null && !mMediaDefaultApp.get().isEmpty()) { + mediaAppName = mMediaDefaultApp.get(); + } + return mediaAppName; + } + + private List<String> getExpectedMediaAppNames() { + String mediaAppNames = DEFAULT_LIST_OF_MEDIA_APPS; + if (mMediaApps != null && mMediaApps.get() != null && !mMediaApps.get().isEmpty()) { + // Get list of media apps from String options if passed. + mediaAppNames = mMediaApps.get(); + } + String[] mediaAppNamesList = mediaAppNames.trim().split("\\s*,\\s*"); + return Arrays.asList(mediaAppNamesList); + } +} diff --git a/tests/automotive/health/evs/tests/Android.bp b/tests/automotive/functional/multiuser/Android.bp index 544ba268e..c97679f12 100644 --- a/tests/automotive/health/evs/tests/Android.bp +++ b/tests/automotive/functional/multiuser/Android.bp @@ -17,23 +17,30 @@ package { } android_test { - name: "AndroidAutomotiveEvsScenarioTests", + name: "AndroidAutomotiveMultiuserTests", min_sdk_version: "24", static_libs: [ "androidx.test.runner", "androidx.test.rules", - "automotive-settings-scenarios", - "automotive-evs-scenarios", + "automotive-multiuser-scenarios", + "automotive-utility-helper", "automotive-health-test-rules", "automotive-settings-app-helper", + "app-helpers-common-interfaces", "app-helpers-auto-interfaces", "ub-uiautomator", "collector-device-lib-platform", "common-platform-scenarios", "common-platform-scenario-tests", "microbenchmark-device-lib", + "platform-test-rules", "platform-test-options", + "multi-user-helper", + "microbenchmark-device-lib", + "longevity-device-lib", ], srcs: ["src/**/*.java"], + certificate: "platform", test_suites: ["catbox"], + privileged: true, } diff --git a/tests/automotive/functional/multiuser/AndroidManifest.xml b/tests/automotive/functional/multiuser/AndroidManifest.xml new file mode 100644 index 000000000..3a5447104 --- /dev/null +++ b/tests/automotive/functional/multiuser/AndroidManifest.xml @@ -0,0 +1,37 @@ +<?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. +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="android.platform.tests" > + <uses-sdk android:minSdkVersion="24" android:targetSdkVersion="24" /> + <uses-permission android:name="android.permission.DUMP" /> + <uses-permission android:name="android.permission.MANAGE_ACTIVITY_TASKS"/> + <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" /> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> + <uses-permission android:name="android.Manifest.permission.MANAGE_USERS" /> + <uses-permission android:name="android.permission.MANAGE_USERS" /> + <uses-permission android:name="android.permission.CREATE_USERS" /> + <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" /> + <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" /> + + <application> + <uses-library android:name="android.test.runner"/> + </application> + <instrumentation + android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="android.platform.tests" + android:label="Android Automotive Multiuser Functional Tests" /> +</manifest>
\ No newline at end of file diff --git a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/AddUserQuickSettings.java b/tests/automotive/functional/multiuser/src/android/platform/tests/AddUserQuickSettings.java index a6505a4f0..637c76f76 100644 --- a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/AddUserQuickSettings.java +++ b/tests/automotive/functional/multiuser/src/android/platform/tests/AddUserQuickSettings.java @@ -14,16 +14,17 @@ * limitations under the License. */ -package android.platform.scenario.multiuser; +package android.platform.tests; import static junit.framework.Assert.assertTrue; import android.content.pm.UserInfo; import android.platform.helpers.AutoUtility; import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoProfileHelper; +import android.platform.helpers.IAutoUserHelper; import android.platform.helpers.IAutoSettingHelper; import android.platform.helpers.MultiUserHelper; +import android.platform.scenario.multiuser.MultiUserConstants; import androidx.test.runner.AndroidJUnit4; import org.junit.After; import org.junit.BeforeClass; @@ -32,19 +33,17 @@ import org.junit.runner.RunWith; /** * This test will create user through API and delete the same user from UI - * - * <p>It should be running under user 0, otherwise instrumentation may be killed after user - * switched. + * <p> Set system property to run MU test: adb shell setprop fw.stop_bg_users_on_switch 0 */ @RunWith(AndroidJUnit4.class) public class AddUserQuickSettings { private final MultiUserHelper mMultiUserHelper = MultiUserHelper.getInstance(); - private HelperAccessor<IAutoProfileHelper> mProfilesHelper; + private HelperAccessor<IAutoUserHelper> mUsersHelper; private HelperAccessor<IAutoSettingHelper> mSettingHelper; public AddUserQuickSettings() { - mProfilesHelper = new HelperAccessor<>(IAutoProfileHelper.class); + mUsersHelper = new HelperAccessor<>(IAutoUserHelper.class); mSettingHelper = new HelperAccessor<>(IAutoSettingHelper.class); } @@ -62,11 +61,11 @@ public class AddUserQuickSettings { public void testAddUser() throws Exception { // create new user quick settings UserInfo initialUser = mMultiUserHelper.getCurrentForegroundUserInfo(); - mProfilesHelper.get().addProfileQuickSettings(initialUser.name); + mUsersHelper.get().addUserQuickSettings(initialUser.name); // switched to new user UserInfo newUser = mMultiUserHelper.getCurrentForegroundUserInfo(); // switch from new user to initial user - mProfilesHelper.get().switchProfile(newUser.name, initialUser.name); + mUsersHelper.get().switchUser(newUser.name, initialUser.name); // verify new user is seen in list of users assertTrue(mMultiUserHelper.getUserByName(newUser.name) != null); // remove new user diff --git a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/AddUserSettings.java b/tests/automotive/functional/multiuser/src/android/platform/tests/AddUserSettings.java index bbb75b2ef..5e6e1205e 100644 --- a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/AddUserSettings.java +++ b/tests/automotive/functional/multiuser/src/android/platform/tests/AddUserSettings.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.platform.scenario.multiuser; +package android.platform.tests; import static junit.framework.Assert.assertTrue; @@ -22,9 +22,10 @@ import android.content.pm.UserInfo; import android.platform.helpers.AutoConfigConstants; import android.platform.helpers.AutoUtility; import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoProfileHelper; +import android.platform.helpers.IAutoUserHelper; import android.platform.helpers.IAutoSettingHelper; import android.platform.helpers.MultiUserHelper; +import android.platform.scenario.multiuser.MultiUserConstants; import androidx.test.runner.AndroidJUnit4; import org.junit.After; import org.junit.Before; @@ -34,19 +35,17 @@ import org.junit.runner.RunWith; /** * This test will create user through API and delete the same user from UI - * - * <p>It should be running under user 0, otherwise instrumentation may be killed after user - * switched. + * <p> Set system property to run MU test: adb shell setprop fw.stop_bg_users_on_switch 0 */ @RunWith(AndroidJUnit4.class) public class AddUserSettings { private final MultiUserHelper mMultiUserHelper = MultiUserHelper.getInstance(); - private HelperAccessor<IAutoProfileHelper> mProfilesHelper; + private HelperAccessor<IAutoUserHelper> mUsersHelper; private HelperAccessor<IAutoSettingHelper> mSettingHelper; public AddUserSettings() { - mProfilesHelper = new HelperAccessor<>(IAutoProfileHelper.class); + mUsersHelper = new HelperAccessor<>(IAutoUserHelper.class); mSettingHelper = new HelperAccessor<>(IAutoSettingHelper.class); } @@ -69,11 +68,11 @@ public class AddUserSettings { public void testAddUser() throws Exception { // create new user UserInfo initialUser = mMultiUserHelper.getCurrentForegroundUserInfo(); - mProfilesHelper.get().addProfile(); + mUsersHelper.get().addUser(); // switched to new user UserInfo newUser = mMultiUserHelper.getCurrentForegroundUserInfo(); // switch from new user to initial user - mProfilesHelper.get().switchProfile(newUser.name, initialUser.name); + mUsersHelper.get().switchUser(newUser.name, initialUser.name); // verify new user is seen in list of users assertTrue(mMultiUserHelper.getUserByName(newUser.name) != null); // remove new user diff --git a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/DeleteAdminUser.java b/tests/automotive/functional/multiuser/src/android/platform/tests/DeleteAdminUser.java index 0b48dd355..f73cb554e 100644 --- a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/DeleteAdminUser.java +++ b/tests/automotive/functional/multiuser/src/android/platform/tests/DeleteAdminUser.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.platform.scenario.multiuser; +package android.platform.tests; import static junit.framework.Assert.assertFalse; @@ -22,9 +22,10 @@ import android.os.SystemClock; import android.platform.helpers.AutoConfigConstants; import android.platform.helpers.AutoUtility; import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoProfileHelper; +import android.platform.helpers.IAutoUserHelper; import android.platform.helpers.IAutoSettingHelper; import android.platform.helpers.MultiUserHelper; +import android.platform.scenario.multiuser.MultiUserConstants; import androidx.test.runner.AndroidJUnit4; import org.junit.After; import org.junit.BeforeClass; @@ -33,9 +34,6 @@ import org.junit.runner.RunWith; /** * This test will create user through API and delete the same user from UI - * - * <p>It should be running under user 0, otherwise instrumentation may be killed after user - * switched. */ @RunWith(AndroidJUnit4.class) public class DeleteAdminUser { @@ -43,12 +41,12 @@ public class DeleteAdminUser { private static final String userName = MultiUserConstants.SECONDARY_USER_NAME; private static final int WAIT_TIME = 10000; private final MultiUserHelper mMultiUserHelper = MultiUserHelper.getInstance(); - private HelperAccessor<IAutoProfileHelper> mProfilesHelper; + private HelperAccessor<IAutoUserHelper> mUsersHelper; private HelperAccessor<IAutoSettingHelper> mSettingHelper; private int mTargetUserId; public DeleteAdminUser() { - mProfilesHelper = new HelperAccessor<>(IAutoProfileHelper.class); + mUsersHelper = new HelperAccessor<>(IAutoUserHelper.class); mSettingHelper = new HelperAccessor<>(IAutoSettingHelper.class); } @@ -69,10 +67,10 @@ public class DeleteAdminUser { SystemClock.sleep(WAIT_TIME); // make the new user admin and delete new user mSettingHelper.get().openSetting(AutoConfigConstants.PROFILE_ACCOUNT_SETTINGS); - mProfilesHelper.get().makeUserAdmin(userName); + mUsersHelper.get().makeUserAdmin(userName); mSettingHelper.get().openSetting(AutoConfigConstants.PROFILE_ACCOUNT_SETTINGS); - mProfilesHelper.get().deleteProfile(userName); + mUsersHelper.get().deleteUser(userName); // verify new user was deleted - assertFalse(mProfilesHelper.get().isProfilePresent(userName)); + assertFalse(mUsersHelper.get().isUserPresent(userName)); } } diff --git a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/DeleteCurrentNonAdminUser.java b/tests/automotive/functional/multiuser/src/android/platform/tests/DeleteCurrentNonAdminUser.java index a359cc2ad..a0111b875 100644 --- a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/DeleteCurrentNonAdminUser.java +++ b/tests/automotive/functional/multiuser/src/android/platform/tests/DeleteCurrentNonAdminUser.java @@ -14,17 +14,19 @@ * limitations under the License. */ -package android.platform.scenario.multiuser; +package android.platform.tests; import static junit.framework.Assert.assertTrue; +import android.os.SystemClock; import android.content.pm.UserInfo; import android.platform.helpers.AutoConfigConstants; import android.platform.helpers.AutoUtility; import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoProfileHelper; +import android.platform.helpers.IAutoUserHelper; import android.platform.helpers.IAutoSettingHelper; import android.platform.helpers.MultiUserHelper; +import android.platform.scenario.multiuser.MultiUserConstants; import androidx.test.runner.AndroidJUnit4; import org.junit.After; import org.junit.Before; @@ -34,19 +36,20 @@ import org.junit.runner.RunWith; /** * This test will create user through API and delete the same user from UI - * - * <p>It should be running under user 0, otherwise instrumentation may be killed after user - * switched. + * <p> Set system property to run MU test: adb shell setprop fw.stop_bg_users_on_switch 0 */ @RunWith(AndroidJUnit4.class) public class DeleteCurrentNonAdminUser { + private static final String userName = MultiUserConstants.SECONDARY_USER_NAME; + private static final int WAIT_TIME = 10000; private final MultiUserHelper mMultiUserHelper = MultiUserHelper.getInstance(); - private HelperAccessor<IAutoProfileHelper> mProfilesHelper; + private HelperAccessor<IAutoUserHelper> mUsersHelper; private HelperAccessor<IAutoSettingHelper> mSettingHelper; + private int mTargetUserId; public DeleteCurrentNonAdminUser() { - mProfilesHelper = new HelperAccessor<>(IAutoProfileHelper.class); + mUsersHelper = new HelperAccessor<>(IAutoUserHelper.class); mSettingHelper = new HelperAccessor<>(IAutoSettingHelper.class); } @@ -55,11 +58,6 @@ public class DeleteCurrentNonAdminUser { AutoUtility.exitSuw(); } - @Before - public void openAccountsFacet() { - mSettingHelper.get().openSetting(AutoConfigConstants.PROFILE_ACCOUNT_SETTINGS); - } - @After public void goBackToHomeScreen() { mSettingHelper.get().goBackToSettingsScreen(); @@ -67,16 +65,20 @@ public class DeleteCurrentNonAdminUser { @Test public void testRemoveUserSelf() throws Exception { - // add new user UserInfo initialUser = mMultiUserHelper.getCurrentForegroundUserInfo(); - mProfilesHelper.get().addProfile(); - // switched to new user and user deleted self + // add new user + mTargetUserId = mMultiUserHelper.createUser(userName, false); + SystemClock.sleep(WAIT_TIME); + // switch to new user + mMultiUserHelper.switchAndWaitForStable( + mTargetUserId, MultiUserConstants.WAIT_FOR_IDLE_TIME_MS); UserInfo newUser = mMultiUserHelper.getCurrentForegroundUserInfo(); + // user deleted self mSettingHelper.get().openSetting(AutoConfigConstants.PROFILE_ACCOUNT_SETTINGS); - mProfilesHelper.get().deleteCurrentProfile(); + mUsersHelper.get().deleteCurrentUser(); // goes to guest user, switch back to initial user - UserInfo guestUser = mMultiUserHelper.getCurrentForegroundUserInfo(); - mProfilesHelper.get().switchProfile(guestUser.name, initialUser.name); + mMultiUserHelper.switchAndWaitForStable( + initialUser.id, MultiUserConstants.WAIT_FOR_IDLE_TIME_MS); // verify that user is deleted assertTrue(mMultiUserHelper.getUserByName(newUser.name) == null); } diff --git a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/DeleteGuestNotAllowed.java b/tests/automotive/functional/multiuser/src/android/platform/tests/DeleteGuestNotAllowed.java index 03ecfbcc6..71ea34388 100644 --- a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/DeleteGuestNotAllowed.java +++ b/tests/automotive/functional/multiuser/src/android/platform/tests/DeleteGuestNotAllowed.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.platform.scenario.multiuser; +package android.platform.tests; import static junit.framework.Assert.assertFalse; @@ -22,9 +22,10 @@ import android.content.pm.UserInfo; import android.platform.helpers.AutoConfigConstants; import android.platform.helpers.AutoUtility; import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoProfileHelper; +import android.platform.helpers.IAutoUserHelper; import android.platform.helpers.IAutoSettingHelper; import android.platform.helpers.MultiUserHelper; +import android.platform.scenario.multiuser.MultiUserConstants; import androidx.test.runner.AndroidJUnit4; import org.junit.After; import org.junit.Before; @@ -34,19 +35,16 @@ import org.junit.runner.RunWith; /** * This test will create user through API and delete the same user from UI - * - * <p>It should be running under user 0, otherwise instrumentation may be killed after user - * switched. */ @RunWith(AndroidJUnit4.class) public class DeleteGuestNotAllowed { private static final String guestUser = MultiUserConstants.GUEST_NAME; - private HelperAccessor<IAutoProfileHelper> mProfilesHelper; + private HelperAccessor<IAutoUserHelper> mUsersHelper; private HelperAccessor<IAutoSettingHelper> mSettingHelper; public DeleteGuestNotAllowed() { - mProfilesHelper = new HelperAccessor<>(IAutoProfileHelper.class); + mUsersHelper = new HelperAccessor<>(IAutoUserHelper.class); mSettingHelper = new HelperAccessor<>(IAutoSettingHelper.class); } @@ -68,6 +66,6 @@ public class DeleteGuestNotAllowed { @Test public void testDeleteGuestNotAllowed() throws Exception { // verify that guest user cannot be seen and deleted from list of profiles - assertFalse(mProfilesHelper.get().isProfilePresent(guestUser)); + assertFalse(mUsersHelper.get().isUserPresent(guestUser)); } } diff --git a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/DeleteGuestSelfNotAllowed.java b/tests/automotive/functional/multiuser/src/android/platform/tests/DeleteGuestSelfNotAllowed.java index 5413fda8d..b31cbaa5a 100644 --- a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/DeleteGuestSelfNotAllowed.java +++ b/tests/automotive/functional/multiuser/src/android/platform/tests/DeleteGuestSelfNotAllowed.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.platform.scenario.multiuser; +package android.platform.tests; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; @@ -23,9 +23,10 @@ import android.content.pm.UserInfo; import android.platform.helpers.AutoConfigConstants; import android.platform.helpers.AutoUtility; import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoProfileHelper; +import android.platform.helpers.IAutoUserHelper; import android.platform.helpers.IAutoSettingHelper; import android.platform.helpers.MultiUserHelper; +import android.platform.scenario.multiuser.MultiUserConstants; import android.util.Log; import androidx.test.runner.AndroidJUnit4; import org.junit.After; @@ -35,20 +36,18 @@ import org.junit.runner.RunWith; /** * This test will create user through API and delete the same user from UI - * - * <p>It should be running under user 0, otherwise instrumentation may be killed after user - * switched. + * <p> Set system property to run MU test: adb shell setprop fw.stop_bg_users_on_switch 0 */ @RunWith(AndroidJUnit4.class) public class DeleteGuestSelfNotAllowed { private static final String guestUser = MultiUserConstants.GUEST_NAME; private final MultiUserHelper mMultiUserHelper = MultiUserHelper.getInstance(); - private HelperAccessor<IAutoProfileHelper> mProfilesHelper; + private HelperAccessor<IAutoUserHelper> mUsersHelper; private HelperAccessor<IAutoSettingHelper> mSettingHelper; public DeleteGuestSelfNotAllowed() { - mProfilesHelper = new HelperAccessor<>(IAutoProfileHelper.class); + mUsersHelper = new HelperAccessor<>(IAutoUserHelper.class); mSettingHelper = new HelperAccessor<>(IAutoSettingHelper.class); } @@ -66,14 +65,14 @@ public class DeleteGuestSelfNotAllowed { public void testDeleteGuestNotAllowed() throws Exception { UserInfo previousUser = mMultiUserHelper.getCurrentForegroundUserInfo(); // switch to Guest and verify the user switch - mProfilesHelper.get().switchProfile(previousUser.name, guestUser); + mUsersHelper.get().switchUser(previousUser.name, guestUser); UserInfo currentUser = mMultiUserHelper.getCurrentForegroundUserInfo(); assertTrue(currentUser.name.equals(guestUser)); boolean IsDeleteAllowed = true; // try to delete self - runtime exception encountered try { mSettingHelper.get().openSetting(AutoConfigConstants.PROFILE_ACCOUNT_SETTINGS); - mProfilesHelper.get().deleteCurrentProfile(); + mUsersHelper.get().deleteCurrentUser(); } catch (RuntimeException err) { Log.v( "DeleteGuestSelfNotAllowed", @@ -82,6 +81,6 @@ public class DeleteGuestSelfNotAllowed { } assertFalse(IsDeleteAllowed); // switch to initial user before terminating the test - mProfilesHelper.get().switchProfile(currentUser.name, previousUser.name); + mUsersHelper.get().switchUser(currentUser.name, previousUser.name); } } diff --git a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/DeleteCurrentLastAdminUser.java b/tests/automotive/functional/multiuser/src/android/platform/tests/DeleteLastAdminUser.java index 41affbe9e..9d1fe9800 100644 --- a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/DeleteCurrentLastAdminUser.java +++ b/tests/automotive/functional/multiuser/src/android/platform/tests/DeleteLastAdminUser.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.platform.scenario.multiuser; +package android.platform.tests; import static junit.framework.Assert.assertTrue; @@ -22,7 +22,7 @@ import android.content.pm.UserInfo; import android.platform.helpers.AutoConfigConstants; import android.platform.helpers.AutoUtility; import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoProfileHelper; +import android.platform.helpers.IAutoUserHelper; import android.platform.helpers.IAutoSettingHelper; import android.platform.helpers.MultiUserHelper; import androidx.test.runner.AndroidJUnit4; @@ -39,14 +39,14 @@ import org.junit.runner.RunWith; * switched. */ @RunWith(AndroidJUnit4.class) -public class DeleteCurrentLastAdminUser { +public class DeleteLastAdminUser { private final MultiUserHelper mMultiUserHelper = MultiUserHelper.getInstance(); - private HelperAccessor<IAutoProfileHelper> mProfilesHelper; + private HelperAccessor<IAutoUserHelper> mUsersHelper; private HelperAccessor<IAutoSettingHelper> mSettingHelper; - public DeleteCurrentLastAdminUser() { - mProfilesHelper = new HelperAccessor<>(IAutoProfileHelper.class); + public DeleteLastAdminUser() { + mUsersHelper = new HelperAccessor<>(IAutoUserHelper.class); mSettingHelper = new HelperAccessor<>(IAutoSettingHelper.class); } @@ -70,9 +70,11 @@ public class DeleteCurrentLastAdminUser { // add new user UserInfo initialUser = mMultiUserHelper.getCurrentForegroundUserInfo(); // user deleted self - mProfilesHelper.get().deleteCurrentProfile(); + mUsersHelper.get().deleteCurrentUser(); UserInfo newUser = mMultiUserHelper.getCurrentForegroundUserInfo(); // verify that user is deleted assertTrue((initialUser.id != newUser.id) && (initialUser.name.equals(newUser.name))); } + } + diff --git a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/DeleteNonAdminUser.java b/tests/automotive/functional/multiuser/src/android/platform/tests/DeleteNonAdminUser.java index ddfc2cc73..8dab462ca 100644 --- a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/DeleteNonAdminUser.java +++ b/tests/automotive/functional/multiuser/src/android/platform/tests/DeleteNonAdminUser.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.platform.scenario.multiuser; +package android.platform.tests; import static junit.framework.Assert.assertFalse; @@ -22,9 +22,10 @@ import android.os.SystemClock; import android.platform.helpers.AutoConfigConstants; import android.platform.helpers.AutoUtility; import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoProfileHelper; +import android.platform.helpers.IAutoUserHelper; import android.platform.helpers.IAutoSettingHelper; import android.platform.helpers.MultiUserHelper; +import android.platform.scenario.multiuser.MultiUserConstants; import androidx.test.runner.AndroidJUnit4; import org.junit.After; import org.junit.BeforeClass; @@ -33,9 +34,6 @@ import org.junit.runner.RunWith; /** * This test will create user through API and delete the same user from UI - * - * <p>It should be running under user 0, otherwise instrumentation may be killed after user - * switched. */ @RunWith(AndroidJUnit4.class) public class DeleteNonAdminUser { @@ -43,12 +41,12 @@ public class DeleteNonAdminUser { private static final String userName = MultiUserConstants.SECONDARY_USER_NAME; private static final int WAIT_TIME = 10000; private final MultiUserHelper mMultiUserHelper = MultiUserHelper.getInstance(); - private HelperAccessor<IAutoProfileHelper> mProfilesHelper; + private HelperAccessor<IAutoUserHelper> mUsersHelper; private HelperAccessor<IAutoSettingHelper> mSettingHelper; private int mTargetUserId; public DeleteNonAdminUser() { - mProfilesHelper = new HelperAccessor<>(IAutoProfileHelper.class); + mUsersHelper = new HelperAccessor<>(IAutoUserHelper.class); mSettingHelper = new HelperAccessor<>(IAutoSettingHelper.class); } @@ -69,8 +67,8 @@ public class DeleteNonAdminUser { SystemClock.sleep(WAIT_TIME); // make the new user admin and delete new user mSettingHelper.get().openSetting(AutoConfigConstants.PROFILE_ACCOUNT_SETTINGS); - mProfilesHelper.get().deleteProfile(userName); + mUsersHelper.get().deleteUser(userName); // verify new user was deleted - assertFalse(mProfilesHelper.get().isProfilePresent(userName)); + assertFalse(mUsersHelper.get().isUserPresent(userName)); } } diff --git a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/SwitchToGuestFromNonAdmin.java b/tests/automotive/functional/multiuser/src/android/platform/tests/SwitchToGuestFromNonAdmin.java index 539be6d5a..f0fab9f08 100644 --- a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/SwitchToGuestFromNonAdmin.java +++ b/tests/automotive/functional/multiuser/src/android/platform/tests/SwitchToGuestFromNonAdmin.java @@ -14,17 +14,19 @@ * limitations under the License. */ -package android.platform.scenario.multiuser; +package android.platform.tests; import static junit.framework.Assert.assertTrue; +import android.os.SystemClock; import android.content.pm.UserInfo; import android.platform.helpers.AutoConfigConstants; import android.platform.helpers.AutoUtility; import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoProfileHelper; +import android.platform.helpers.IAutoUserHelper; import android.platform.helpers.IAutoSettingHelper; import android.platform.helpers.MultiUserHelper; +import android.platform.scenario.multiuser.MultiUserConstants; import androidx.test.runner.AndroidJUnit4; import org.junit.After; import org.junit.Before; @@ -34,20 +36,21 @@ import org.junit.runner.RunWith; /** * This test will create user through API and delete the same user from UI - * - * <p>It should be running under user 0, otherwise instrumentation may be killed after user - * switched. + * <p> Set system property to run MU test: adb shell setprop fw.stop_bg_users_on_switch 0 */ @RunWith(AndroidJUnit4.class) public class SwitchToGuestFromNonAdmin { + private static final String userName = MultiUserConstants.SECONDARY_USER_NAME; private static final String guestUser = MultiUserConstants.GUEST_NAME; + private static final int WAIT_TIME = 10000; private final MultiUserHelper mMultiUserHelper = MultiUserHelper.getInstance(); - private HelperAccessor<IAutoProfileHelper> mProfilesHelper; + private HelperAccessor<IAutoUserHelper> mUsersHelper; private HelperAccessor<IAutoSettingHelper> mSettingHelper; + private int mTargetUserId; public SwitchToGuestFromNonAdmin() { - mProfilesHelper = new HelperAccessor<>(IAutoProfileHelper.class); + mUsersHelper = new HelperAccessor<>(IAutoUserHelper.class); mSettingHelper = new HelperAccessor<>(IAutoSettingHelper.class); } @@ -56,11 +59,6 @@ public class SwitchToGuestFromNonAdmin { AutoUtility.exitSuw(); } - @Before - public void openAccountsFacet() { - mSettingHelper.get().openSetting(AutoConfigConstants.PROFILE_ACCOUNT_SETTINGS); - } - @After public void goBackToHomeScreen() { mSettingHelper.get().goBackToSettingsScreen(); @@ -68,18 +66,22 @@ public class SwitchToGuestFromNonAdmin { @Test public void testSwitchToGuest() throws Exception { - // add new user UserInfo initialUser = mMultiUserHelper.getCurrentForegroundUserInfo(); - mProfilesHelper.get().addProfile(); - // switched to new user account + // add new user + mTargetUserId = mMultiUserHelper.createUser(userName, false); + SystemClock.sleep(WAIT_TIME); + // switch to new user + mMultiUserHelper.switchAndWaitForStable( + mTargetUserId, MultiUserConstants.WAIT_FOR_IDLE_TIME_MS); UserInfo newUser = mMultiUserHelper.getCurrentForegroundUserInfo(); // switch to guest from new user - mProfilesHelper.get().switchProfile(newUser.name, guestUser); + mUsersHelper.get().switchUser(newUser.name, guestUser); // verify the user switch UserInfo currentUser = mMultiUserHelper.getCurrentForegroundUserInfo(); assertTrue(currentUser.name.equals(guestUser)); // switch to initial user and delete new user before terminating the test - mProfilesHelper.get().switchProfile(currentUser.name, initialUser.name); + mMultiUserHelper.switchAndWaitForStable( + initialUser.id, MultiUserConstants.WAIT_FOR_IDLE_TIME_MS); mMultiUserHelper.removeUser(newUser); } } diff --git a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/SwitchUserQuickSettings.java b/tests/automotive/functional/multiuser/src/android/platform/tests/SwitchUserQuickSettings.java index 0dfdc3dd9..179aed489 100644 --- a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/ui/SwitchUserQuickSettings.java +++ b/tests/automotive/functional/multiuser/src/android/platform/tests/SwitchUserQuickSettings.java @@ -14,16 +14,17 @@ * limitations under the License. */ -package android.platform.scenario.multiuser; +package android.platform.tests; import static junit.framework.Assert.assertTrue; import android.content.pm.UserInfo; import android.platform.helpers.AutoUtility; import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoProfileHelper; +import android.platform.helpers.IAutoUserHelper; import android.platform.helpers.IAutoSettingHelper; import android.platform.helpers.MultiUserHelper; +import android.platform.scenario.multiuser.MultiUserConstants; import androidx.test.runner.AndroidJUnit4; import org.junit.After; import org.junit.BeforeClass; @@ -32,20 +33,18 @@ import org.junit.runner.RunWith; /** * This test will create user through API and delete the same user from UI - * - * <p>It should be running under user 0, otherwise instrumentation may be killed after user - * switched. + * <p> Set system property to run MU test: adb shell setprop fw.stop_bg_users_on_switch 0 */ @RunWith(AndroidJUnit4.class) public class SwitchUserQuickSettings { private static final String guestUser = MultiUserConstants.GUEST_NAME; private final MultiUserHelper mMultiUserHelper = MultiUserHelper.getInstance(); - private HelperAccessor<IAutoProfileHelper> mProfilesHelper; + private HelperAccessor<IAutoUserHelper> mUsersHelper; private HelperAccessor<IAutoSettingHelper> mSettingHelper; public SwitchUserQuickSettings() { - mProfilesHelper = new HelperAccessor<>(IAutoProfileHelper.class); + mUsersHelper = new HelperAccessor<>(IAutoUserHelper.class); mSettingHelper = new HelperAccessor<>(IAutoSettingHelper.class); } @@ -63,11 +62,11 @@ public class SwitchUserQuickSettings { public void testSwitchUser() throws Exception { UserInfo previousUser = mMultiUserHelper.getCurrentForegroundUserInfo(); // switch to Guest - mProfilesHelper.get().switchProfile(previousUser.name, guestUser); + mUsersHelper.get().switchUser(previousUser.name, guestUser); UserInfo currentUser = mMultiUserHelper.getCurrentForegroundUserInfo(); // verify the user switch assertTrue(currentUser.name.equals(guestUser)); // switch to initial user before terminating the test - mProfilesHelper.get().switchProfile(currentUser.name, previousUser.name); + mUsersHelper.get().switchUser(currentUser.name, previousUser.name); } } diff --git a/tests/automotive/functional/settings/src/android/platform/tests/AccountSettingTest.java b/tests/automotive/functional/settings/src/android/platform/tests/AccountSettingTest.java deleted file mode 100644 index ed0608b09..000000000 --- a/tests/automotive/functional/settings/src/android/platform/tests/AccountSettingTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -package android.platform.tests; - -import android.platform.helpers.AutoConfigConstants; -import android.platform.helpers.AutoUtility; -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoAccountsHelper; -import android.platform.helpers.IAutoSettingHelper; -import android.platform.test.option.StringOption; -import androidx.test.runner.AndroidJUnit4; - -import org.junit.BeforeClass; -import org.junit.After; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Test; -import org.junit.runner.RunWith; - -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; - -@RunWith(AndroidJUnit4.class) -public class AccountSettingTest { - private static final String ACCOUNT_EMAIL = "account-email"; - private static final String ACCOUNT_PASSWORD = "account-password"; - - @ClassRule - public static StringOption mAccountEmail = new StringOption(ACCOUNT_EMAIL).setRequired(true); - - @ClassRule - public static StringOption mAccountPassword = - new StringOption(ACCOUNT_PASSWORD).setRequired(true); - - private HelperAccessor<IAutoAccountsHelper> mAccountsHelper; - private HelperAccessor<IAutoSettingHelper> mSettingHelper; - - public AccountSettingTest() { - mAccountsHelper = new HelperAccessor<>(IAutoAccountsHelper.class); - mSettingHelper = new HelperAccessor<>(IAutoSettingHelper.class); - } - - @BeforeClass - public static void exitSuw() { - AutoUtility.exitSuw(); - } - - @Before - public void openAccountsFacet() { - mSettingHelper.get().openSetting(AutoConfigConstants.PROFILE_ACCOUNT_SETTINGS); - } - - @After - public void goBackToHomeScreen() { - mSettingHelper.get().goBackToSettingsScreen(); - } - - @Test - public void testAddRemoveAccount() { - mAccountsHelper.get().addAccount(mAccountEmail.get(), mAccountPassword.get()); - mSettingHelper.get().openSetting(AutoConfigConstants.PROFILE_ACCOUNT_SETTINGS); - assertTrue(mAccountsHelper.get().doesEmailExist(mAccountEmail.get())); - mAccountsHelper.get().removeAccount(mAccountEmail.get()); - assertFalse(mAccountsHelper.get().doesEmailExist(mAccountEmail.get())); - } -} diff --git a/tests/automotive/health/appgrid/Android.bp b/tests/automotive/health/appgrid/Android.bp index f1b22d78b..06288ce96 100644 --- a/tests/automotive/health/appgrid/Android.bp +++ b/tests/automotive/health/appgrid/Android.bp @@ -22,7 +22,7 @@ java_library_static { srcs: [ "src/**/*.java" ], libs: [ "androidx.test.runner", - "automotive-settings-app-helper", + "automotive-app-grid-helper", "app-helpers-auto-interfaces", "common-platform-scenarios", "platform-test-options", diff --git a/tests/automotive/health/appgrid/src/android/platform/scenario/appgrid/Scroll.java b/tests/automotive/health/appgrid/src/android/platform/scenario/appgrid/Scroll.java index 4f25dc0b0..8f255b55e 100644 --- a/tests/automotive/health/appgrid/src/android/platform/scenario/appgrid/Scroll.java +++ b/tests/automotive/health/appgrid/src/android/platform/scenario/appgrid/Scroll.java @@ -32,7 +32,7 @@ public class Scroll { @Test public void testScrollDownAndUp() { - sHelper.get().scrollDownOnePage(500); - sHelper.get().scrollUpOnePage(500); + sHelper.get().scrollDownOnePage(); + sHelper.get().scrollUpOnePage(); } } diff --git a/tests/automotive/health/appgrid/tests/Android.bp b/tests/automotive/health/appgrid/tests/Android.bp index b801a7280..ae5a377e4 100644 --- a/tests/automotive/health/appgrid/tests/Android.bp +++ b/tests/automotive/health/appgrid/tests/Android.bp @@ -22,10 +22,9 @@ android_test { static_libs: [ "androidx.test.runner", "androidx.test.rules", - "automotive-settings-scenarios", "automotive-app-grid-scenarios", "automotive-health-test-rules", - "automotive-settings-app-helper", + "automotive-app-grid-helper", "app-helpers-auto-interfaces", "ub-uiautomator", "collector-device-lib-platform", diff --git a/tests/automotive/health/autogeneric/Android.bp b/tests/automotive/health/autogeneric/Android.bp deleted file mode 100644 index 84aa4580f..000000000 --- a/tests/automotive/health/autogeneric/Android.bp +++ /dev/null @@ -1,32 +0,0 @@ -// 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. - -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -java_library_static { - name: "automotive-generic-scenarios", - min_sdk_version: "24", - srcs: [ "src/**/*.java" ], - libs: [ - "androidx.test.runner", - "automotive-settings-app-helper", - "app-helpers-auto-interfaces", - "common-platform-scenarios", - "platform-test-options", - "platform-test-rules", - "ub-uiautomator", - ], -} diff --git a/tests/automotive/health/autogeneric/src/android/platform/scenario/autogeneric/OpenApp.java b/tests/automotive/health/autogeneric/src/android/platform/scenario/autogeneric/OpenApp.java deleted file mode 100644 index d4c61872d..000000000 --- a/tests/automotive/health/autogeneric/src/android/platform/scenario/autogeneric/OpenApp.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ - -package android.platform.test.scenario.autogeneric; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoGenericAppHelper; -import android.platform.test.option.StringOption; -import android.platform.test.scenario.annotation.Scenario; - -import org.junit.ClassRule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Open an app by specifying either launch activity or package. */ -@Scenario -@RunWith(JUnit4.class) -public class OpenApp { - @ClassRule - public static StringOption mPackageOption = new StringOption("pkg").setRequired(false); - - @ClassRule - public static StringOption mLaunchActivityOption = - new StringOption("launch-activity").setRequired(false); - - static HelperAccessor<IAutoGenericAppHelper> sHelper = - new HelperAccessor<>(IAutoGenericAppHelper.class); - - public OpenApp() { - if (mLaunchActivityOption.get() != null) { - sHelper.get().setLaunchActivity(mLaunchActivityOption.get()); - } else if (mPackageOption.get() != null) { - sHelper.get().setPackage(mPackageOption.get()); - } else { - throw new IllegalStateException("Neither launch activity nor package is set."); - } - } - - @Test - public void testOpen() { - sHelper.get().open(); - } -} diff --git a/tests/automotive/health/autogeneric/tests/Android.bp b/tests/automotive/health/autogeneric/tests/Android.bp deleted file mode 100644 index 0679eae9e..000000000 --- a/tests/automotive/health/autogeneric/tests/Android.bp +++ /dev/null @@ -1,39 +0,0 @@ -// 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. - -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -android_test { - name: "AndroidAutomotiveGenericScenarioTests", - min_sdk_version: "24", - static_libs: [ - "androidx.test.runner", - "androidx.test.rules", - "automotive-settings-scenarios", - "automotive-generic-scenarios", - "automotive-health-test-rules", - "automotive-settings-app-helper", - "app-helpers-auto-interfaces", - "ub-uiautomator", - "collector-device-lib-platform", - "common-platform-scenarios", - "common-platform-scenario-tests", - "microbenchmark-device-lib", - "platform-test-options", - ], - srcs: ["src/**/*.java"], - test_suites: ["catbox"], -} diff --git a/tests/automotive/health/autogeneric/tests/AndroidManifest.xml b/tests/automotive/health/autogeneric/tests/AndroidManifest.xml deleted file mode 100644 index a60b7b1e1..000000000 --- a/tests/automotive/health/autogeneric/tests/AndroidManifest.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?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. ---> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="android.platform.test.scenario.autogeneric" > - <uses-sdk android:minSdkVersion="24" android:targetSdkVersion="24" /> - <uses-permission android:name="android.permission.DUMP" /> - <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> - <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> - <uses-permission android:name="android.permission.MANAGE_USERS" /> - <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" /> - <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" /> - - <application> - <uses-library android:name="android.test.runner"/> - </application> - <instrumentation - android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="android.platform.test.scenario.autogeneric" - android:label="Android Automotive Generic Scenario-Based Tests" /> -</manifest>
\ No newline at end of file diff --git a/tests/automotive/health/dial/Android.bp b/tests/automotive/health/dial/Android.bp index d4a61dad8..2b573e142 100644 --- a/tests/automotive/health/dial/Android.bp +++ b/tests/automotive/health/dial/Android.bp @@ -22,7 +22,7 @@ java_library_static { srcs: [ "src/**/*.java" ], libs: [ "androidx.test.runner", - "automotive-settings-app-helper", + "automotive-dial-app-helper", "app-helpers-auto-interfaces", "common-platform-scenarios", "platform-test-options", diff --git a/tests/automotive/health/dial/src/android/platform/scenario/dial/ScrollContactList.java b/tests/automotive/health/dial/src/android/platform/scenario/dial/ScrollContactList.java index 522460cb4..18522d035 100644 --- a/tests/automotive/health/dial/src/android/platform/scenario/dial/ScrollContactList.java +++ b/tests/automotive/health/dial/src/android/platform/scenario/dial/ScrollContactList.java @@ -16,7 +16,6 @@ package android.platform.test.scenario.dial; import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoGenericAppHelper; import android.platform.test.scenario.annotation.Scenario; import android.platform.helpers.IAutoDialHelper; @@ -28,24 +27,14 @@ import org.junit.runners.JUnit4; @Scenario @RunWith(JUnit4.class) public class ScrollContactList { - private static final String DIALER_PACKAGE = "com.android.car.dialer"; - - static HelperAccessor<IAutoGenericAppHelper> sAutoGenericHelper = - new HelperAccessor<>(IAutoGenericAppHelper.class); - - static { - sAutoGenericHelper.get().setPackage(DIALER_PACKAGE); - sAutoGenericHelper.get().setScrollableMargin(0, 200, 0, 200); - } - static HelperAccessor<IAutoDialHelper> sHelper = new HelperAccessor<>(IAutoDialHelper.class); @Test public void testScrollDownAndUp() { sHelper.get().openContacts(); - // test scroll down by one page in 500ms. - sAutoGenericHelper.get().scrollDownOnePage(500); - // test scroll up by one page in 500ms. - sAutoGenericHelper.get().scrollUpOnePage(500); + // test scroll down by one page. + sHelper.get().scrollDownOnePage(); + // test scroll up by one page. + sHelper.get().scrollUpOnePage(); } } diff --git a/tests/automotive/health/dial/tests/Android.bp b/tests/automotive/health/dial/tests/Android.bp index 2cf31afce..497f8656f 100644 --- a/tests/automotive/health/dial/tests/Android.bp +++ b/tests/automotive/health/dial/tests/Android.bp @@ -22,10 +22,9 @@ android_test { static_libs: [ "androidx.test.runner", "androidx.test.rules", - "automotive-settings-scenarios", "automotive-dial-scenarios", "automotive-health-test-rules", - "automotive-settings-app-helper", + "automotive-dial-app-helper", "app-helpers-auto-interfaces", "ub-uiautomator", "collector-device-lib-platform", diff --git a/tests/automotive/health/evs/Android.bp b/tests/automotive/health/evs/Android.bp deleted file mode 100644 index 9c3a9fd89..000000000 --- a/tests/automotive/health/evs/Android.bp +++ /dev/null @@ -1,32 +0,0 @@ -// 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. - -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -java_library_static { - name: "automotive-evs-scenarios", - min_sdk_version: "24", - srcs: [ "src/**/*.java" ], - libs: [ - "androidx.test.runner", - "automotive-settings-app-helper", - "app-helpers-auto-interfaces", - "common-platform-scenarios", - "platform-test-options", - "platform-test-rules", - "ub-uiautomator", - ], -} diff --git a/tests/automotive/health/evs/src/android/platform/scenario/evs/OpenApp.java b/tests/automotive/health/evs/src/android/platform/scenario/evs/OpenApp.java deleted file mode 100644 index 35b2512b6..000000000 --- a/tests/automotive/health/evs/src/android/platform/scenario/evs/OpenApp.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.evs; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoCarEvsServiceHelper; -import android.platform.test.scenario.annotation.Scenario; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -@Scenario -@RunWith(JUnit4.class) -public class OpenApp { - - static HelperAccessor<IAutoCarEvsServiceHelper> sHelper = - new HelperAccessor<>(IAutoCarEvsServiceHelper.class); - - @Test - public void testOpen() { - sHelper.get().startEvsPreview(); - } -} diff --git a/tests/automotive/health/evs/tests/AndroidManifest.xml b/tests/automotive/health/evs/tests/AndroidManifest.xml deleted file mode 100644 index 4aa072262..000000000 --- a/tests/automotive/health/evs/tests/AndroidManifest.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?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. ---> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="android.platform.test.scenario.evs" > - <uses-sdk android:minSdkVersion="24" android:targetSdkVersion="24" /> - <uses-permission android:name="android.permission.DUMP" /> - <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> - <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> - <uses-permission android:name="android.permission.MANAGE_USERS" /> - <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" /> - <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" /> - - <application> - <uses-library android:name="android.test.runner"/> - </application> - <instrumentation - android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="android.platform.test.scenario.evs" - android:label="Android Automotive Evs Scenario-Based Tests" /> -</manifest>
\ No newline at end of file diff --git a/tests/automotive/health/evs/tests/src/android/platform/scenario/evs/OpenAppMicrobenchmark.java b/tests/automotive/health/evs/tests/src/android/platform/scenario/evs/OpenAppMicrobenchmark.java deleted file mode 100644 index 8e02aa6bf..000000000 --- a/tests/automotive/health/evs/tests/src/android/platform/scenario/evs/OpenAppMicrobenchmark.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.evs; - -import android.platform.test.scenario.AppStartupRunRule; -import android.platform.test.microbenchmark.Microbenchmark; - -import org.junit.Rule; -import org.junit.runner.RunWith; - -@RunWith(Microbenchmark.class) -public class OpenAppMicrobenchmark extends OpenApp { - - @Rule public AppStartupRunRule mAppStartupRunRule = new AppStartupRunRule<>(sHelper.get()); -} diff --git a/tests/automotive/health/googleplay/Android.bp b/tests/automotive/health/googleplay/Android.bp deleted file mode 100644 index 9c1f12e77..000000000 --- a/tests/automotive/health/googleplay/Android.bp +++ /dev/null @@ -1,32 +0,0 @@ -// 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. - -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -java_library_static { - name: "automotive-google-play-scenarios", - min_sdk_version: "24", - srcs: [ "src/**/*.java" ], - libs: [ - "androidx.test.runner", - "automotive-settings-app-helper", - "app-helpers-auto-interfaces", - "common-platform-scenarios", - "platform-test-options", - "platform-test-rules", - "ub-uiautomator", - ], -} diff --git a/tests/automotive/health/googleplay/src/android/platform/scenario/googleplay/InstallApp.java b/tests/automotive/health/googleplay/src/android/platform/scenario/googleplay/InstallApp.java deleted file mode 100644 index 2f993699a..000000000 --- a/tests/automotive/health/googleplay/src/android/platform/scenario/googleplay/InstallApp.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.googleplay; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoGooglePlayHelper; -import android.platform.test.scenario.annotation.Scenario; - -import androidx.test.InstrumentationRegistry; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** - * This is test scenario to install app from Google Play Store. It assumes the Play Store app is - * already open - */ -@Scenario -@RunWith(JUnit4.class) -public class InstallApp { - // The argument keys are accessible to other class in the same package - static final String APP_NAME_PARAM = "app_name_on_play_store"; - static final String DEFAULT_APP_NAME = "NPR One"; - - private static HelperAccessor<IAutoGooglePlayHelper> sHelper = - new HelperAccessor<>(IAutoGooglePlayHelper.class); - - private String mAppName; - - public InstallApp() { - mAppName = - InstrumentationRegistry.getArguments().getString(APP_NAME_PARAM, DEFAULT_APP_NAME); - } - - @Test - public void testSearchAndInstall() { - sHelper.get().searchAndClick(mAppName); - sHelper.get().installApp(); - } -} diff --git a/tests/automotive/health/googleplay/src/android/platform/scenario/googleplay/OpenApp.java b/tests/automotive/health/googleplay/src/android/platform/scenario/googleplay/OpenApp.java deleted file mode 100644 index 8b2eb53fd..000000000 --- a/tests/automotive/health/googleplay/src/android/platform/scenario/googleplay/OpenApp.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.googleplay; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoGooglePlayHelper; -import android.platform.test.scenario.annotation.Scenario; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Opens the Googleplay application and exits after. */ -@Scenario -@RunWith(JUnit4.class) -public class OpenApp { - static HelperAccessor<IAutoGooglePlayHelper> sHelper = - new HelperAccessor<>(IAutoGooglePlayHelper.class); - - @Test - public void testOpen() { - sHelper.get().open(); - } -} diff --git a/tests/automotive/health/googleplay/src/android/platform/scenario/googleplay/OpenAppOnPlayStore.java b/tests/automotive/health/googleplay/src/android/platform/scenario/googleplay/OpenAppOnPlayStore.java deleted file mode 100644 index 6321b8be2..000000000 --- a/tests/automotive/health/googleplay/src/android/platform/scenario/googleplay/OpenAppOnPlayStore.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.googleplay; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoGooglePlayHelper; -import android.platform.helpers.exceptions.UnknownUiException; -import android.platform.test.scenario.annotation.Scenario; - -import androidx.test.InstrumentationRegistry; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** - * This is a test to search and open an App on Play Store. It assumes the App is already installed, - * otherwise the test will throw exception. - */ -@Scenario -@RunWith(JUnit4.class) -public class OpenAppOnPlayStore { - - private static HelperAccessor<IAutoGooglePlayHelper> sHelper = - new HelperAccessor<>(IAutoGooglePlayHelper.class); - - private static String mAppName; - - public OpenAppOnPlayStore() { - mAppName = - InstrumentationRegistry.getArguments() - .getString(InstallApp.APP_NAME_PARAM, InstallApp.DEFAULT_APP_NAME); - } - - @Test - public void openApp() { - try { - sHelper.get().openApp(); - } catch (UnknownUiException e) { - // If app can not be opened directly, try search for the app first then open it. - sHelper.get().searchAndClick(mAppName); - sHelper.get().openApp(); - } - } -} diff --git a/tests/automotive/health/googleplay/src/android/platform/scenario/googleplay/Scroll.java b/tests/automotive/health/googleplay/src/android/platform/scenario/googleplay/Scroll.java deleted file mode 100644 index b92977ee4..000000000 --- a/tests/automotive/health/googleplay/src/android/platform/scenario/googleplay/Scroll.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.googleplay; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoGooglePlayHelper; -import android.platform.test.scenario.annotation.Scenario; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Scroll down and up in Google play. */ -@Scenario -@RunWith(JUnit4.class) -public class Scroll { - static HelperAccessor<IAutoGooglePlayHelper> sHelper = - new HelperAccessor<>(IAutoGooglePlayHelper.class); - - @Test - public void testScrollDownAndUp() { - sHelper.get().scrollDownOnePage(500); - sHelper.get().scrollUpOnePage(500); - } -} diff --git a/tests/automotive/health/googleplay/tests/Android.bp b/tests/automotive/health/googleplay/tests/Android.bp deleted file mode 100644 index 116ef3930..000000000 --- a/tests/automotive/health/googleplay/tests/Android.bp +++ /dev/null @@ -1,39 +0,0 @@ -// 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. - -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -android_test { - name: "AndroidAutomotiveGooglePlayScenarioTests", - min_sdk_version: "24", - static_libs: [ - "androidx.test.runner", - "androidx.test.rules", - "automotive-settings-scenarios", - "automotive-google-play-scenarios", - "automotive-health-test-rules", - "automotive-settings-app-helper", - "app-helpers-auto-interfaces", - "ub-uiautomator", - "collector-device-lib-platform", - "common-platform-scenarios", - "common-platform-scenario-tests", - "microbenchmark-device-lib", - "platform-test-options", - ], - srcs: ["src/**/*.java"], - test_suites: ["catbox"], -} diff --git a/tests/automotive/health/googleplay/tests/AndroidManifest.xml b/tests/automotive/health/googleplay/tests/AndroidManifest.xml deleted file mode 100644 index 2b5419f3b..000000000 --- a/tests/automotive/health/googleplay/tests/AndroidManifest.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?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. ---> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="android.platform.test.scenario.googleplay" > - <uses-sdk android:minSdkVersion="24" android:targetSdkVersion="24" /> - <uses-permission android:name="android.permission.DUMP" /> - <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> - <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> - <uses-permission android:name="android.permission.MANAGE_USERS" /> - <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" /> - <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" /> - - <application> - <uses-library android:name="android.test.runner"/> - </application> - <instrumentation - android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="android.platform.test.scenario.googleplay" - android:label="Android Automotive Google Play Scenario-Based Tests" /> -</manifest>
\ No newline at end of file diff --git a/tests/automotive/health/googleplay/tests/src/android/platform/scenario/googleplay/OpenAppMicrobenchmark.java b/tests/automotive/health/googleplay/tests/src/android/platform/scenario/googleplay/OpenAppMicrobenchmark.java deleted file mode 100644 index ee7b99380..000000000 --- a/tests/automotive/health/googleplay/tests/src/android/platform/scenario/googleplay/OpenAppMicrobenchmark.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.googleplay; - -import android.platform.test.scenario.AppStartupRunRule; -import android.platform.test.microbenchmark.Microbenchmark; - -import org.junit.Rule; -import org.junit.runner.RunWith; - -@RunWith(Microbenchmark.class) -public class OpenAppMicrobenchmark extends OpenApp { - - @Rule public AppStartupRunRule mAppStartupRunRule = new AppStartupRunRule<>(sHelper.get()); -} diff --git a/tests/automotive/health/googleplay/tests/src/android/platform/scenario/googleplay/ScrollMicrobenchmark.java b/tests/automotive/health/googleplay/tests/src/android/platform/scenario/googleplay/ScrollMicrobenchmark.java deleted file mode 100644 index c1a8d65bc..000000000 --- a/tests/automotive/health/googleplay/tests/src/android/platform/scenario/googleplay/ScrollMicrobenchmark.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.googleplay; - -import android.platform.test.microbenchmark.Microbenchmark; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.runner.RunWith; - -@RunWith(Microbenchmark.class) -public class ScrollMicrobenchmark extends Scroll { - @BeforeClass - public static void openApp() { - sHelper.get().open(); - sHelper.get().searchApp("youtube"); - } - - @AfterClass - public static void closeApp() { - sHelper.get().exit(); - } -} diff --git a/tests/automotive/health/mediacenter/Android.bp b/tests/automotive/health/mediacenter/Android.bp index cb19f10d1..14ff9f7b3 100644 --- a/tests/automotive/health/mediacenter/Android.bp +++ b/tests/automotive/health/mediacenter/Android.bp @@ -22,7 +22,7 @@ java_library_static { srcs: [ "src/**/*.java" ], libs: [ "androidx.test.runner", - "automotive-settings-app-helper", + "automotive-media-center-app-helper", "app-helpers-auto-interfaces", "common-platform-scenarios", "platform-test-options", diff --git a/tests/automotive/health/radio/src/android/platform/scenario/radio/OpenApp.java b/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/OpenApp.java index 84f184a73..7d338a65d 100644 --- a/tests/automotive/health/radio/src/android/platform/scenario/radio/OpenApp.java +++ b/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/OpenApp.java @@ -13,21 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package android.platform.test.scenario.radio; + +package android.platform.test.scenario.mediacenter; import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoRadioHelper; +import android.platform.helpers.IAutoMediaHelper; import android.platform.test.scenario.annotation.Scenario; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** Opens the Radio application and exits after. */ +/** Opens the Settings application and exits after. */ @Scenario @RunWith(JUnit4.class) public class OpenApp { - static HelperAccessor<IAutoRadioHelper> sHelper = new HelperAccessor<>(IAutoRadioHelper.class); + static HelperAccessor<IAutoMediaHelper> sHelper = new HelperAccessor<>(IAutoMediaHelper.class); @Test public void testOpen() { diff --git a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/bluetooth/OpenMedia.java b/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/bluetooth/OpenMedia.java deleted file mode 100644 index 176879a7c..000000000 --- a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/bluetooth/OpenMedia.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.mediacenter.bluetooth; - -import android.platform.test.scenario.annotation.Scenario; -import android.support.test.uiautomator.UiDevice; -import androidx.test.InstrumentationRegistry; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -import java.io.IOException; - -/** Opens Bluetooth application */ -@Scenario -@RunWith(JUnit4.class) -public class OpenMedia { - @Test - public void testOpen() throws IOException { - UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) - .executeShellCommand( - "am start -a android.car.intent.action.MEDIA_TEMPLATE -e " - + "android.car.intent.extra.MEDIA_COMPONENT " - + "com.android.bluetooth" - + "/com.android.bluetooth.avrcpcontroller" - + ".BluetoothMediaBrowseService"); - } -} diff --git a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/bluetooth/PlayMedia.java b/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/bluetooth/PlayMedia.java deleted file mode 100644 index 5fe911c7e..000000000 --- a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/bluetooth/PlayMedia.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.mediacenter.bluetooth; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoMediaHelper; -import android.platform.test.scenario.annotation.Scenario; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Scenario to Play Media via Bluetooth. */ -@Scenario -@RunWith(JUnit4.class) -public class PlayMedia { - - private static HelperAccessor<IAutoMediaHelper> sHelper = - new HelperAccessor<>(IAutoMediaHelper.class); - - @Test - public void testPlay() { - sHelper.get().playMedia(); - } -} diff --git a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/googleplaybooks/OpenGoogleBooks.java b/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/googleplaybooks/OpenGoogleBooks.java deleted file mode 100644 index 41ef2a41e..000000000 --- a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/googleplaybooks/OpenGoogleBooks.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.mediacenter.googleplaybooks; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoMediaCenterHelper; -import android.platform.test.scenario.annotation.Scenario; -import android.support.test.uiautomator.UiDevice; -import androidx.test.InstrumentationRegistry; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -import java.io.IOException; - -/** Opens the Google Books and plays an audio book */ -@Scenario -@RunWith(JUnit4.class) -public class OpenGoogleBooks { - static HelperAccessor<IAutoMediaCenterHelper> sMediaCenterHelper = - new HelperAccessor<>(IAutoMediaCenterHelper.class); - - @Test - public void testOpen() throws IOException { - UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) - .executeShellCommand( - "am start -a android.car.intent.action.MEDIA_TEMPLATE -e " - + "android.car.intent.extra.MEDIA_COMPONENT " - + "com.google.android.apps.books" - + "/com.google.android.apps.play.books.audio" - + ".BooksMediaBrowseService"); - } -} diff --git a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/googleplaybooks/PlayBooks.java b/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/googleplaybooks/PlayBooks.java deleted file mode 100644 index c8e0c6454..000000000 --- a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/googleplaybooks/PlayBooks.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.mediacenter.googleplaybooks; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoMediaCenterHelper; -import android.platform.test.scenario.annotation.Scenario; -import androidx.test.InstrumentationRegistry; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -import java.io.IOException; - -/** Plays an audio book assuming Google Play Books is open */ -@Scenario -@RunWith(JUnit4.class) -public class PlayBooks { - - private String mNameOftheSong; - static HelperAccessor<IAutoMediaCenterHelper> sMediaCenterHelper = - new HelperAccessor<>(IAutoMediaCenterHelper.class); - - @Test - public void testOpen() throws IOException { - mNameOftheSong = - InstrumentationRegistry.getArguments() - .getString("song_name", "Once Gone (a Riley Paige Mystery--Book #1)"); - sMediaCenterHelper.get().selectMediaTrack("Library", mNameOftheSong); - } -} diff --git a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/googleplaybooks/Scroll.java b/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/googleplaybooks/Scroll.java deleted file mode 100644 index 961ddd8a6..000000000 --- a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/googleplaybooks/Scroll.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.mediacenter.googleplaybooks; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoGenericAppHelper; -import android.platform.test.scenario.annotation.Scenario; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Scroll down and up in Google play Books' content list. */ -@Scenario -@RunWith(JUnit4.class) -public class Scroll { - private static final String MEDIA_CENTER_PACKAGE = "com.android.car.media"; - - static HelperAccessor<IAutoGenericAppHelper> sHelper = - new HelperAccessor<>(IAutoGenericAppHelper.class); - - static { - sHelper.get().setPackage(MEDIA_CENTER_PACKAGE); - // Media center has some UI components overlays the scrollable region at both the top and - // bottom section, and hence a large margin is required. - sHelper.get().setScrollableMargin(0, 200, 0, 200); - } - - @Test - public void testScrollDownAndUp() { - sHelper.get().scrollDownOnePage(500); - sHelper.get().scrollUpOnePage(500); - } -} diff --git a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/googleplaybooks/SwitchPlayBack.java b/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/googleplaybooks/SwitchPlayBack.java deleted file mode 100644 index 52361915b..000000000 --- a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/googleplaybooks/SwitchPlayBack.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.mediacenter.googleplaybooks; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoMediaCenterMinimizeControlBarHelper; -import android.platform.helpers.IAutoMediaCenterNowPlayingHelper; -import android.platform.test.scenario.annotation.Scenario; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Maximize and minimize playback screen in Google Play Books. */ -@Scenario -@RunWith(JUnit4.class) -public class SwitchPlayBack { - private static final String MEDIA_CENTER_PACKAGE = "com.android.car.media"; - - private static HelperAccessor<IAutoMediaCenterMinimizeControlBarHelper> sMinPlaybackHelper = - new HelperAccessor<>(IAutoMediaCenterMinimizeControlBarHelper.class); - private static HelperAccessor<IAutoMediaCenterNowPlayingHelper> sMaxPlaybackHelper = - new HelperAccessor<>(IAutoMediaCenterNowPlayingHelper.class); - - @Test - public void testScrollDownAndUp() { - sMinPlaybackHelper.get().maximizeNowPlaying(); - sMaxPlaybackHelper.get().minimizeNowPlaying(); - } -} diff --git a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/testmedia/OpenApp.java b/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/testmedia/OpenApp.java deleted file mode 100644 index fd641720b..000000000 --- a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/testmedia/OpenApp.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.mediacenter.testmedia; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoGenericAppHelper; -import android.platform.helpers.IAutoMediaCenterHelper; -import android.platform.test.scenario.annotation.Scenario; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** Opens the Test Media App application by launching media center. */ -@Scenario -@RunWith(JUnit4.class) -public class OpenApp { - - private static final String MEDIA_CENTER_PACKAGE = "com.android.car.media"; - private static final String MEDIA_TEMPLATE = "android.car.intent.action.MEDIA_TEMPLATE"; - private static final Map<String, String> TEST_MEDIA_APP_EXTRA_ARGS = - Stream.of( - new Object[][] { - { - "android.car.intent.extra.MEDIA_COMPONENT", - "com.android.car.media.testmediaapp/com.android.car.media.testmediaapp.TmaBrowser" - }, - }) - .collect(Collectors.toMap(data -> (String) data[0], data -> (String) data[1])); - - static HelperAccessor<IAutoGenericAppHelper> sAutoGenericrHelper = - new HelperAccessor<>(IAutoGenericAppHelper.class); - - static HelperAccessor<IAutoMediaCenterHelper> sMediaCenterHelper = - new HelperAccessor<>(IAutoMediaCenterHelper.class); - - static { - sAutoGenericrHelper.get().setPackage(MEDIA_CENTER_PACKAGE); - sAutoGenericrHelper.get().setLaunchAction(MEDIA_TEMPLATE, TEST_MEDIA_APP_EXTRA_ARGS); - } - - @Test - public void Open() { - sAutoGenericrHelper.get().open(); - } -} diff --git a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/testmedia/Scroll.java b/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/testmedia/Scroll.java deleted file mode 100644 index 31e77b262..000000000 --- a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/testmedia/Scroll.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.mediacenter.testmedia; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoGenericAppHelper; -import android.platform.test.scenario.annotation.Scenario; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Scroll down and up in Google play Books' content list. */ -@Scenario -@RunWith(JUnit4.class) -public class Scroll { - private static final String MEDIA_CENTER_PACKAGE = "com.android.car.media"; - - static HelperAccessor<IAutoGenericAppHelper> sAutoGenericHelper = - new HelperAccessor<>(IAutoGenericAppHelper.class); - - static { - sAutoGenericHelper.get().setPackage(MEDIA_CENTER_PACKAGE); - // Media center has some UI components overlays the scrollable region at both the top and - // bottom section, and hence a large margin is required. - sAutoGenericHelper.get().setScrollableMargin(0, 200, 0, 200); - } - - @Test - public void testScrollDownAndUp() { - sAutoGenericHelper.get().scrollDownOnePage(2500); - sAutoGenericHelper.get().scrollUpOnePage(2500); - } -} diff --git a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/testmedia/SwitchPlayback.java b/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/testmedia/SwitchPlayback.java deleted file mode 100644 index 3c9108d28..000000000 --- a/tests/automotive/health/mediacenter/src/android/platform/scenario/mediacenter/testmedia/SwitchPlayback.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.mediacenter.testmedia; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoMediaCenterMinimizeControlBarHelper; -import android.platform.helpers.IAutoMediaCenterNowPlayingHelper; -import android.platform.test.scenario.annotation.Scenario; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Maximize and minimize playback screen in Test Media App. */ -@Scenario -@RunWith(JUnit4.class) -public class SwitchPlayback { - - static HelperAccessor<IAutoMediaCenterMinimizeControlBarHelper> sMinPlaybackHelper = - new HelperAccessor<>(IAutoMediaCenterMinimizeControlBarHelper.class); - - static HelperAccessor<IAutoMediaCenterNowPlayingHelper> sMaxPlaybackHelper = - new HelperAccessor<>(IAutoMediaCenterNowPlayingHelper.class); - - @Test - public void testSwitchPlayback() { - sMaxPlaybackHelper.get().minimizeNowPlaying(); - sMinPlaybackHelper.get().maximizeNowPlaying(); - } -} diff --git a/tests/automotive/health/mediacenter/tests/Android.bp b/tests/automotive/health/mediacenter/tests/Android.bp index 824d85403..e9ddf15d1 100644 --- a/tests/automotive/health/mediacenter/tests/Android.bp +++ b/tests/automotive/health/mediacenter/tests/Android.bp @@ -22,10 +22,9 @@ android_test { static_libs: [ "androidx.test.runner", "androidx.test.rules", - "automotive-settings-scenarios", "automotive-media-center-scenarios", "automotive-health-test-rules", - "automotive-settings-app-helper", + "automotive-media-center-app-helper", "app-helpers-auto-interfaces", "ub-uiautomator", "collector-device-lib-platform", diff --git a/tests/automotive/health/autogeneric/tests/src/android/platform/scenario/autogeneric/OpenAppMicrobenchmark.java b/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/OpenAppMicrobenchmark.java index d77422e97..ab680a5b8 100644 --- a/tests/automotive/health/autogeneric/tests/src/android/platform/scenario/autogeneric/OpenAppMicrobenchmark.java +++ b/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/OpenAppMicrobenchmark.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.platform.test.scenario.autogeneric; +package android.platform.test.scenario.mediacenter; import android.platform.test.scenario.AppStartupRunRule; import android.platform.test.microbenchmark.Microbenchmark; diff --git a/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/googleplaybooks/ScrollMicrobenchmark.java b/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/googleplaybooks/ScrollMicrobenchmark.java deleted file mode 100644 index d7158252a..000000000 --- a/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/googleplaybooks/ScrollMicrobenchmark.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.mediacenter.googleplaybooks; - -import android.platform.test.microbenchmark.Microbenchmark; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.runner.RunWith; - -@RunWith(Microbenchmark.class) -public class ScrollMicrobenchmark extends Scroll { - @BeforeClass - public static void openApp() { - sHelper.get().open(); - } - - @AfterClass - public static void closeApp() { - sHelper.get().exit(); - } -} diff --git a/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/googleplaybooks/SwitchPlayBackMicrobenchmark.java b/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/googleplaybooks/SwitchPlayBackMicrobenchmark.java deleted file mode 100644 index 9134d3609..000000000 --- a/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/googleplaybooks/SwitchPlayBackMicrobenchmark.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.mediacenter.googleplaybooks; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoGenericAppHelper; -import android.platform.test.microbenchmark.Microbenchmark; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.runner.RunWith; - -@RunWith(Microbenchmark.class) -public class SwitchPlayBackMicrobenchmark extends SwitchPlayBack { - private static final String MEDIA_CENTER_PACKAGE = "com.android.car.media"; - - private static HelperAccessor<IAutoGenericAppHelper> sHelper = - new HelperAccessor<>(IAutoGenericAppHelper.class); - - static { - sHelper.get().setPackage(MEDIA_CENTER_PACKAGE); - } - - @BeforeClass - public static void openApp() { - sHelper.get().open(); - } - - @AfterClass - public static void closeApp() { - sHelper.get().exit(); - } -} diff --git a/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/testmedia/OpenMediaCenterMicrobenchmark.java b/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/testmedia/OpenMediaCenterMicrobenchmark.java deleted file mode 100644 index 5a30ac7f2..000000000 --- a/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/testmedia/OpenMediaCenterMicrobenchmark.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.mediacenter.testmedia; - -import android.platform.test.microbenchmark.Microbenchmark; -import android.platform.test.scenario.AppStartupRunRule; - -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.runner.RunWith; - -@RunWith(Microbenchmark.class) -public class OpenMediaCenterMicrobenchmark extends OpenApp { - - @Rule - public AppStartupRunRule mAppStartupRunRule = - new AppStartupRunRule<>(sAutoGenericrHelper.get()); - - @BeforeClass - public static void setup() { - sAutoGenericrHelper.get().open(); - sMediaCenterHelper.get().dismissInitialDialogs(); - } -} diff --git a/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/testmedia/ScrollMicrobenchmark.java b/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/testmedia/ScrollMicrobenchmark.java deleted file mode 100644 index 2e6b3386f..000000000 --- a/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/testmedia/ScrollMicrobenchmark.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.mediacenter.testmedia; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoGenericAppHelper; -import android.platform.helpers.IAutoMediaCenterHelper; -import android.platform.test.microbenchmark.Microbenchmark; - -import org.junit.BeforeClass; -import org.junit.runner.RunWith; - -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -@RunWith(Microbenchmark.class) -public class ScrollMicrobenchmark extends Scroll { - - private static final String MEDIA_CENTER_PACKAGE = "com.android.car.media"; - private static final String MEDIA_TEMPLATE = "android.car.intent.action.MEDIA_TEMPLATE"; - private static final Map<String, String> TEST_MEDIA_APP_EXTRA_ARGS = - Stream.of( - new Object[][] { - { - "android.car.intent.extra.MEDIA_COMPONENT", - "com.android.car.media.testmediaapp/com.android.car.media.testmediaapp.TmaBrowser" - }, - }) - .collect(Collectors.toMap(data -> (String) data[0], data -> (String) data[1])); - - static HelperAccessor<IAutoGenericAppHelper> sAutoGenericrHelper = - new HelperAccessor<>(IAutoGenericAppHelper.class); - - static HelperAccessor<IAutoMediaCenterHelper> sMediaCenterHelper = - new HelperAccessor<>(IAutoMediaCenterHelper.class); - - static { - sAutoGenericrHelper.get().setPackage(MEDIA_CENTER_PACKAGE); - sAutoGenericrHelper.get().setLaunchAction(MEDIA_TEMPLATE, TEST_MEDIA_APP_EXTRA_ARGS); - } - - @BeforeClass - public static void openApp() { - sAutoGenericrHelper.get().open(); - sMediaCenterHelper.get().dismissInitialDialogs(); - } -} diff --git a/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/testmedia/SwitchPlaybackMicrobenchmark.java b/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/testmedia/SwitchPlaybackMicrobenchmark.java deleted file mode 100644 index d7ee8ac55..000000000 --- a/tests/automotive/health/mediacenter/tests/src/android/platform/scenario/mediacenter/testmedia/SwitchPlaybackMicrobenchmark.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.mediacenter.testmedia; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoGenericAppHelper; -import android.platform.helpers.IAutoMediaCenterHelper; -import android.platform.test.microbenchmark.Microbenchmark; - -import org.junit.BeforeClass; -import org.junit.runner.RunWith; - -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -@RunWith(Microbenchmark.class) -public class SwitchPlaybackMicrobenchmark extends SwitchPlayback { - - private static final String MEDIA_CENTER_PACKAGE = "com.android.car.media"; - private static final String MEDIA_TEMPLATE = "android.car.intent.action.MEDIA_TEMPLATE"; - private static final String SONG = "A normal 1H song"; - private static final Map<String, String> TEST_MEDIA_APP_EXTRA_ARGS = - Stream.of( - new Object[][] { - { - "android.car.intent.extra.MEDIA_COMPONENT", - "com.android.car.media.testmediaapp/com.android.car.media.testmediaapp.TmaBrowser" - }, - }) - .collect(Collectors.toMap(data -> (String) data[0], data -> (String) data[1])); - - static HelperAccessor<IAutoGenericAppHelper> sAutoGenericrHelper = - new HelperAccessor<>(IAutoGenericAppHelper.class); - - static HelperAccessor<IAutoMediaCenterHelper> sMediaCenterHelper = - new HelperAccessor<>(IAutoMediaCenterHelper.class); - - static { - sAutoGenericrHelper.get().setPackage(MEDIA_CENTER_PACKAGE); - sAutoGenericrHelper.get().setLaunchAction(MEDIA_TEMPLATE, TEST_MEDIA_APP_EXTRA_ARGS); - } - - @BeforeClass - public static void openApp() { - sAutoGenericrHelper.get().open(); - sMediaCenterHelper.get().dismissInitialDialogs(); - sMediaCenterHelper.get().selectMediaTrack(SONG); - } -} diff --git a/tests/automotive/health/multiuser/Android.bp b/tests/automotive/health/multiuser/Android.bp index cc68c1bca..1ad35f171 100644 --- a/tests/automotive/health/multiuser/Android.bp +++ b/tests/automotive/health/multiuser/Android.bp @@ -25,7 +25,6 @@ java_library_static { "androidx.test.rules", "automotive-settings-app-helper", "automotive-utility-helper", - "automotive-settings-scenarios", "app-helpers-auto-interfaces", "app-helpers-common-interfaces", "common-platform-scenarios", diff --git a/tests/automotive/health/multiuser/src/android/platform/scenario/multiuser/nonui/MultiUserConstants.java b/tests/automotive/health/multiuser/src/android/platform/scenario/multiuser/nonui/MultiUserConstants.java index a85733a3d..4d90ca2b2 100644 --- a/tests/automotive/health/multiuser/src/android/platform/scenario/multiuser/nonui/MultiUserConstants.java +++ b/tests/automotive/health/multiuser/src/android/platform/scenario/multiuser/nonui/MultiUserConstants.java @@ -19,19 +19,21 @@ package android.platform.scenario.multiuser; import android.platform.helpers.MultiUserHelper; import androidx.test.InstrumentationRegistry; -class MultiUserConstants { +public final class MultiUserConstants { // Shouldn't be too optimistic for the MU latency. The time to wait for system idle will be // 2 x (worst-case number) to make sure regression not affecting test itself. - static final long WAIT_FOR_IDLE_TIME_MS = 40000; + public static final long WAIT_FOR_IDLE_TIME_MS = 40000; // Default initial user does not change throughout the test process - static final int DEFAULT_INITIAL_USER = MultiUserHelper.getInstance().getInitialUser(); - - static final String INCLUDE_CREATION_TIME_KEY = "include_creation_time"; - static final boolean INCLUDE_CREATION_TIME = + public static final int DEFAULT_INITIAL_USER = MultiUserHelper.getInstance().getInitialUser(); + public static final String INCLUDE_CREATION_TIME_KEY = "include_creation_time"; + public static final boolean INCLUDE_CREATION_TIME = Boolean.valueOf( InstrumentationRegistry.getArguments().getString(INCLUDE_CREATION_TIME_KEY, "false")); + public static final String GUEST_NAME = "Guest"; + public static final String SECONDARY_USER_NAME = "SecondaryUser"; - static final String GUEST_NAME = "Guest"; - static final String SECONDARY_USER_NAME = "SecondaryUser"; + private MultiUserConstants() { + throw new RuntimeException("Class cannot be instantiated"); + } } diff --git a/tests/automotive/health/multiuser/tests/Android.bp b/tests/automotive/health/multiuser/tests/Android.bp index c5ea95c36..8409848fc 100644 --- a/tests/automotive/health/multiuser/tests/Android.bp +++ b/tests/automotive/health/multiuser/tests/Android.bp @@ -23,7 +23,6 @@ android_test { "androidx.test.runner", "androidx.test.rules", "automotive-multiuser-scenarios", - "automotive-settings-scenarios", "automotive-utility-helper", "automotive-health-test-rules", "automotive-settings-app-helper", diff --git a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/nonui/SwitchToNewSecondaryUserBenchmark.java b/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/nonui/SwitchToNewSecondaryUserBenchmark.java index 7ce42b6d0..434242b4d 100644 --- a/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/nonui/SwitchToNewSecondaryUserBenchmark.java +++ b/tests/automotive/health/multiuser/tests/src/android/platform/scenario/multiuser/nonui/SwitchToNewSecondaryUserBenchmark.java @@ -17,7 +17,17 @@ package android.platform.scenario.multiuser; import android.platform.test.microbenchmark.Microbenchmark; +import android.platform.test.microbenchmark.Microbenchmark.TightMethodRule; +import android.platform.test.rule.StopwatchRule; +import android.platform.test.scenario.SleepAtTestFinishRule; +import org.junit.Rule; import org.junit.runner.RunWith; @RunWith(Microbenchmark.class) -public class SwitchToNewSecondaryUserBenchmark extends SwitchToNewSecondaryUser {} +public class SwitchToNewSecondaryUserBenchmark extends SwitchToNewSecondaryUser { + @Rule + public SleepAtTestFinishRule sleepRule = + new SleepAtTestFinishRule(MultiUserConstants.WAIT_FOR_IDLE_TIME_MS); + + @TightMethodRule public StopwatchRule stopwatchRule = new StopwatchRule(); +} diff --git a/tests/automotive/health/notification/Android.bp b/tests/automotive/health/notification/Android.bp index 3acfb21b1..6d4a89962 100644 --- a/tests/automotive/health/notification/Android.bp +++ b/tests/automotive/health/notification/Android.bp @@ -22,7 +22,7 @@ java_library_static { srcs: [ "src/**/*.java" ], libs: [ "androidx.test.runner", - "automotive-settings-app-helper", + "automotive-notifications-app-helper", "app-helpers-auto-interfaces", "common-platform-scenarios", "platform-test-options", diff --git a/tests/automotive/health/notification/src/android/platform/scenario/notification/Scroll.java b/tests/automotive/health/notification/src/android/platform/scenario/notification/Scroll.java index 9c98602c3..79a26db22 100644 --- a/tests/automotive/health/notification/src/android/platform/scenario/notification/Scroll.java +++ b/tests/automotive/health/notification/src/android/platform/scenario/notification/Scroll.java @@ -17,10 +17,9 @@ package android.platform.test.scenario.notification; import android.platform.helpers.HelperAccessor; import android.platform.helpers.IAutoNotificationHelper; +import android.platform.helpers.IAutoNotificationMockingHelper; import android.platform.test.scenario.annotation.Scenario; -import android.platform.test.rule.NotificationPressureRule; -import org.junit.ClassRule; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -32,10 +31,8 @@ public class Scroll { static HelperAccessor<IAutoNotificationHelper> sHelper = new HelperAccessor<>(IAutoNotificationHelper.class); - // Populate notification before scrolling. - @ClassRule - public static NotificationPressureRule NotificationPressureRule = - new NotificationPressureRule(5); + static HelperAccessor<IAutoNotificationMockingHelper> sNotificationsMockingHelper = + new HelperAccessor<>(IAutoNotificationMockingHelper.class); @Test public void testScrollUpAndDown() { diff --git a/tests/automotive/health/notification/tests/Android.bp b/tests/automotive/health/notification/tests/Android.bp index 8c7f26668..f041ebc9c 100644 --- a/tests/automotive/health/notification/tests/Android.bp +++ b/tests/automotive/health/notification/tests/Android.bp @@ -24,7 +24,7 @@ android_test { "androidx.test.rules", "automotive-notification-scenarios", "automotive-health-test-rules", - "automotive-settings-app-helper", + "automotive-notifications-app-helper", "app-helpers-auto-interfaces", "ub-uiautomator", "collector-device-lib-platform", diff --git a/tests/automotive/health/notification/tests/src/android/platform/scenario/notification/ScrollMicrobenchmark.java b/tests/automotive/health/notification/tests/src/android/platform/scenario/notification/ScrollMicrobenchmark.java index 94124c87b..db1e7237e 100644 --- a/tests/automotive/health/notification/tests/src/android/platform/scenario/notification/ScrollMicrobenchmark.java +++ b/tests/automotive/health/notification/tests/src/android/platform/scenario/notification/ScrollMicrobenchmark.java @@ -25,11 +25,17 @@ import org.junit.runner.RunWith; public class ScrollMicrobenchmark extends Scroll { @BeforeClass public static void openApp() { + // Populate Notifications + sNotificationsMockingHelper.get().postNotifications(5); + // Open Notifications sHelper.get().open(); } @AfterClass public static void closeApp() { + // Clear All Notifications + sNotificationsMockingHelper.get().clearAllNotification(); + // Exit Notifications sHelper.get().exit(); } } diff --git a/tests/automotive/health/radio/Android.bp b/tests/automotive/health/radio/Android.bp deleted file mode 100644 index 89e7987a2..000000000 --- a/tests/automotive/health/radio/Android.bp +++ /dev/null @@ -1,32 +0,0 @@ -// 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. - -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -java_library_static { - name: "automotive-radio-scenarios", - min_sdk_version: "24", - srcs: [ "src/**/*.java" ], - libs: [ - "androidx.test.runner", - "automotive-settings-app-helper", - "app-helpers-auto-interfaces", - "common-platform-scenarios", - "platform-test-options", - "platform-test-rules", - "ub-uiautomator", - ], -} diff --git a/tests/automotive/health/radio/src/android/platform/scenario/radio/TuneAndPlay.java b/tests/automotive/health/radio/src/android/platform/scenario/radio/TuneAndPlay.java deleted file mode 100644 index 7bf813808..000000000 --- a/tests/automotive/health/radio/src/android/platform/scenario/radio/TuneAndPlay.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.radio; - -import static org.junit.Assume.assumeTrue; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoRadioHelper; -import android.platform.test.scenario.annotation.Scenario; -import android.support.test.uiautomator.By; -import android.support.test.uiautomator.UiDevice; -import android.support.test.uiautomator.Until; -import androidx.test.InstrumentationRegistry; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** This scenario will tune and play an FM station, assuming radio app is open. */ -@Scenario -@RunWith(JUnit4.class) -public class TuneAndPlay { - - private static final long OPEN_RADIO_TIMEOUT_MS = 10000; - private static HelperAccessor<IAutoRadioHelper> sHelper = - new HelperAccessor<>(IAutoRadioHelper.class); - - @Before - public void checkApp() { - // TODO: Remove the checking logic and use default helper open() method after migrating to Q - UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); - String pkgName = sHelper.get().getPackage(); - assumeTrue(device.wait(Until.hasObject(By.pkg(pkgName).depth(0)), OPEN_RADIO_TIMEOUT_MS)); - } - - @Test - public void testTuneAndPlay() { - sHelper.get().setStation("FM", 92.3); - sHelper.get().playRadio(); - } -} diff --git a/tests/automotive/health/radio/tests/Android.bp b/tests/automotive/health/radio/tests/Android.bp deleted file mode 100644 index 668017d84..000000000 --- a/tests/automotive/health/radio/tests/Android.bp +++ /dev/null @@ -1,38 +0,0 @@ -// 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. - -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -android_test { - name: "AndroidAutomotiveRadioScenarioTests", - min_sdk_version: "24", - static_libs: [ - "androidx.test.runner", - "androidx.test.rules", - "automotive-radio-scenarios", - "automotive-health-test-rules", - "automotive-settings-app-helper", - "app-helpers-auto-interfaces", - "ub-uiautomator", - "collector-device-lib-platform", - "common-platform-scenarios", - "common-platform-scenario-tests", - "microbenchmark-device-lib", - "platform-test-options", - ], - srcs: ["src/**/*.java"], - test_suites: ["catbox"], -} diff --git a/tests/automotive/health/radio/tests/AndroidManifest.xml b/tests/automotive/health/radio/tests/AndroidManifest.xml deleted file mode 100644 index 3dcbfdb0b..000000000 --- a/tests/automotive/health/radio/tests/AndroidManifest.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?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. ---> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="android.platform.test.scenario.radio" > - <uses-sdk android:minSdkVersion="24" android:targetSdkVersion="24" /> - <uses-permission android:name="android.permission.DUMP" /> - <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> - <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> - <uses-permission android:name="android.permission.MANAGE_USERS" /> - <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" /> - <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" /> - - <application> - <uses-library android:name="android.test.runner"/> - </application> - <instrumentation - android:name="androidx.test.runner.AndroidJUnitRunner" - android:targetPackage="android.platform.test.scenario.radio" - android:label="Android Automotive Radio Scenario-Based Tests" /> -</manifest>
\ No newline at end of file diff --git a/tests/automotive/health/radio/tests/src/android/platform/scenario/radio/OpenAppMicrobenchmark.java b/tests/automotive/health/radio/tests/src/android/platform/scenario/radio/OpenAppMicrobenchmark.java deleted file mode 100644 index b00e07113..000000000 --- a/tests/automotive/health/radio/tests/src/android/platform/scenario/radio/OpenAppMicrobenchmark.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ -package android.platform.test.scenario.radio; - -import android.platform.helpers.HelperAccessor; -import android.platform.helpers.IAutoGenericAppHelper; -import android.platform.test.scenario.AppStartupRunRule; -import android.platform.test.microbenchmark.Microbenchmark; - -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.runner.RunWith; - -@RunWith(Microbenchmark.class) -public class OpenAppMicrobenchmark extends OpenApp { - @Rule public AppStartupRunRule mAppStartupRunRule = new AppStartupRunRule<>(sHelper.get()); - - private static final String RADIO_PACKAGE = "com.android.car.radio"; - private static final String MEDIA_TEMPLATE = "android.car.intent.action.MEDIA_TEMPLATE"; - private static final Map<String, String> RADIO_SERVICE_EXTRA_ARGS = - Stream.of( - new Object[][] { - { - "android.car.intent.extra.MEDIA_COMPONENT", - "com.android.car.radio/com.android.car.radio.service.RadioAppService" - }, - }) - .collect(Collectors.toMap(data -> (String) data[0], data -> (String) data[1])); - - static HelperAccessor<IAutoGenericAppHelper> sRadioServiceHelper = - new HelperAccessor<>(IAutoGenericAppHelper.class); - - static { - sRadioServiceHelper.get().setPackage(RADIO_PACKAGE); - sRadioServiceHelper.get().setLaunchAction(MEDIA_TEMPLATE, RADIO_SERVICE_EXTRA_ARGS); - } - - @BeforeClass - public static void setUp() { - // Open radio via com.android.car.radio.service.RadioAppService once otherwise the - // foreground app could be stuck at some other media apps(e.g. Bluetooth). - sRadioServiceHelper.get().open(); - } -} |