зеркало из https://github.com/mozilla/gecko-dev.git
bug 1482466 - Ensure subsession activeTicks are correct in simpleMeasurements r=Dexter
Differential Revision: https://phabricator.services.mozilla.com/D3128 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f0b033f907
Коммит
81200add33
|
@ -809,7 +809,7 @@ var Impl = {
|
|||
}
|
||||
|
||||
if (clearSubsession) {
|
||||
this._subsessionStartActiveTicks = activeTicks;
|
||||
this._subsessionStartActiveTicks = this._sessionActiveTicks;
|
||||
}
|
||||
|
||||
ret.activeTicks = activeTicks;
|
||||
|
|
|
@ -49,3 +49,52 @@ add_task(async function test_record_activeTicks() {
|
|||
|
||||
await TelemetryController.testShutdown();
|
||||
});
|
||||
|
||||
function tick(aHowMany) {
|
||||
for (let i = 0; i < aHowMany; i++) {
|
||||
Services.obs.notifyObservers(null, "user-interaction-active");
|
||||
}
|
||||
}
|
||||
|
||||
function checkSessionTicks(aExpected) {
|
||||
let payload = TelemetrySession.getPayload();
|
||||
Assert.equal(payload.simpleMeasurements.activeTicks, aExpected,
|
||||
"Should record the expected number of active ticks for the session.");
|
||||
}
|
||||
|
||||
function checkSubsessionTicks(aExpected, aClearSubsession) {
|
||||
let payload = TelemetrySession.getPayload("main", aClearSubsession);
|
||||
Assert.equal(payload.simpleMeasurements.activeTicks, aExpected,
|
||||
"Should record the expected number of active ticks for the subsession.");
|
||||
if (aExpected > 0) {
|
||||
Assert.equal(payload.processes.parent.scalars["browser.engagement.active_ticks"], aExpected,
|
||||
"Should record the expected number of active ticks for the subsession, in a scalar.");
|
||||
}
|
||||
}
|
||||
|
||||
add_task(async function test_subsession_activeTicks() {
|
||||
await TelemetryController.testReset();
|
||||
Telemetry.clearScalars();
|
||||
|
||||
tick(5);
|
||||
checkSessionTicks(5);
|
||||
checkSubsessionTicks(5, true);
|
||||
|
||||
// After clearing the subsession, subsession ticks should be 0 but session
|
||||
// ticks should still be 5.
|
||||
checkSubsessionTicks(0);
|
||||
checkSessionTicks(5);
|
||||
|
||||
tick(1);
|
||||
checkSessionTicks(6);
|
||||
checkSubsessionTicks(1, true);
|
||||
|
||||
checkSubsessionTicks(0);
|
||||
checkSessionTicks(6);
|
||||
|
||||
tick(2);
|
||||
checkSessionTicks(8);
|
||||
checkSubsessionTicks(2);
|
||||
|
||||
await TelemetryController.testShutdown();
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче