diff options
56 files changed, 60 insertions, 1609 deletions
diff --git a/libraries/app-helpers/interfaces/auto/src/android/platform/helpers/IAutoDialHelper.java b/libraries/app-helpers/interfaces/auto/src/android/platform/helpers/IAutoDialHelper.java index a25324da5..81e72efe5 100644 --- a/libraries/app-helpers/interfaces/auto/src/android/platform/helpers/IAutoDialHelper.java +++ b/libraries/app-helpers/interfaces/auto/src/android/platform/helpers/IAutoDialHelper.java @@ -16,8 +16,7 @@ package android.platform.helpers; - -public interface IAutoDialHelper extends IAppHelper { +public interface IAutoDialHelper extends IAppHelper, Scrollable { /** enum class for contact list order type. */ enum OrderType { diff --git a/libraries/app-helpers/interfaces/auto/src/android/platform/helpers/utility/Scrollable.java b/libraries/app-helpers/interfaces/auto/src/android/platform/helpers/utility/Scrollable.java index cc8f9a831..5c08e97cc 100644 --- a/libraries/app-helpers/interfaces/auto/src/android/platform/helpers/utility/Scrollable.java +++ b/libraries/app-helpers/interfaces/auto/src/android/platform/helpers/utility/Scrollable.java @@ -29,6 +29,7 @@ import androidx.test.InstrumentationRegistry; */ public interface Scrollable { int DEFAULT_MARGIN = 5; + int DEFAULT_DURATION_MS = 1000; /** * Setup expectations: None @@ -50,6 +51,15 @@ public interface Scrollable { } /** + * Scroll up from the bottom of the scrollable region to top of the scrollable region (i.e. by + * one page). + */ + public default boolean scrollUpOnePage() { + scrollUpOnePage(DEFAULT_DURATION_MS); + return true; + } + + /** * Setup expectations: None. * * <p>Scroll up from the bottom of the scrollable region towards the top of the scrollable @@ -77,6 +87,15 @@ public interface Scrollable { } /** + * Scroll down from the top of the scrollable region to bottom of the scrollable region (i.e. by + * one page). + */ + public default boolean scrollDownOnePage() { + scrollDownOnePage(DEFAULT_DURATION_MS); + return true; + } + + /** * Setup expectations: None. * * <p>Scroll down from the top of the scrollable region towards the bottom of the scrollable 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/Android.bp b/tests/automotive/health/evs/tests/Android.bp deleted file mode 100644 index 544ba268e..000000000 --- a/tests/automotive/health/evs/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: "AndroidAutomotiveEvsScenarioTests", - min_sdk_version: "24", - static_libs: [ - "androidx.test.runner", - "androidx.test.rules", - "automotive-settings-scenarios", - "automotive-evs-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/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/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(); - } -} |