mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
Bug 763526 - send current session ping before persisted pings; r=taras
This commit is contained in:
parent
3725866350
commit
8c4e8da7e7
@ -467,6 +467,8 @@ TelemetryPing.prototype = {
|
||||
|
||||
getPayloads: function getPayloads(reason) {
|
||||
function payloadIter() {
|
||||
yield this.getCurrentSessionPayloadAndSlug(reason);
|
||||
|
||||
if (this._pendingPings.length > 0) {
|
||||
let data = this._pendingPings.pop();
|
||||
// Send persisted pings to the test URL too.
|
||||
@ -475,8 +477,6 @@ TelemetryPing.prototype = {
|
||||
}
|
||||
yield data;
|
||||
}
|
||||
|
||||
yield this.getCurrentSessionPayloadAndSlug(reason);
|
||||
}
|
||||
|
||||
let payloadIterWithThis = payloadIter.bind(this);
|
||||
|
@ -76,7 +76,7 @@ function getSavedHistogramsFile(basename) {
|
||||
|
||||
function telemetryObserver(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(telemetryObserver, aTopic);
|
||||
httpserver.registerPathHandler(PATH, checkPersistedHistogramsSync);
|
||||
httpserver.registerPathHandler(PATH, checkHistogramsSync);
|
||||
let histogramsFile = getSavedHistogramsFile("saved-histograms.dat");
|
||||
setupTestData();
|
||||
|
||||
@ -218,19 +218,22 @@ function checkPayload(request, reason, successfulPings) {
|
||||
}
|
||||
|
||||
function checkPersistedHistogramsSync(request, response) {
|
||||
httpserver.registerPathHandler(PATH, checkHistogramsSync);
|
||||
// Even though we have had two successful pings when this handler is
|
||||
// run, we only had one successful ping when the histograms were
|
||||
// saved.
|
||||
checkPayload(request, "saved-session", 1);
|
||||
}
|
||||
|
||||
function checkHistogramsSync(request, response) {
|
||||
checkPayload(request, "test-ping", 2);
|
||||
|
||||
Services.obs.addObserver(runAsyncTestObserver, "telemetry-test-xhr-complete", false);
|
||||
}
|
||||
|
||||
function checkHistogramsSync(request, response) {
|
||||
httpserver.registerPathHandler(PATH, checkPersistedHistogramsSync);
|
||||
checkPayload(request, "test-ping", 1);
|
||||
}
|
||||
|
||||
function runAsyncTestObserver(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(runAsyncTestObserver, aTopic);
|
||||
httpserver.registerPathHandler(PATH, checkPersistedHistogramsAsync);
|
||||
httpserver.registerPathHandler(PATH, checkHistogramsAsync);
|
||||
let histogramsFile = getSavedHistogramsFile("saved-histograms2.dat");
|
||||
|
||||
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsIObserver);
|
||||
@ -248,16 +251,19 @@ function runAsyncTestObserver(aSubject, aTopic, aData) {
|
||||
}
|
||||
|
||||
function checkPersistedHistogramsAsync(request, response) {
|
||||
httpserver.registerPathHandler(PATH, checkHistogramsAsync);
|
||||
// do not need the http server anymore
|
||||
httpserver.stop(do_test_finished);
|
||||
// Even though we have had four successful pings when this handler is
|
||||
// run, we only had three successful pings when the histograms were
|
||||
// saved.
|
||||
checkPayload(request, "saved-session", 3);
|
||||
|
||||
gFinished = true;
|
||||
}
|
||||
|
||||
function checkHistogramsAsync(request, response) {
|
||||
// do not need the http server anymore
|
||||
httpserver.stop(do_test_finished);
|
||||
checkPayload(request, "test-ping", 4);
|
||||
|
||||
gFinished = true;
|
||||
httpserver.registerPathHandler(PATH, checkPersistedHistogramsAsync);
|
||||
checkPayload(request, "test-ping", 3);
|
||||
}
|
||||
|
||||
// copied from toolkit/mozapps/extensions/test/xpcshell/head_addons.js
|
||||
|
Loading…
Reference in New Issue
Block a user