зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1605246 - Kill main process if child process dies during tests. r=snorp
Right now we only detect `onCrash` on mochitests/reftests and `onKill` on junit tests. This change makes it so we wait for both on every type of test. Differential Revision: https://phabricator.services.mozilla.com/D57895 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
aeb47fe53f
Коммит
3f510fc3b6
|
@ -120,6 +120,12 @@ public class TestRunnerActivity extends Activity {
|
|||
};
|
||||
|
||||
private GeckoSession.ContentDelegate mContentDelegate = new GeckoSession.ContentDelegate() {
|
||||
private void onContentProcessGone() {
|
||||
if (System.getenv("MOZ_CRASHREPORTER_SHUTDOWN") != null) {
|
||||
sRuntime.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTitleChange(GeckoSession session, String title) {
|
||||
|
||||
|
@ -152,9 +158,12 @@ public class TestRunnerActivity extends Activity {
|
|||
|
||||
@Override
|
||||
public void onCrash(GeckoSession session) {
|
||||
if (System.getenv("MOZ_CRASHREPORTER_SHUTDOWN") != null) {
|
||||
sRuntime.shutdown();
|
||||
}
|
||||
onContentProcessGone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKill(GeckoSession session) {
|
||||
onContentProcessGone();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -98,6 +98,7 @@ public class GeckoSessionTestRule implements TestRule {
|
|||
private static final Method sOnPageStop;
|
||||
private static final Method sOnNewSession;
|
||||
private static final Method sOnCrash;
|
||||
private static final Method sOnKill;
|
||||
|
||||
static {
|
||||
try {
|
||||
|
@ -108,6 +109,8 @@ public class GeckoSessionTestRule implements TestRule {
|
|||
sOnNewSession = GeckoSession.NavigationDelegate.class.getMethod(
|
||||
"onNewSession", GeckoSession.class, String.class);
|
||||
sOnCrash = GeckoSession.ContentDelegate.class.getMethod(
|
||||
"onCrash", GeckoSession.class);
|
||||
sOnKill = GeckoSession.ContentDelegate.class.getMethod(
|
||||
"onKill", GeckoSession.class);
|
||||
} catch (final NoSuchMethodException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
@ -1031,7 +1034,8 @@ public class GeckoSessionTestRule implements TestRule {
|
|||
session = (GeckoSession) args[0];
|
||||
}
|
||||
|
||||
if (sOnCrash.equals(method) && !mIgnoreCrash && isUsingSession(session)) {
|
||||
if ((sOnCrash.equals(method) || sOnKill.equals(method))
|
||||
&& !mIgnoreCrash && isUsingSession(session)) {
|
||||
if (env.shouldShutdownOnCrash()) {
|
||||
getRuntime().shutdown();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче