mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 888556 - Use a dynamic port in telemetry/ xpcshell tests so they can be run in parallel. r=nfroyd
This commit is contained in:
parent
f02f38b438
commit
cbe020acda
@ -18,7 +18,6 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/LightweightThemeManager.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
const SERVER = "http://localhost:4444";
|
||||
const IGNORE_HISTOGRAM = "test::ignore_me";
|
||||
const IGNORE_HISTOGRAM_TO_CLONE = "MEMORY_HEAP_ALLOCATED";
|
||||
const IGNORE_CLONED_HISTOGRAM = "test::ignore_me_also";
|
||||
@ -41,13 +40,18 @@ const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry
|
||||
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsITelemetryPing);
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
var serverStarted = false;
|
||||
var gFinished = false;
|
||||
|
||||
function telemetry_ping () {
|
||||
TelemetryPing.gatherStartup();
|
||||
TelemetryPing.enableLoadSaveNotifications();
|
||||
TelemetryPing.cacheProfileDirectory();
|
||||
TelemetryPing.testPing(SERVER);
|
||||
if (serverStarted) {
|
||||
TelemetryPing.testPing("http://localhost:" + httpserver.identity.primaryPort);
|
||||
} else {
|
||||
TelemetryPing.testPing("http://doesnotexist");
|
||||
}
|
||||
}
|
||||
|
||||
// Mostly useful so that you can dump payloads from decodeRequestPayload.
|
||||
@ -83,7 +87,8 @@ function registerPingHandler(handler) {
|
||||
}
|
||||
|
||||
function nonexistentServerObserver(aSubject, aTopic, aData) {
|
||||
httpserver.start(4444);
|
||||
httpserver.start(-1);
|
||||
serverStarted = true;
|
||||
|
||||
// Provide a dummy function so it returns 200 instead of 404 to telemetry.
|
||||
registerPingHandler(dummyHandler);
|
||||
|
Loading…
Reference in New Issue
Block a user