Skip to content
This repository has been archived by the owner on Nov 7, 2018. It is now read-only.

Commit

Permalink
Bug 1465480 - Clean up crash dumps in GeckoView tests r=jchen,esawin
Browse files Browse the repository at this point in the history
We have tests that intentionally crash the content process. This
leaves crash dumps, but we don't want the harness to think that
this is something unexpected, so delete those when necessary.

MozReview-Commit-ID: 9CjmuvwOYwv
  • Loading branch information
snorp committed Jun 8, 2018
1 parent 070b8d7 commit cde0ed3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import android.view.MotionEvent;
import android.view.Surface;

import java.io.File;
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down Expand Up @@ -1406,6 +1407,13 @@ protected boolean isUsingSession(final GeckoSession session) {
return session.equals(mMainSession) || mSubSessions.contains(session);
}

protected void deleteCrashDumps() {
File dumpDir = new File(sRuntime.getProfileDir(), "minidumps");
for (final File dump : dumpDir.listFiles()) {
dump.delete();
}
}

protected void cleanupStatement() throws Throwable {
mWaitScopeDelegates.clear();
mTestScopeDelegates.clear();
Expand All @@ -1425,6 +1433,10 @@ protected void cleanupStatement() throws Throwable {
cleanupSession(mMainSession);
}

if (mIgnoreCrash) {
deleteCrashDumps();
}

if (mDisplay != null) {
mDisplay.surfaceDestroyed();
mMainSession.releaseDisplay(mDisplay);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.gecko.util.ThreadUtils;

import java.io.File;

public final class GeckoRuntime implements Parcelable {
private static final String LOGTAG = "GeckoRuntime";
private static final boolean DEBUG = false;
Expand Down Expand Up @@ -231,6 +233,14 @@ public RuntimeTelemetry getTelemetry() {

}

/**
* Get the profile directory for this runtime. This is where Gecko stores
* internal data.
*/
public File getProfileDir() {
return GeckoThread.getActiveProfile().getDir();
}

@Override // Parcelable
public int describeContents() {
return 0;
Expand Down

0 comments on commit cde0ed3

Please sign in to comment.