diff --git a/layout/tools/reftest/mach_commands.py b/layout/tools/reftest/mach_commands.py index d6a0b6a6546a..25e30028cfc7 100644 --- a/layout/tools/reftest/mach_commands.py +++ b/layout/tools/reftest/mach_commands.py @@ -154,7 +154,7 @@ class ReftestRunner(MozbuildObject): if not args.xrePath: args.xrePath = os.environ.get("MOZ_HOST_BIN") if not args.app: - args.app = "org.mozilla.geckoview.test" + args.app = "org.mozilla.geckoview.test_runner" if not args.utilityPath: args.utilityPath = args.xrePath args.ignoreWindowSize = True diff --git a/layout/tools/reftest/mach_test_package_commands.py b/layout/tools/reftest/mach_test_package_commands.py index e09e794d92eb..6b6f2f8fd93b 100644 --- a/layout/tools/reftest/mach_test_package_commands.py +++ b/layout/tools/reftest/mach_test_package_commands.py @@ -61,7 +61,7 @@ def run_reftest_desktop(context, args): def run_reftest_android(context, args): from remotereftest import run_test_harness - args.app = args.app or "org.mozilla.geckoview.test" + args.app = args.app or "org.mozilla.geckoview.test_runner" args.utilityPath = context.hostutils args.xrePath = context.hostutils args.httpdPath = context.module_dir diff --git a/mobile/android/geckoview/src/androidTest/AndroidManifest.xml b/mobile/android/geckoview/src/androidTest/AndroidManifest.xml index 3ed2da18e2e1..132eaf303098 100644 --- a/mobile/android/geckoview/src/androidTest/AndroidManifest.xml +++ b/mobile/android/geckoview/src/androidTest/AndroidManifest.xml @@ -13,22 +13,11 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java index 690931e9382f..59b1ff2291a9 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntime.java @@ -373,7 +373,7 @@ public final class GeckoRuntime implements Parcelable { if (info.xpcshell && (!BuildConfig.DEBUG - || !"org.mozilla.geckoview.test" + || !"org.mozilla.geckoview.test_runner" .equals(context.getApplicationContext().getPackageName()))) { throw new IllegalArgumentException("Only the test app can run -xpcshell."); } diff --git a/mobile/android/gradle.configure b/mobile/android/gradle.configure index be236802a29d..45ab62d71dbd 100644 --- a/mobile/android/gradle.configure +++ b/mobile/android/gradle.configure @@ -111,6 +111,42 @@ set_config( ) +@depends(gradle_android_build_config) +def gradle_android_geckoview_test_runner_bundle(build_config): + """Path to intermediates classes folder.""" + + def uncapitalize(s): + if s: + return s[0].lower() + s[1:] + else: + return s + + def capitalize(s): + # str.capitalize lower cases trailing letters. + if s: + return s[0].upper() + s[1:] + else: + return s + + productFlavor = uncapitalize( + "".join(capitalize(f) for f in build_config.geckoview.variant.productFlavors) + ) + buildType = uncapitalize(build_config.geckoview.variant.buildType) + variant = uncapitalize(build_config.geckoview.variant.name) + + return "gradle/build/mobile/android/test_runner/outputs/bundle/{}/test_runner-{}-{}.aab".format( + variant, + productFlavor, + buildType, + ) + + +set_config( + "GRADLE_ANDROID_GECKOVIEW_TEST_RUNNER_BUNDLE", + gradle_android_geckoview_test_runner_bundle, +) + + @depends(gradle_android_build_config) def gradle_android_variant_name(build_config): """Like "withoutGeckoBinariesDebug".""" @@ -231,6 +267,7 @@ set_config( "mobile/android/annotations", "mobile/android/geckoview", "mobile/android/geckoview_example", + "mobile/android/test_runner", "mobile/android/examples/messaging_example", "mobile/android/examples/port_messaging_example", ], @@ -283,6 +320,9 @@ def gradle_android_archive_geckoview_tasks(build_config): "geckoview:assemble{geckoview.variant.name}AndroidTest".format( geckoview=build_config.geckoview ), + "test_runner:assemble{geckoview_example.variant.name}".format( + geckoview_example=build_config.geckoview_example + ), "geckoview_example:assemble{geckoview_example.variant.name}".format( geckoview_example=build_config.geckoview_example ), @@ -384,6 +424,9 @@ def gradle_android_build_geckoview_example_tasks(build_config): "geckoview:assemble{geckoview.variant.name}AndroidTest".format( geckoview=build_config.geckoview ), + "test_runner:assemble{geckoview.variant.name}".format( + geckoview=build_config.geckoview + ), ] @@ -393,6 +436,22 @@ set_config( ) +@depends(gradle_android_build_config) +def gradle_android_install_geckoview_test_runner_tasks(build_config): + """Gradle tasks run by |mach android install-geckoview-test_runner|.""" + return [ + "test_runner:install{geckoview.variant.name}".format( + geckoview=build_config.geckoview + ), + ] + + +set_config( + "GRADLE_ANDROID_INSTALL_GECKOVIEW_TEST_RUNNER_TASKS", + gradle_android_install_geckoview_test_runner_tasks, +) + + @depends(gradle_android_build_config) def gradle_android_install_geckoview_example_tasks(build_config): """Gradle tasks run by |mach android install-geckoview_example|.""" diff --git a/mobile/android/mach_commands.py b/mobile/android/mach_commands.py index f8f8a4f70de4..1336eb84f85a 100644 --- a/mobile/android/mach_commands.py +++ b/mobile/android/mach_commands.py @@ -223,6 +223,15 @@ def android_build_geckoview_example(command_context, args): return 0 +def install_app_bundle(command_context, bundle): + from mozdevice import ADBDeviceFactory + + bundletool = mozpath.join(command_context._mach_context.state_dir, "bundletool.jar") + device = ADBDeviceFactory(verbose=True) + bundle_path = mozpath.join(command_context.topobjdir, bundle) + device.install_app_bundle(bundletool, bundle_path, timeout=120) + + @SubCommand("android", "install-geckoview_example", """Install geckoview_example """) @CommandArgument("args", nargs=argparse.REMAINDER) def android_install_geckoview_example(command_context, args): @@ -240,6 +249,34 @@ def android_install_geckoview_example(command_context, args): return 0 +@SubCommand( + "android", "install-geckoview-test_runner", """Install geckoview.test_runner """ +) +@CommandArgument("args", nargs=argparse.REMAINDER) +def android_install_geckoview_test_runner(command_context, args): + gradle( + command_context, + command_context.substs["GRADLE_ANDROID_INSTALL_GECKOVIEW_TEST_RUNNER_TASKS"] + + args, + verbose=True, + ) + return 0 + + +@SubCommand( + "android", + "install-geckoview-test_runner-aab", + """Install geckoview.test_runner with AAB""", +) +@CommandArgument("args", nargs=argparse.REMAINDER) +def android_install_geckoview_test_runner_aab(command_context, args): + install_app_bundle( + command_context, + command_context.substs["GRADLE_ANDROID_GECKOVIEW_TEST_RUNNER_BUNDLE"], + ) + return 0 + + @SubCommand( "android", "geckoview-docs", diff --git a/mobile/android/test_runner/build.gradle b/mobile/android/test_runner/build.gradle new file mode 100644 index 000000000000..2dfa8c685c06 --- /dev/null +++ b/mobile/android/test_runner/build.gradle @@ -0,0 +1,63 @@ +buildDir "${topobjdir}/gradle/build/mobile/android/test_runner" + +apply plugin: 'com.android.application' + +apply from: "${topsrcdir}/mobile/android/gradle/product_flavors.gradle" + +android { + buildToolsVersion project.ext.buildToolsVersion + compileSdkVersion project.ext.compileSdkVersion + + defaultConfig { + targetSdkVersion project.ext.targetSdkVersion + minSdkVersion project.ext.minSdkVersion + manifestPlaceholders = project.ext.manifestPlaceholders + + applicationId "org.mozilla.geckoview.test_runner" + versionCode 1 + versionName "1.0" + + multiDexEnabled true + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + dexOptions { + javaMaxHeapSize "32g" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + + // By default the android plugins ignores folders that start with `_`, but + // we need those in web extensions. + // See also: + // - https://issuetracker.google.com/issues/36911326 + // - https://stackoverflow.com/questions/9206117/how-to-workaround-autoomitting-fiiles-folders-starting-with-underscore-in + aaptOptions { + ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~' + noCompress 'ja' + } + + project.configureProductFlavors.delegate = it + project.configureProductFlavors() +} + +dependencies { + implementation "androidx.annotation:annotation:1.0.0" + implementation "androidx.appcompat:appcompat:1.0.0" + implementation "androidx.preference:preference:1.0.0" + + implementation project(path: ':geckoview') + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'com.google.android.material:material:1.0.0' + + implementation 'androidx.multidex:multidex:2.0.0' +} diff --git a/mobile/android/test_runner/src/main/AndroidManifest.xml b/mobile/android/test_runner/src/main/AndroidManifest.xml new file mode 100644 index 000000000000..4909b7aa9646 --- /dev/null +++ b/mobile/android/test_runner/src/main/AndroidManifest.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mobile/android/geckoview/src/androidTest/assets/web_extensions/test-runner-support/manifest.json b/mobile/android/test_runner/src/main/assets/test-runner-support/manifest.json similarity index 100% rename from mobile/android/geckoview/src/androidTest/assets/web_extensions/test-runner-support/manifest.json rename to mobile/android/test_runner/src/main/assets/test-runner-support/manifest.json diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerActivity.java b/mobile/android/test_runner/src/main/java/org/mozilla/geckoview/test_runner/TestRunnerActivity.java similarity index 98% rename from mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerActivity.java rename to mobile/android/test_runner/src/main/java/org/mozilla/geckoview/test_runner/TestRunnerActivity.java index aa93f885c242..15c3fd686d94 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerActivity.java +++ b/mobile/android/test_runner/src/main/java/org/mozilla/geckoview/test_runner/TestRunnerActivity.java @@ -1,7 +1,7 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -package org.mozilla.geckoview.test; +package org.mozilla.geckoview.test_runner; import android.app.Activity; import android.content.Intent; @@ -385,8 +385,7 @@ public class TestRunnerActivity extends Activity { .contentBlocking( new ContentBlocking.Settings.Builder() .safeBrowsingProviders(google, googleLegacy) - .build()) - .crashHandler(TestCrashHandler.class); + .build()); sRuntime = GeckoRuntime.create(this, runtimeSettingsBuilder.build()); @@ -400,7 +399,7 @@ public class TestRunnerActivity extends Activity { }); webExtensionController() - .installBuiltIn("resource://android/assets/web_extensions/test-runner-support/") + .installBuiltIn("resource://android/assets/test-runner-support/") .accept( extension -> { extension.setMessageDelegate(mApiEngine, "test-runner-support"); diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerApiEngine.java b/mobile/android/test_runner/src/main/java/org/mozilla/geckoview/test_runner/TestRunnerApiEngine.java similarity index 98% rename from mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerApiEngine.java rename to mobile/android/test_runner/src/main/java/org/mozilla/geckoview/test_runner/TestRunnerApiEngine.java index 2873999119c4..7d6a72d62fe9 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerApiEngine.java +++ b/mobile/android/test_runner/src/main/java/org/mozilla/geckoview/test_runner/TestRunnerApiEngine.java @@ -1,7 +1,7 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -package org.mozilla.geckoview.test; +package org.mozilla.geckoview.test_runner; import android.util.Log; import androidx.annotation.NonNull; diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/XpcshellTestRunnerService.java b/mobile/android/test_runner/src/main/java/org/mozilla/geckoview/test_runner/XpcshellTestRunnerService.java similarity index 98% rename from mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/XpcshellTestRunnerService.java rename to mobile/android/test_runner/src/main/java/org/mozilla/geckoview/test_runner/XpcshellTestRunnerService.java index 10adcbda3f16..c4ba7b35b7b8 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/XpcshellTestRunnerService.java +++ b/mobile/android/test_runner/src/main/java/org/mozilla/geckoview/test_runner/XpcshellTestRunnerService.java @@ -1,7 +1,7 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -package org.mozilla.geckoview.test; +package org.mozilla.geckoview.test_runner; import android.app.Service; import android.content.Intent; @@ -81,7 +81,6 @@ public class XpcshellTestRunnerService extends Service { new ContentBlocking.Settings.Builder() .safeBrowsingProviders(google, googleLegacy) .build()) - .crashHandler(TestCrashHandler.class) .build(); sRuntime = GeckoRuntime.create(this, runtimeSettings); diff --git a/mobile/android/test_runner/src/main/res/drawable-nodpi/colors.png b/mobile/android/test_runner/src/main/res/drawable-nodpi/colors.png new file mode 100644 index 000000000000..c9a2788e538e Binary files /dev/null and b/mobile/android/test_runner/src/main/res/drawable-nodpi/colors.png differ diff --git a/mobile/android/test_runner/src/main/res/drawable-nodpi/colors_br.png b/mobile/android/test_runner/src/main/res/drawable-nodpi/colors_br.png new file mode 100644 index 000000000000..da4eba73b3d3 Binary files /dev/null and b/mobile/android/test_runner/src/main/res/drawable-nodpi/colors_br.png differ diff --git a/mobile/android/test_runner/src/main/res/drawable-nodpi/colors_br_scaled.png b/mobile/android/test_runner/src/main/res/drawable-nodpi/colors_br_scaled.png new file mode 100644 index 000000000000..c402e73bb6a8 Binary files /dev/null and b/mobile/android/test_runner/src/main/res/drawable-nodpi/colors_br_scaled.png differ diff --git a/mobile/android/test_runner/src/main/res/drawable-nodpi/colors_tl.png b/mobile/android/test_runner/src/main/res/drawable-nodpi/colors_tl.png new file mode 100644 index 000000000000..eda5c5ebf002 Binary files /dev/null and b/mobile/android/test_runner/src/main/res/drawable-nodpi/colors_tl.png differ diff --git a/mobile/android/test_runner/src/main/res/drawable-nodpi/colors_tl_scaled.png b/mobile/android/test_runner/src/main/res/drawable-nodpi/colors_tl_scaled.png new file mode 100644 index 000000000000..0ce5a631c465 Binary files /dev/null and b/mobile/android/test_runner/src/main/res/drawable-nodpi/colors_tl_scaled.png differ diff --git a/mobile/android/geckoview/src/androidTest/res/drawable/ic_launcher_background.xml b/mobile/android/test_runner/src/main/res/drawable/ic_launcher_background.xml similarity index 100% rename from mobile/android/geckoview/src/androidTest/res/drawable/ic_launcher_background.xml rename to mobile/android/test_runner/src/main/res/drawable/ic_launcher_background.xml diff --git a/mobile/android/geckoview/src/androidTest/res/mipmap-hdpi/ic_launcher.png b/mobile/android/test_runner/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from mobile/android/geckoview/src/androidTest/res/mipmap-hdpi/ic_launcher.png rename to mobile/android/test_runner/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/mobile/android/geckoview/src/androidTest/res/mipmap-hdpi/ic_launcher_round.png b/mobile/android/test_runner/src/main/res/mipmap-hdpi/ic_launcher_round.png similarity index 100% rename from mobile/android/geckoview/src/androidTest/res/mipmap-hdpi/ic_launcher_round.png rename to mobile/android/test_runner/src/main/res/mipmap-hdpi/ic_launcher_round.png diff --git a/mobile/android/geckoview/src/androidTest/res/mipmap-mdpi/ic_launcher.png b/mobile/android/test_runner/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from mobile/android/geckoview/src/androidTest/res/mipmap-mdpi/ic_launcher.png rename to mobile/android/test_runner/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/mobile/android/geckoview/src/androidTest/res/mipmap-mdpi/ic_launcher_round.png b/mobile/android/test_runner/src/main/res/mipmap-mdpi/ic_launcher_round.png similarity index 100% rename from mobile/android/geckoview/src/androidTest/res/mipmap-mdpi/ic_launcher_round.png rename to mobile/android/test_runner/src/main/res/mipmap-mdpi/ic_launcher_round.png diff --git a/mobile/android/geckoview/src/androidTest/res/mipmap-xhdpi/ic_launcher.png b/mobile/android/test_runner/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from mobile/android/geckoview/src/androidTest/res/mipmap-xhdpi/ic_launcher.png rename to mobile/android/test_runner/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/mobile/android/geckoview/src/androidTest/res/mipmap-xhdpi/ic_launcher_round.png b/mobile/android/test_runner/src/main/res/mipmap-xhdpi/ic_launcher_round.png similarity index 100% rename from mobile/android/geckoview/src/androidTest/res/mipmap-xhdpi/ic_launcher_round.png rename to mobile/android/test_runner/src/main/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/mobile/android/geckoview/src/androidTest/res/mipmap-xxhdpi/ic_launcher.png b/mobile/android/test_runner/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from mobile/android/geckoview/src/androidTest/res/mipmap-xxhdpi/ic_launcher.png rename to mobile/android/test_runner/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/mobile/android/geckoview/src/androidTest/res/mipmap-xxhdpi/ic_launcher_round.png b/mobile/android/test_runner/src/main/res/mipmap-xxhdpi/ic_launcher_round.png similarity index 100% rename from mobile/android/geckoview/src/androidTest/res/mipmap-xxhdpi/ic_launcher_round.png rename to mobile/android/test_runner/src/main/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/mobile/android/geckoview/src/androidTest/res/mipmap-xxxhdpi/ic_launcher.png b/mobile/android/test_runner/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from mobile/android/geckoview/src/androidTest/res/mipmap-xxxhdpi/ic_launcher.png rename to mobile/android/test_runner/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/mobile/android/geckoview/src/androidTest/res/mipmap-xxxhdpi/ic_launcher_round.png b/mobile/android/test_runner/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png similarity index 100% rename from mobile/android/geckoview/src/androidTest/res/mipmap-xxxhdpi/ic_launcher_round.png rename to mobile/android/test_runner/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/mobile/android/test_runner/src/main/res/values/colors.xml b/mobile/android/test_runner/src/main/res/values/colors.xml new file mode 100644 index 000000000000..3a96673022c0 --- /dev/null +++ b/mobile/android/test_runner/src/main/res/values/colors.xml @@ -0,0 +1,9 @@ + + + + #3F51B5 + #303F9F + #FF4081 + diff --git a/mobile/android/test_runner/src/main/res/values/strings.xml b/mobile/android/test_runner/src/main/res/values/strings.xml new file mode 100644 index 000000000000..7831a536eb65 --- /dev/null +++ b/mobile/android/test_runner/src/main/res/values/strings.xml @@ -0,0 +1,7 @@ + + + + GeckoView Test Runner + diff --git a/mobile/android/test_runner/src/main/res/values/styles.xml b/mobile/android/test_runner/src/main/res/values/styles.xml new file mode 100644 index 000000000000..60abe4bf6306 --- /dev/null +++ b/mobile/android/test_runner/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index 4c730f94f772..2d4468ca6ac9 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -571,7 +571,7 @@ def join_ensure_dir(dir1, dir2): @CommandArgumentGroup("Android") @CommandArgument( "--package", - default="org.mozilla.geckoview.test", + default="org.mozilla.geckoview.test_runner", group="Android", help="Package name of test app.", ) @@ -1247,8 +1247,8 @@ def _run_android( if app == "org.mozilla.geckoview_example": activity_name = "org.mozilla.geckoview_example.GeckoViewActivity" - elif app == "org.mozilla.geckoview.test": - activity_name = "org.mozilla.geckoview.test.TestRunnerActivity" + elif app == "org.mozilla.geckoview.test_runner": + activity_name = "org.mozilla.geckoview.test_runner.TestRunnerActivity" elif "fennec" in app or "firefox" in app: activity_name = "org.mozilla.gecko.BrowserApp" else: diff --git a/settings.gradle b/settings.gradle index 08854884e3ed..512a68d31d0d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -53,11 +53,13 @@ System.setProperty('android.home', json.substs.ANDROID_SDK_ROOT) include ':annotations', ':messaging_example', ':port_messaging_example' include ':geckoview' include ':geckoview_example' +include ':test_runner' include ':omnijar' project(':annotations').projectDir = new File("${json.topsrcdir}/mobile/android/annotations") project(':geckoview').projectDir = new File("${json.topsrcdir}/mobile/android/geckoview") project(':geckoview_example').projectDir = new File("${json.topsrcdir}/mobile/android/geckoview_example") +project(':test_runner').projectDir = new File("${json.topsrcdir}/mobile/android/test_runner") project(':omnijar').projectDir = new File("${json.topsrcdir}/mobile/android/app/omnijar") // The Gradle instance is shared between settings.gradle and all the diff --git a/taskcluster/ci/build-fat-aar/kind.yml b/taskcluster/ci/build-fat-aar/kind.yml index 8cc6d9790382..02430b1fc2d9 100644 --- a/taskcluster/ci/build-fat-aar/kind.yml +++ b/taskcluster/ci/build-fat-aar/kind.yml @@ -40,6 +40,9 @@ job-defaults: - name: public/build/geckoview-androidTest.apk path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview/outputs/apk/androidTest/withGeckoBinaries/debug/geckoview-withGeckoBinaries-debug-androidTest.apk type: file + - name: public/build/geckoview-test_runner.apk + path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/test_runner/outputs/apk/withGeckoBinaries/debug/test_runner-withGeckoBinaries-debug.apk + type: file - name: public/build/geckoview_example.apk path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview_example/outputs/apk/withGeckoBinaries/debug/geckoview_example-withGeckoBinaries-debug.apk type: file diff --git a/taskcluster/ci/build/android.yml b/taskcluster/ci/build/android.yml index 5c842f646a83..81ab171f5bac 100644 --- a/taskcluster/ci/build/android.yml +++ b/taskcluster/ci/build/android.yml @@ -19,6 +19,9 @@ job-defaults: - name: public/build/geckoview-androidTest.apk path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview/outputs/apk/androidTest/withGeckoBinaries/debug/geckoview-withGeckoBinaries-debug-androidTest.apk type: file + - name: public/build/geckoview-test_runner.apk + path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/test_runner/outputs/apk/withGeckoBinaries/debug/test_runner-withGeckoBinaries-debug.apk + type: file - name: public/build/geckoview_example.apk path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview_example/outputs/apk/withGeckoBinaries/debug/geckoview_example-withGeckoBinaries-debug.apk type: file diff --git a/taskcluster/ci/generate-profile/kind.yml b/taskcluster/ci/generate-profile/kind.yml index bba3a84cdcaa..2309e4aa3a6b 100644 --- a/taskcluster/ci/generate-profile/kind.yml +++ b/taskcluster/ci/generate-profile/kind.yml @@ -112,7 +112,7 @@ jobs: job-script: taskcluster/scripts/tester/test-linux.sh script: android_emulator_pgo.py tooltool-downloads: internal - options: [installer-path=/builds/worker/fetches/geckoview-androidTest.apk] + options: [installer-path=/builds/worker/fetches/geckoview-test_runner.apk] config: - android/android_common.py - android/android-x86_64-profile-generation.py @@ -152,7 +152,7 @@ jobs: job-script: taskcluster/scripts/tester/test-linux.sh script: android_emulator_pgo.py tooltool-downloads: internal - options: [installer-path=/builds/worker/fetches/geckoview-androidTest.apk] + options: [installer-path=/builds/worker/fetches/geckoview-test_runner.apk] config: - android/android_common.py - android/android-x86_64-profile-generation.py diff --git a/taskcluster/ci/instrumented-build/kind.yml b/taskcluster/ci/instrumented-build/kind.yml index 6337bcc64ee5..a15d177a4d8f 100644 --- a/taskcluster/ci/instrumented-build/kind.yml +++ b/taskcluster/ci/instrumented-build/kind.yml @@ -156,6 +156,9 @@ jobs: - name: public/build/geckoview-androidTest.apk path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview/outputs/apk/androidTest/withGeckoBinaries/debug/geckoview-withGeckoBinaries-debug-androidTest.apk type: file + - name: public/build/geckoview-test_runner.apk + path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/test_runner/outputs/apk/withGeckoBinaries/debug/test_runner-withGeckoBinaries-debug.apk + type: file - name: public/build/geckoview_example.apk path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview_example/outputs/apk/withGeckoBinaries/debug/geckoview_example-withGeckoBinaries-debug.apk type: file @@ -202,6 +205,9 @@ jobs: - name: public/build/geckoview-androidTest.apk path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview/outputs/apk/androidTest/withGeckoBinaries/debug/geckoview-withGeckoBinaries-debug-androidTest.apk type: file + - name: public/build/geckoview-test_runner.apk + path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/test_runner/outputs/apk/withGeckoBinaries/debug/test_runner-withGeckoBinaries-debug.apk + type: file - name: public/build/geckoview_example.apk path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview_example/outputs/apk/withGeckoBinaries/debug/geckoview_example-withGeckoBinaries-debug.apk type: file diff --git a/taskcluster/ci/test/compiled.yml b/taskcluster/ci/test/compiled.yml index b3086789699b..07faad550b00 100644 --- a/taskcluster/ci/test/compiled.yml +++ b/taskcluster/ci/test/compiled.yml @@ -36,7 +36,7 @@ cppunit: treeherder-symbol: cppunit target: by-test-platform: - android-em-7.*: geckoview-androidTest.apk + android-em-7.*: geckoview-test_runner.apk default: null tier: default run-on-projects: built-projects @@ -57,7 +57,7 @@ gtest: default: built-projects target: by-test-platform: - android-em-7.*: geckoview-androidTest.apk + android-em-7.*: geckoview-test_runner.apk default: null tier: by-test-platform: @@ -97,7 +97,7 @@ jittest: default: true target: by-test-platform: - android-.*: geckoview-androidTest.apk + android-.*: geckoview-test_runner.apk default: null tier: by-test-platform: @@ -123,7 +123,7 @@ jittest-all: default: None target: by-test-platform: - android-.*: geckoview-androidTest.apk + android-.*: geckoview-test_runner.apk default: null tier: by-test-platform: diff --git a/taskcluster/ci/test/mochitest.yml b/taskcluster/ci/test/mochitest.yml index 2da666f8ebbc..3ccfc08d7ab2 100644 --- a/taskcluster/ci/test/mochitest.yml +++ b/taskcluster/ci/test/mochitest.yml @@ -7,8 +7,8 @@ job-defaults: category: mochitest target: by-test-platform: - android-em-7.*: geckoview-androidTest.apk - android-hw.*: geckoview-androidTest.apk + android-em-7.*: geckoview-test_runner.apk + android-hw.*: geckoview-test_runner.apk default: null tier: by-variant: diff --git a/taskcluster/ci/test/reftest.yml b/taskcluster/ci/test/reftest.yml index 8e66c864e886..e85860bf85a2 100644 --- a/taskcluster/ci/test/reftest.yml +++ b/taskcluster/ci/test/reftest.yml @@ -7,8 +7,8 @@ job-defaults: category: reftest target: by-test-platform: - android-em-7.*: geckoview-androidTest.apk - android-hw-.*: geckoview-androidTest.apk + android-em-7.*: geckoview-test_runner.apk + android-hw-.*: geckoview-test_runner.apk default: null python-3: true tier: diff --git a/taskcluster/ci/test/web-platform.yml b/taskcluster/ci/test/web-platform.yml index 2df5a3ae6ca3..827377226612 100644 --- a/taskcluster/ci/test/web-platform.yml +++ b/taskcluster/ci/test/web-platform.yml @@ -26,9 +26,9 @@ job-defaults: - remove_executables.py target: by-test-platform: - android-em-7.0-x86_64-shippable(-lite)?-qr/opt: geckoview-androidTest.apk - android-em-7.0-x86_64(-lite)?-qr/opt: geckoview-androidTest.apk - android-em-7.0-x86_64(-lite)?-qr/debug(-isolated-process)?: geckoview-androidTest.apk + android-em-7.0-x86_64-shippable(-lite)?-qr/opt: geckoview-test_runner.apk + android-em-7.0-x86_64(-lite)?-qr/opt: geckoview-test_runner.apk + android-em-7.0-x86_64(-lite)?-qr/debug(-isolated-process)?: geckoview-test_runner.apk default: null python-3: true diff --git a/taskcluster/ci/test/xpcshell.yml b/taskcluster/ci/test/xpcshell.yml index 9a7cc64a70db..abbc6065456c 100644 --- a/taskcluster/ci/test/xpcshell.yml +++ b/taskcluster/ci/test/xpcshell.yml @@ -6,7 +6,7 @@ job-defaults: suite: xpcshell target: by-test-platform: - android-em-7.*: geckoview-androidTest.apk + android-em-7.*: geckoview-test_runner.apk default: null python-3: true mozharness: diff --git a/taskcluster/gecko_taskgraph/transforms/run_pgo_profile.py b/taskcluster/gecko_taskgraph/transforms/run_pgo_profile.py index 2481878cca1c..d6bf3fecddba 100644 --- a/taskcluster/gecko_taskgraph/transforms/run_pgo_profile.py +++ b/taskcluster/gecko_taskgraph/transforms/run_pgo_profile.py @@ -21,7 +21,7 @@ def run_profile_data(config, jobs): build_platform = job["attributes"].get("build_platform") instr = "instrumented-build-{}".format(job["name"]) if "android" in build_platform: - artifact = "geckoview-androidTest.apk" + artifact = "geckoview-test_runner.apk" elif "macosx64" in build_platform: artifact = "target.dmg" elif "win" in build_platform: diff --git a/testing/gtest/remotegtests.py b/testing/gtest/remotegtests.py index 335f71385bbf..43f3124a1d8b 100644 --- a/testing/gtest/remotegtests.py +++ b/testing/gtest/remotegtests.py @@ -367,7 +367,7 @@ class remoteGtestOptions(argparse.ArgumentParser): self.add_argument( "--package", dest="package", - default="org.mozilla.geckoview.test", + default="org.mozilla.geckoview.test_runner", help="Package name of test app.", ) self.add_argument( diff --git a/testing/mochitest/mach_commands.py b/testing/mochitest/mach_commands.py index 45f817954302..7220a77331f6 100644 --- a/testing/mochitest/mach_commands.py +++ b/testing/mochitest/mach_commands.py @@ -459,7 +459,7 @@ def run_mochitest_general( app = kwargs.get("app") if not app: - app = "org.mozilla.geckoview.test" + app = "org.mozilla.geckoview.test_runner" device_serial = kwargs.get("deviceSerial") install = InstallIntent.NO if kwargs.get("no_install") else InstallIntent.YES diff --git a/testing/mochitest/mach_test_package_commands.py b/testing/mochitest/mach_test_package_commands.py index 27327ce5ab01..b02937ee62df 100644 --- a/testing/mochitest/mach_test_package_commands.py +++ b/testing/mochitest/mach_test_package_commands.py @@ -121,7 +121,7 @@ def run_mochitest_desktop(context, args): def set_android_args(context, args): - args.app = args.app or "org.mozilla.geckoview.test" + args.app = args.app or "org.mozilla.geckoview.test_runner" args.utilityPath = context.hostutils args.xrePath = context.hostutils config = context.mozharness_config diff --git a/testing/mochitest/mochitest_options.py b/testing/mochitest/mochitest_options.py index 2b92dbf4bb8e..3abf18158c39 100644 --- a/testing/mochitest/mochitest_options.py +++ b/testing/mochitest/mochitest_options.py @@ -1307,7 +1307,7 @@ class AndroidArguments(ArgumentContainer): options.webServer = options.remoteWebServer if options.app is None: - options.app = "org.mozilla.geckoview.test" + options.app = "org.mozilla.geckoview.test_runner" if build_obj and "MOZ_HOST_BIN" in os.environ: options.xrePath = os.environ["MOZ_HOST_BIN"] diff --git a/testing/mozbase/mozdevice/mozdevice/adb.py b/testing/mozbase/mozdevice/mozdevice/adb.py index 39de059edd3a..022b345dd3fe 100644 --- a/testing/mozbase/mozdevice/mozdevice/adb.py +++ b/testing/mozbase/mozdevice/mozdevice/adb.py @@ -752,8 +752,8 @@ class ADBDevice(ADBCommand): adbdevice = ADBDevice() print(adbdevice.list_files("/mnt/sdcard")) - if adbdevice.process_exist("org.mozilla.geckoview.test"): - print("org.mozilla.geckoview.test is running") + if adbdevice.process_exist("org.mozilla.geckoview.test_runner"): + print("org.mozilla.geckoview.test_runner is running") """ SOCKET_DIRECTION_REVERSE = "reverse" @@ -4187,7 +4187,7 @@ class ADBDevice(ADBCommand): debugging arguments; convenient for geckoview apps. :param str app_name: Name of application (e.g. - `org.mozilla.geckoview_example` or `org.mozilla.geckoview.test`) + `org.mozilla.geckoview_example` or `org.mozilla.geckoview.test_runner`) :param str activity_name: Activity name, like `GeckoViewActivity`, or `TestRunnerActivity`. :param str intent: Intent to launch application. @@ -4256,7 +4256,7 @@ class ADBDevice(ADBCommand): debugging arguments; convenient for geckoview apps. :param str app_name: Name of application (e.g. - `org.mozilla.geckoview_example` or `org.mozilla.geckoview.test`) + `org.mozilla.geckoview_example` or `org.mozilla.geckoview.test_runner`) :param str activity_name: Activity name, like `GeckoViewActivity`, or `TestRunnerActivity`. :param str intent: Intent to launch application. diff --git a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py index 188c6b89a9e9..df573836fa38 100644 --- a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py +++ b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py @@ -326,7 +326,7 @@ def verify_android_device( # - it prevents testing against other builds (downloaded apk) # - installation may take a couple of minutes. if not app: - app = "org.mozilla.geckoview.test" + app = "org.mozilla.geckoview.test_runner" device = _get_device(build_obj.substs, device_serial) response = "" installed = device.is_app_installed(app) @@ -346,6 +346,14 @@ def verify_android_device( build_obj._mach_context.commands.dispatch( "gradle", build_obj._mach_context, args=[sub] ) + elif app == "org.mozilla.geckoview.test_runner": + if installed: + device.uninstall_app(app) + _log_info("Installing geckoview test_runner...") + sub = "install-geckoview-test_runner" + build_obj._mach_context.commands.dispatch( + "android", build_obj._mach_context, subcommand=sub, args=[] + ) elif app == "org.mozilla.geckoview_example": if installed: device.uninstall_app(app) @@ -528,7 +536,7 @@ def get_adb_path(build_obj): def grant_runtime_permissions(build_obj, app, device_serial=None): """ Grant required runtime permissions to the specified app - (eg. org.mozilla.geckoview.test). + (eg. org.mozilla.geckoview.test_runner). """ device = _get_device(build_obj.substs, device_serial) device.run_as_package = app diff --git a/testing/mozharness/mozharness/mozilla/testing/android.py b/testing/mozharness/mozharness/mozilla/testing/android.py index 39bc3216857c..e16ab0ce46f2 100644 --- a/testing/mozharness/mozharness/mozilla/testing/android.py +++ b/testing/mozharness/mozharness/mozilla/testing/android.py @@ -508,6 +508,8 @@ class AndroidMixin(object): # target looks like geckoview. if "androidTest" in self.installer_path: self.app_name = "org.mozilla.geckoview.test" + elif "test_runner" in self.installer_path: + self.app_name = "org.mozilla.geckoview.test_runner" elif "geckoview" in self.installer_path: self.app_name = "org.mozilla.geckoview_example" if self.app_name is None: diff --git a/testing/web-platform/README.md b/testing/web-platform/README.md index 730ab82ea466..747d8605ebe3 100644 --- a/testing/web-platform/README.md +++ b/testing/web-platform/README.md @@ -39,12 +39,12 @@ Running in Android (GeckoView) You can run the tests against a Gecko-based browser (GeckoView) on an Android emulator. As shown below, to do so you must start an emulator, build Firefox for Android and then run mach wpt with the -`org.mozilla.geckoview.test` package. The package will be installed +`org.mozilla.geckoview.test_runner` package. The package will be installed interactively by `mach` and tests will run against TestRunnerActivity. ./mach android-emulator --version x86-7.0 ./mach build - ./mach wpt --package=org.mozilla.geckoview.test + ./mach wpt --package=org.mozilla.geckoview.test_runner FAQ --- diff --git a/testing/web-platform/mach_commands.py b/testing/web-platform/mach_commands.py index aec9826aa2a1..ce7cca0df00f 100644 --- a/testing/web-platform/mach_commands.py +++ b/testing/web-platform/mach_commands.py @@ -52,7 +52,9 @@ class WebPlatformTestsRunnerSetup(MozbuildObject): # package_name may be different in the future package_name = kwargs["package_name"] if not package_name: - kwargs["package_name"] = package_name = "org.mozilla.geckoview.test" + kwargs[ + "package_name" + ] = package_name = "org.mozilla.geckoview.test_runner" # Note that this import may fail in non-firefox-for-android trees from mozrunner.devices.android_device import ( diff --git a/testing/web-platform/tests/tools/wpt/run.py b/testing/web-platform/tests/tools/wpt/run.py index ca90cc1ee939..ff0d1a1b9bc9 100644 --- a/testing/web-platform/tests/tools/wpt/run.py +++ b/testing/web-platform/tests/tools/wpt/run.py @@ -286,7 +286,7 @@ class FirefoxAndroid(BrowserSetup): kwargs["prefs_root"] = prefs_root if kwargs["package_name"] is None: - kwargs["package_name"] = "org.mozilla.geckoview.test" + kwargs["package_name"] = "org.mozilla.geckoview.test_runner" app = kwargs["package_name"] if kwargs["device_serial"] is None: diff --git a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox_android.py b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox_android.py index 0eaa81a0e431..6b7c1318e4f1 100644 --- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox_android.py +++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox_android.py @@ -133,7 +133,7 @@ class FirefoxAndroidBrowser(Browser): init_timeout = 300 shutdown_timeout = 60 - def __init__(self, logger, prefs_root, test_type, package_name="org.mozilla.geckoview.test", + def __init__(self, logger, prefs_root, test_type, package_name="org.mozilla.geckoview.test_runner", device_serial="emulator-5444", extra_prefs=None, debug_info=None, symbols_path=None, stackwalk_binary=None, certutil_binary=None, ca_certificate_path=None, e10s=False, enable_webrender=False, stackfix_dir=None, diff --git a/testing/xpcshell/mach_commands.py b/testing/xpcshell/mach_commands.py index 5500b2edc7cb..87f713e8a81a 100644 --- a/testing/xpcshell/mach_commands.py +++ b/testing/xpcshell/mach_commands.py @@ -183,7 +183,7 @@ class AndroidXPCShellRunner(MozbuildObject): for root, _, paths in os.walk(os.path.join(kwargs["objdir"], "gradle")): for file_name in paths: if file_name.endswith(".apk") and file_name.startswith( - "geckoview-withGeckoBinaries" + "test_runner-withGeckoBinaries" ): kwargs["localAPK"] = os.path.join(root, file_name) print("using APK: %s" % kwargs["localAPK"]) diff --git a/testing/xpcshell/remotexpcshelltests.py b/testing/xpcshell/remotexpcshelltests.py index 903620b016f2..82e0b798d2ec 100644 --- a/testing/xpcshell/remotexpcshelltests.py +++ b/testing/xpcshell/remotexpcshelltests.py @@ -63,7 +63,7 @@ class RemoteProcessMonitor(object): # tests get foreground priority scheduling. self.device.launch_activity( self.package, - intent="org.mozilla.geckoview.test.XPCSHELL_TEST_MAIN", + intent="org.mozilla.geckoview.test_runner.XPCSHELL_TEST_MAIN", activity_name="TestRunnerActivity", e10s=True, ) @@ -314,7 +314,7 @@ class RemoteXPCShellTestThread(xpcshell.XPCShellTestThread): self, cmd, stdout, stderr, env, cwd, timeout=None, test_name=None ): rpm = RemoteProcessMonitor( - "org.mozilla.geckoview.test", + "org.mozilla.geckoview.test_runner", self.device, self.log, self.remoteLogFile, @@ -449,7 +449,7 @@ class XPCShellRemote(xpcshell.XPCShellTests, object): self.initDir(self.profileDir) # Make sure we get a fresh start - self.device.stop_application("org.mozilla.geckoview.test") + self.device.stop_application("org.mozilla.geckoview.test_runner") for i in range(options["threadCount"]): RemoteProcessMonitor.processStatus += [False]