mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1378036 - Factor out a utility method for about:tabcrashed tests. r=Felipe
MozReview-Commit-ID: 6JAicvHdFlV --HG-- extra : rebase_source : a7f0a9f5f799f710b230ebae4e69d9915e531977
This commit is contained in:
parent
63848b9f96
commit
245d4b515a
@ -1,36 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
const SERVER_URL = "http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs";
|
||||
const PAGE = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
|
||||
const EMAIL = "foo@privacy.com";
|
||||
|
||||
/**
|
||||
* Sets up the browser to send crash reports to the local crash report
|
||||
* testing server.
|
||||
*/
|
||||
add_task(async function setup() {
|
||||
// The test harness sets MOZ_CRASHREPORTER_NO_REPORT, which disables crash
|
||||
// reports. This test needs them enabled. The test also needs a mock
|
||||
// report server, and fortunately one is already set up by toolkit/
|
||||
// crashreporter/test/Makefile.in. Assign its URL to MOZ_CRASHREPORTER_URL,
|
||||
// which CrashSubmit.jsm uses as a server override.
|
||||
let env = Cc["@mozilla.org/process/environment;1"]
|
||||
.getService(Components.interfaces.nsIEnvironment);
|
||||
let noReport = env.get("MOZ_CRASHREPORTER_NO_REPORT");
|
||||
let serverUrl = env.get("MOZ_CRASHREPORTER_URL");
|
||||
env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
|
||||
env.set("MOZ_CRASHREPORTER_URL", SERVER_URL);
|
||||
|
||||
await setupLocalCrashReportServer();
|
||||
// By default, requesting the email address of the user is disabled.
|
||||
// For the purposes of this test, we turn it back on.
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.tabs.crashReporting.requestEmail", true]],
|
||||
});
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
env.set("MOZ_CRASHREPORTER_NO_REPORT", noReport);
|
||||
env.set("MOZ_CRASHREPORTER_URL", serverUrl);
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -1,36 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
const SERVER_URL = "http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs";
|
||||
const PAGE = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
|
||||
const COMMENTS = "Here's my test comment!";
|
||||
const EMAIL = "foo@privacy.com";
|
||||
|
||||
/**
|
||||
* Sets up the browser to send crash reports to the local crash report
|
||||
* testing server.
|
||||
*/
|
||||
add_task(async function setup() {
|
||||
// The test harness sets MOZ_CRASHREPORTER_NO_REPORT, which disables crash
|
||||
// reports. This test needs them enabled. The test also needs a mock
|
||||
// report server, and fortunately one is already set up by toolkit/
|
||||
// crashreporter/test/Makefile.in. Assign its URL to MOZ_CRASHREPORTER_URL,
|
||||
// which CrashSubmit.jsm uses as a server override.
|
||||
let env = Cc["@mozilla.org/process/environment;1"]
|
||||
.getService(Components.interfaces.nsIEnvironment);
|
||||
let noReport = env.get("MOZ_CRASHREPORTER_NO_REPORT");
|
||||
let serverUrl = env.get("MOZ_CRASHREPORTER_URL");
|
||||
env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
|
||||
env.set("MOZ_CRASHREPORTER_URL", SERVER_URL);
|
||||
|
||||
// On debug builds, crashing tabs results in much thinking, which
|
||||
// slows down the test and results in intermittent test timeouts,
|
||||
// so we'll pump up the expected timeout for this test.
|
||||
requestLongerTimeout(2);
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
env.set("MOZ_CRASHREPORTER_NO_REPORT", noReport);
|
||||
env.set("MOZ_CRASHREPORTER_URL", serverUrl);
|
||||
});
|
||||
await setupLocalCrashReportServer();
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -96,3 +96,28 @@ function getPropertyBagValue(bag, key) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the browser to send crash reports to the local crash report
|
||||
* testing server.
|
||||
*/
|
||||
async function setupLocalCrashReportServer() {
|
||||
const SERVER_URL = "http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs";
|
||||
|
||||
// The test harness sets MOZ_CRASHREPORTER_NO_REPORT, which disables crash
|
||||
// reports. This test needs them enabled. The test also needs a mock
|
||||
// report server, and fortunately one is already set up by toolkit/
|
||||
// crashreporter/test/Makefile.in. Assign its URL to MOZ_CRASHREPORTER_URL,
|
||||
// which CrashSubmit.jsm uses as a server override.
|
||||
let env = Cc["@mozilla.org/process/environment;1"]
|
||||
.getService(Components.interfaces.nsIEnvironment);
|
||||
let noReport = env.get("MOZ_CRASHREPORTER_NO_REPORT");
|
||||
let serverUrl = env.get("MOZ_CRASHREPORTER_URL");
|
||||
env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
|
||||
env.set("MOZ_CRASHREPORTER_URL", SERVER_URL);
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
env.set("MOZ_CRASHREPORTER_NO_REPORT", noReport);
|
||||
env.set("MOZ_CRASHREPORTER_URL", serverUrl);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user