Bug 1529082 - Move TestRunnerActivity to test_runner. r=ahal,owlish

The fact that the test runner app is defined inside the geckoview test package
has always felt like a hack to me. I've mistakenly thought that
TestRunnerActivity was used in GeckoView's junit tests many times (even though
that's not the case).

From what I can see, there's no way to generate an AAB package for androidTest,
so to be able to run Gecko tests as AAB we finally need to define the
TestRunner as an ordinary package instead.

Differential Revision: https://phabricator.services.mozilla.com/D127320
This commit is contained in:
Agi Sferro 2021-11-02 18:56:26 +00:00
Родитель 823690869d
Коммит dccddb81bc
56 изменённых файлов: 301 добавлений и 71 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -13,22 +13,11 @@
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name="androidx.multidex.MultiDexApplication">
<activity android:name=".TestRunnerActivity" android:exported="true"/>
<activity android:name=".GeckoViewTestActivity" android:exported="true"/>
<activity-alias android:name=".App" android:targetActivity=".TestRunnerActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="org.mozilla.geckoview.test.XPCSHELL_TEST"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity-alias>
<!-- This is used for crash handling in GeckoSessionTestRule -->
<service
android:name=".TestCrashHandler"
@ -50,18 +39,5 @@
<service android:name=".TestRuntimeService$instance1" android:enabled="true" android:exported="false" android:process=":runtime1" />
<service android:name=".TrackingPermissionService" android:enabled="true" android:exported="false" android:process=":tp" />
<!-- This is used to run xpcshell tests -->
<service android:name=".XpcshellTestRunnerService$i0" android:enabled="true" android:exported="true" android:process=":xpcshell0"/>
<service android:name=".XpcshellTestRunnerService$i1" android:enabled="true" android:exported="true" android:process=":xpcshell1"/>
<service android:name=".XpcshellTestRunnerService$i2" android:enabled="true" android:exported="true" android:process=":xpcshell2"/>
<service android:name=".XpcshellTestRunnerService$i3" android:enabled="true" android:exported="true" android:process=":xpcshell3"/>
<service android:name=".XpcshellTestRunnerService$i4" android:enabled="true" android:exported="true" android:process=":xpcshell4"/>
<service android:name=".XpcshellTestRunnerService$i5" android:enabled="true" android:exported="true" android:process=":xpcshell5"/>
<service android:name=".XpcshellTestRunnerService$i6" android:enabled="true" android:exported="true" android:process=":xpcshell6"/>
<service android:name=".XpcshellTestRunnerService$i7" android:enabled="true" android:exported="true" android:process=":xpcshell7"/>
<service android:name=".XpcshellTestRunnerService$i8" android:enabled="true" android:exported="true" android:process=":xpcshell8"/>
<service android:name=".XpcshellTestRunnerService$i9" android:enabled="true" android:exported="true" android:process=":xpcshell9"/>
</application>
</manifest>

Просмотреть файл

@ -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.");
}

Просмотреть файл

@ -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|."""

Просмотреть файл

@ -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",

Просмотреть файл

@ -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'
}

Просмотреть файл

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.mozilla.geckoview.test_runner">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name="androidx.multidex.MultiDexApplication">
<uses-library android:name="android.test.runner" android:required="false"/>
<activity android:name=".TestRunnerActivity" android:exported="true"/>
<activity-alias android:name=".App" android:targetActivity=".TestRunnerActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="org.mozilla.geckoview.test_runner.XPCSHELL_TEST"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity-alias>
<!-- This is used to run xpcshell tests -->
<service android:name=".XpcshellTestRunnerService$i0" android:enabled="true" android:exported="true" android:process=":xpcshell0"/>
<service android:name=".XpcshellTestRunnerService$i1" android:enabled="true" android:exported="true" android:process=":xpcshell1"/>
<service android:name=".XpcshellTestRunnerService$i2" android:enabled="true" android:exported="true" android:process=":xpcshell2"/>
<service android:name=".XpcshellTestRunnerService$i3" android:enabled="true" android:exported="true" android:process=":xpcshell3"/>
<service android:name=".XpcshellTestRunnerService$i4" android:enabled="true" android:exported="true" android:process=":xpcshell4"/>
<service android:name=".XpcshellTestRunnerService$i5" android:enabled="true" android:exported="true" android:process=":xpcshell5"/>
<service android:name=".XpcshellTestRunnerService$i6" android:enabled="true" android:exported="true" android:process=":xpcshell6"/>
<service android:name=".XpcshellTestRunnerService$i7" android:enabled="true" android:exported="true" android:process=":xpcshell7"/>
<service android:name=".XpcshellTestRunnerService$i8" android:enabled="true" android:exported="true" android:process=":xpcshell8"/>
<service android:name=".XpcshellTestRunnerService$i9" android:enabled="true" android:exported="true" android:process=":xpcshell9"/>
</application>
</manifest>

Просмотреть файл

@ -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");

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Двоичные данные
mobile/android/test_runner/src/main/res/drawable-nodpi/colors.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 16 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 4.7 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 5.5 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.8 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 3.0 KiB

После

Ширина:  |  Высота:  |  Размер: 3.0 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 4.9 KiB

После

Ширина:  |  Высота:  |  Размер: 4.9 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 2.0 KiB

После

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 2.8 KiB

После

Ширина:  |  Высота:  |  Размер: 2.8 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 4.5 KiB

После

Ширина:  |  Высота:  |  Размер: 4.5 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 6.9 KiB

После

Ширина:  |  Высота:  |  Размер: 6.9 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 6.3 KiB

После

Ширина:  |  Высота:  |  Размер: 6.3 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 10 KiB

После

Ширина:  |  Высота:  |  Размер: 10 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 9.0 KiB

После

Ширина:  |  Высота:  |  Размер: 9.0 KiB

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 15 KiB

После

Ширина:  |  Высота:  |  Размер: 15 KiB

Просмотреть файл

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources>
<string name="app_name">GeckoView Test Runner</string>
</resources>

Просмотреть файл

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
</resources>

Просмотреть файл

@ -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:

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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:

Просмотреть файл

@ -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:

Просмотреть файл

@ -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:

Просмотреть файл

@ -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

Просмотреть файл

@ -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:

Просмотреть файл

@ -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:

Просмотреть файл

@ -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(

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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"]

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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:

Просмотреть файл

@ -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
---

Просмотреть файл

@ -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 (

Просмотреть файл

@ -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:

Просмотреть файл

@ -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,

Просмотреть файл

@ -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"])

Просмотреть файл

@ -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]